-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding perl bindings in embedded system #73
Comments
For starters, you stated Secondly, the probe failing to find anything sure looks weird. If you have some spare time, you might want to check the contents of |
Thanks for your prompt response. I have done a bit more work on this. I built all I needed on the embedded system and it all worked when I build it on the target machine.. so that shows that all the libraries and modules etc are the right version. Still the same problem with the cross compile build with yocto... I am new to building perl modules but as a general rule when cross compiling (arm-poky-linux-gnueabi-gcc is configured with --host=x86_64-linux --target=arm-poky-linux-gnueabi) the cross compiler does not produce code that would run on the x86_64 build machine. so the run failure is I guess should be expected!.. Now I looked at yocto recipes for other similar perl modules (http://cgit.openembedded.org/cgit.cgi/openembedded-core/tree/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb?h=master) for example that builds c code as well (https://metacpan.org/pod/XML::Parser contains links to the zip files) but this has no problems.. and builds ok.. so there must be some trick that I dont know about to get this to work. I find it hard to understand the Makefile.PL file and cant see which bit of the file results in the build and run step. Is it possible to disable the run part and still generate the perl module? The first part of the build has
How can fix up the Makefle.PL file to do the cross compiling??? Thanks for any assistance you can provide! |
Ha! answered my own question.. just commented out # run_check &assertlibs; and it seems I get further with the build.. and it produces a .pm file etc Will let you know how I progress! |
Ok so very close now I think.. yocto build seems to require libc.so.6 but I am quite sure that it should require an arm version of libc. I think that the Makefile.PL file contains some patch to override the library paths LD_LIBRARY_PATH.. this does not work with yocto when it is doing cross compiles it has some magic to ensure the correct compiler and libraries are found. I guess that I need to disable your patch in some way.. Also yocto requires a license file.. at the moment I am patching in GPLv3 but you might want a different license?.. not important for now just important if I make my layer public for others to use. |
Let me make sure we're on the same wavelength: you said "cross"-compile? I must admit I'm not familiar with cross-compilation using the Perl build tools, but my first reaction would be "doesn't sound like a good idea". So when you say cross-compile, what do you do exactly? Build for multiple platforms all at once? What steps/commands do you use? (below is me trying to guess what you are trying to do: feel free to ignore if this does not match your case) |
Hmm.. yocto is very complex and I dont want to have to get you involved with that side of things. Sorry this reply has taken so long.. I have been deep in python zmq.. looks like the python implementation is easier to get going and also has python numpy so is closer to what I need in the long term. One good point is that I have discovered a mass of perl modules at https://github.com/rehsack/meta-cpan. I searched that site and found most of the perl modules that I need. I have been rebuilding the embedded system every now and then and testing out the latest set of modules and libraries and finding / fixing version issues. Next time I re-install the embedded system I will have another go at the perl modules. As to the exact steps.. if you look at for example: https://github.com/rehsack/meta-cpan/blob/master/recipes-net/test-tcp-perl/test-tcp-perl_2.15.bb you will see that the recipe to create the perl module is very simple. Most of the work is done in a thing called cpan.bbclass (http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/cpan.bbclass?h=krogoth) that is "inherit cpan" into the recipe and all perl module recipes so that does not change. In theory copy and paste any of any of the test-tcp-perl_2.15.bb perl module recipes, change the name of the file and the SRC_URI to pick up the correct source and that is all you need to do. Then in the yocto environment you run a thing called bitbake and out pops a whole linux distribution with your new perl modules included. Cross compile because my build machine is an x86 machine and the linux distribution runs on an arm processor (the embedded system). In practice it is never as easy at that. My latest bitbake build still has warnings about libc.so.6 being required for ZMQ-LibZMQ3 as you can see below.. But the perl module is built ok.. I just have to prove it works.. I will let you know my progress in a day or so when I have added the final perl modules that I need and have had time to test the new build. Peter. `$ bitbake hdmi-image-debug Build Configuration: NOTE: Preparing RunQueue Summary: There were 2 WARNING messages shown. |
I am using yocto to build libzmq3 and the perl bindings.
I get the following:
Probing libzmq via pkg-config ...
Detected the following ZMQ settings:
Looks like ZMQ_INCLUDES is not found from the libzmq.pc package file.. but that file looks ok:
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include
Name: libzmq
Description: 0MQ c++ library
Version: 4.1.4
Libs: -L${libdir} -lzmq
Cflags: -I${includedir}
Anyway I fixed this in yocto by exporting the export ZMQ_INCLUDES location and that works but I still get a failure:
| Probing environment variables:
| Alien::ZMQ not found
| Probing libzmq via pkg-config ...
| + found libzmq 4.1.4
| + Detected ZMQ_LIBS from pkg-config...
| Detected the following ZMQ settings:
| + ZMQ_HOME = (null)
| + ZMQ_H = (null)
| + ZMQ_INCLUDES = /usr/include
| + ZMQ_LIBS = -lzmq
| + ZMQ_TRACE = (null)
| *** Module name IN: /usr/lib/perl/5.22.1/IO.pm
| *** p1: /usr/lib/ p3: perl/5.22.1/ p5: IO.pm
| *** Module name OUT: /usr/lib/perl-native/perl/5.22.1/IO.pm
| # arm-poky-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/ -O2 -pipe -g -feliminate-unused-debug-types -DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc assertlibM2QiFoty.c -I/usr/include -o assertlibtlHxWLPE
| # arm-poky-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/ -O2 -pipe -g -feliminate-unused-debug-types -DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc assertlibipzhaFu0.c -o assertlibhIw7zwaM -I/usr/include -lzmq
| assertlibhIw7zwaM: assertlibhIw7zwaM: cannot execute binary file
| wrong result: 'zmq'
Anyway I tried to build on the target and I get other errors towards the end of the make process:
CHECK: Does your zmq have zmq_ctx_new... YES
Checking if your kit is complete...
Looks good
Warning: prerequisite Task::Weaken 0 not found.
Warning: prerequisite Test::Fatal 0 not found.
Warning: prerequisite Test::Requires 0 not found.
Warning: prerequisite Test::TCP 1.08 not found.
Warning: prerequisite ZMQ::Constants 0 not found.
ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp at /usr/lib/perl/5.22.1/ExtUtils/MM_Unix.pm line 3578.
Any assistance or pointers to others who have used yocto and libzmq3 would be much appreciated. Looks like this is a bigger job than I expected!
Peter.
The text was updated successfully, but these errors were encountered: