Reputation: 141
I have a buildroot project in which I want to add a library compiled with pascal. The reason for this is that it is a custom library and porting it to C is too much work at this point. I am compiling it for a raspberry pi CM3. How it currently works:
libcustom.so
on an raspberry pi (raspbian). Now the problem I have is that the program that used this library cannot find the library (although it is in the /usr/lib/ folder). Using the ldd
command I got the following output:
$ ldd /usr/lib/libcustom.so
checking sub-depends for 'not found'
checking sub-depends for 'not found'
checking sub-depends for 'not found'
ld-linux-armhf.so.3 => not found (0x00000000)
libdl.so.2 => not found (0x00000000)
libc.so.6 => not found (0x00000000)
not a dynamic executable
By checking the output given by the same command on the system where I compiled the library helped me to resolve which sub-depends were missing. Since the architecture of both the systems is the same I figured that to test what is missing I could simply copy the libraries from the compilation system to the buildroot system. (libraries that were missing were libc.so.6
,libdl.so.2
and lib-linux-armhf.so.3
). Now ldd
gives me the following:
$ ldd /usr/lib/libcustom.so
checking sub-depends for '/lib/ld-linux-armhf.so.3'
checking sub-depends for '/usr/lib/libdl.so.2'
checking sub-depends for '/usr/lib/libc.so.6'
/lib/ld-linux-armhf.so.3 (0x76fc2000)
linux-vdso.so.1 (0x7ef00000)
checking sub-depends for '/usr/lib/libc.so.6'
/lib/ld-linux-armhf.so.3 (0x76ee8000)
linux-vdso.so.1 (0x7efeb000)
/lib/ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0x00000000)
libc.so.6 => /usr/lib/libc.so.6 (0x00000000)
/lib/ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0x00000000)
The custom library is still not working (and the ldd still points to empty (0x00000000) libraries.
I have been searching around a bit however there are still two things that I do not understand:
Upvotes: 0
Views: 833
Reputation: 5956
You can't take a library built on system A (Raspbian) and automagically expect this library to work on system B (built with Buildroot). Indeed the C library may be different, and the ABI may be different. Compatibility at the binary level is not trivial.
You've got two options here:
Make sure the Buildroot configuration matches the libc/ABI used on Raspbian. In your case, it seems like building a glibc toolchain in Buildroot with the EABIhf ABI should do the trick.
Build your library with Buildroot. That will require creating a package for a Pascal cross-compiler, and then a package for your library.
Upvotes: 1
Reputation: 26358
Is the distribution of both systems the same? Otherwise attempt to build the library cross with libraries from target.
Upvotes: 0