On Saturday, 30 January 2016 at 04:11:07 UTC, Mike Parker wrote:
On Saturday, 30 January 2016 at 03:43:59 UTC, Taylor Hillegeist wrote:

Working through a simple example. I tried the cdecl option but for some reason i can compile but when i run my Gethello it cant find the shared library in the same folder?

taylor@taylor-NE510:~/Projects/PASCAL$ nm libhello.so
0000000000003ac0 T SubStr
taylor@taylor-NE510:~/Projects/PASCAL$ ./Gethello
./Gethello: error while loading shared libraries: libhello.so: cannot open shared object file: No such file or directory


The binary's directory is not on the system search path by default on Linux. This page [1] shows three possible solutions.

[1] http://www.aimlesslygoingforward.com/2014/01/19/bundling-shared-libraries-on-linux/

Now I'm wishing that was the problem. Interestingly enough when i link to a C shared library it works... but also it isn't show in the needed shared library sections like below.

taylor@taylor-NE510:~/Projects/PASCAL$ readelf -d Gethello

Dynamic section at offset 0x26dd8 contains 29 entries:
  Tag        Type                         Name/Value
0x0000000000000001 (NEEDED) Shared library: [libhello.so] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2] 0x000000000000000f (RPATH) Library rpath: [--export-dynamic]
 0x000000000000000c (INIT)               0x4017f8
 0x000000000000000d (FINI)               0x424444
 0x0000000000000019 (INIT_ARRAY)         0x626db0
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x626dc0
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x4002d0
 0x0000000000000005 (STRTAB)             0x400aa8
 0x0000000000000006 (SYMTAB)             0x4002f8
 0x000000000000000a (STRSZ)              1202 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x627000
 0x0000000000000002 (PLTRELSZ)           1824 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4010d8
 0x0000000000000007 (RELA)               0x401090
 0x0000000000000008 (RELASZ)             72 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x401000
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x400f5a
 0x0000000000000000 (NULL)               0x0
taylor@taylor-NE510:~/Projects/PASCAL$ ./Gethello
./Gethello: error while loading shared libraries: libhello.so: cannot open shared object file: No such file or directory

Reply via email to