9

I have a compiled library (without source) for a fingerprint driver. I'm sure it's an ARM compilation because the command file mylib.so says:

ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

but if I want use them in a C++ program I have always the same error:

error while loading shared libraries: mylib.so: cannot open shared object file: No such file or directory

this error like you see it's not very explicit, of course i have used the export command on the variable LD_LIBRARY_PATH with the path of mylib.so.

so, How to known if a ARM library (.so) is compatible with the raspberry PI ?

-- Edit --

ldd libsgfdu03.so:
not a dynamic executable

ldd libsgfdu04.so:
not a dynamic executable

ldd libsgfpamx.so:
not a dynamic executable

In the SDK, with the .so, I have a sample C++ program to manage the driver. With two commands for compile in one makefile:

g++ -I./ -I../include -c main.cpp --> include one file named "sgfplib.h"

g++ /usr/lib/arm-linux-gnueabihf/libusb.so -lpthread -lsgfpamx -lsgfdu03 -lsgfplib -o ../bin/arm12/sgfplibtest_fdu03 main.o -L/home/pi/sdk/lib/arm12

All the paths are good and no error is reported at compile time, but after ldd on the final executable ldd sgfplibtest_fdu03 says:

    /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f76000)
    libusb-0.1.so.4 => /lib/arm-linux-gnueabihf/libusb-0.1.so.4 (0xb6f5a000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6f3b000)
    libsgfpamx.so => not found
    libsgfdu04.so => not found
    libsgfplib.so => not found
    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6e6e000)
    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6dfd000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6dd5000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ca6000)
    /lib/ld-linux-armhf.so.3 (0xb6f83000)

-- Edit same driver with debian x86 --

dpkg -S libsgfpamx.so 

dpkg-query: no path found matching pattern *libsgfpamx.so*

ldd sgfplibtest_fdu03 :

    linux-gate.so.1 =>  (0xb76eb000)
    libusb-0.1.so.4 => /lib/libusb-0.1.so.4 (0xb76d1000)
    libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb76b8000)
    libsgfpamx.so => /usr/local/lib/libsgfpamx.so (0xb769d000)
    libsgfdu03.so => /usr/local/lib/libsgfdu03.so (0xb7632000)
    libsgfplib.so => /usr/local/lib/libsgfplib.so (0xb7623000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7536000)
    libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7510000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb74f1000)
    libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb73aa000)
    /lib/ld-linux.so.2 (0xb76ec000)

The same exe (but compiled for x86) does not seem to required nothing more. I'm totally lost ....

Jacobm001
  • 11,898
  • 7
  • 46
  • 56
  • It may be depending on something that is not installed. Run ldd mylib.so and see what comes out – Lawrence Sep 06 '13 at 01:04
  • ldd mylib.so say "not a dynamic executable" :( – Gilles Grandguillaume Sep 06 '13 at 20:28
  • "not a dynamic executable" == I think you are out of luck. ldd is a good way to tell. Note that there is not just one ARM architecture -- the pi is ARM11, aka. ARMv6, and there is an ARMv7 (Cortex) which is not compatible. I do not know of an easy way to tell the executables apart though. – goldilocks Sep 07 '13 at 12:27
  • it's the reverse.the driver is for ARM9, i guess some programs for ARM9 are compatible with ARM11. but in my case ... seem not :(. – Gilles Grandguillaume Sep 07 '13 at 20:20

2 Answers2

4

Try ldd foo.so and see if there is any reasonable output. If you get "warning: you do not have execution permission" it's because .so files are supposed to be executable ;).

Beyond that, I don't know if there is a simple way to check a .so for system compatibility, but I doubt you'd get the "Not found" error -- I think it really cannot find it (I also think there is a more appropriate "file format not recognized" error, and in fact that the linker might not recognize such a problem to start with). So just to be sure we are on the same page with that:

  • Create a symlink in the same directory, ln -s foo.so libfoo.so.1 -- the later is what ld will be looking for.

  • Now compile a test program g++ -L/directory/path test.cpp -lfoo.

Does it still say "No such file or directory"?

WRT ldd output, if you get stuff like this:

libsgfpamx.so => not found

It indicates the .so is linked to another .so that cannot be found in the library path and therefore is likely not installed. If there is reason to believe this is a common library that should be available -- eg. pthreads -- you can search the raspbian repository for packages containing that file:

> dpkg -S libpthread.so
libc6-dev:armhf: /usr/lib/arm-linux-gnueabihf/libpthread.so
libc6:armhf: /lib/arm-linux-gnueabihf/libpthread.so.0

Now we know that there are several packages with such a filename in them (libc6-dev, and libc6:armhf). Of course pthreads is already installed anyway. Going back to your actual problem:

dpkg -S libsgfpamx.so
dpkg-query: no path found matching pattern *libsgfpamx.so*

Strongly implying we are out of luck WRT a raspbian package.

Searching online for "libsgfpamx.so" and "sgfpamx" returns...nothing. Almost certainly these are esoteric or internal things that were built along with mylib.so, and if you have them somewhere already you are in luck, otherwise you'll have to inquire with the people responsible for "mylib.so".

goldilocks
  • 58,859
  • 17
  • 112
  • 227
-2

The libsg libs are Secugen libs. You'll have to get an SDK and rebuild them for your platform.

jeff
  • 1