1

My executable compiles, but then fails to run saying he cannot load a shared library. But the named library is right there (and LD_LIBRARY_PATH is set to right here too); and both objects are 64b.

$ l
-rwxrwxr-x  1 dario dario  13M May  2 17:46 pose-estimator* 
-rw-rw-r--  1 dario dario  12K May  2 19:52 Makefile
-rwxr-xr-x  1 dario dario 6.0M May  2 20:06 libmyelin.so.1*

$ make                                                                      
[100%] Built target pose-estimator     

$ pwd
/home/dario/nethra-pose-estimation/build

$ echo $LD_LIBRARY_PATH
/home/dario/nethra-pose-estimation/build

$ file pose-estimator libmyelin.so.1                                   
pose-estimator: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=598251a1370ca6547010a0c5d712738b4a698e57, with debug_info, not stripped               
libmyelin.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c83470883245833a03e26dd8f1e4a23a5eb9c512, stripped                    

$ ./pose-estimator                                                                                                                                    
./pose-estimator: error while loading shared libraries: libmyelin.so.1: cannot open shared object file: No such file or directory                 

What?

Why is the dynamic linker complaining with "error while loading shared libraries: libmyelin.so.1: cannot open shared object file: No such file or directory" ?

What's the next debug step to resolve this issue?

WurmD
  • 1,231
  • 5
  • 21
  • 42
  • Does this answer your question? [Linux error while loading shared libraries: cannot open shared object file: No such file or directory](https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s) – Ken White May 02 '20 at 18:57
  • What I got from it was "set the LD_LIBRARY_PATH var to where the lib is". But I did, and got same error when running the program. Editted my question to include it – WurmD May 02 '20 at 22:20

2 Answers2

2

Who is complaining with "error while loading shared libraries: libmyelin.so.1: cannot open shared object file: No such file or directory" ?

The dynamic linker is.

What's the next debug step to resolve this issue?

Run file pose-estimator libmyelin.so.1. Chances are that one of them is 64-bit (x86_64) while the other is 32-bit (i386).

Update:

My guess was somewhat wrong: both files are for x86_64. But this file

libmyelin.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c83470883245833a03e26dd8f1e4a23a5eb9c512, stripped                    

has the wrong (OS/ABI): ELFOSABI_SYSV instead of (expected) ELFOSABI_GNU. Runtime loader ignores files from "foreign" OSes.

P.S. Your pose-estimator appears to be corrupt: interpreter /lib64/l should be interpreter /lib64/ld-linux-x86-64.so.2.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • file pose-estimator libmyelin.so.1 pose-estimator: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=598251a1370ca6547010a0c5d712738b4a698e57, with debug_info, not stripped libmyelin.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c83470883245833a03e26dd8f1e4a23a5eb9c512, stripped :( editted my question to add it – WurmD May 04 '20 at 05:11
  • That isn't it. A colleague is able to run the equivalent project in his user, and it also displays dario@Hetzner-GPU3:/mnt/home/viktor/build/pose-test$ file /mnt/home/viktor/build/pose-test/pose-estimator /mnt/home/viktor/build/pose-test/trt-lib/libmyelin.so.1.0.0 pose-estimator: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=060d1900e8e5af7766386c20a3b2d580265f09f2, with debug_info, not stripped libmyelin.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),... – WurmD May 04 '20 at 09:40
  • And I'm able to run his executable from my user. What a mystery... I'll attempt rebuilding everything from scratch – WurmD May 04 '20 at 09:40
  • Fixed. The error is uninformative. When pointing LD_LIBRARY_PATH to TensorRT-7.0.0.11/lib/ (which has other libraries needed) it runs. – WurmD May 04 '20 at 19:43
0

Fixed. The error is uninformative. When pointing LD_LIBRARY_PATH to TensorRT-7.0.0.11/lib/ (which has other libraries needed) it runs.

So, if nothing seems to work for you (like it did for me) research the library that the dynamic linker is complaining about, verify if it is part of a greater whole, and the point LD_LIBRARY_PATH to the location with that family of libraries.

WurmD
  • 1,231
  • 5
  • 21
  • 42