Hello,
I performed a few other tests and finally got the results I needed.
I added the rpath statement to my build:
Then I rebuilt the Debug image of my shared lib and the EXE (they are in the same C::B workspace). I linked to the shared lib as normal and not to a copy of the shared lib as I mention in a previous post. I linked to the shared lib using a relative path.
Using the command “readelf -d PortingLayerTest” at a shell, I received:
Dynamic section at offset 0x4dee0 contains 29 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [bin/DebugLinux32/TestDll.so] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000f (RPATH) Library rpath: [.]
0x0000000c (INIT) 0x804ab1c
0x0000000d (FINI) 0x807df9c
0x00000004 (HASH) 0x80481ac
0x6ffffef5 (GNU_HASH) 0x804880c
0x00000005 (STRTAB) 0x80495fc
0x00000006 (SYMTAB) 0x80488ec
0x0000000a (STRSZ) 3051 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x8095ff4
0x00000002 (PLTRELSZ) 1472 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x804a55c
0x00000011 (REL) 0x804a52c
0x00000012 (RELSZ) 48 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x804a38c
0x6fffffff (VERNEEDNUM) 7
0x6ffffff0 (VERSYM) 0x804a1e8
0x00000000 (NULL) 0x0
Where the path of the TestDll.so is not what I want.
I then took a hex editor and changed the executable file so the path to the shared lib is gone:
Dynamic section at offset 0x4dee0 contains 29 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [TestDll.so] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000f (RPATH) Library rpath: [.]
0x0000000c (INIT) 0x804ab1c
0x0000000d (FINI) 0x807df9c
0x00000004 (HASH) 0x80481ac
0x6ffffef5 (GNU_HASH) 0x804880c
0x00000005 (STRTAB) 0x80495fc
0x00000006 (SYMTAB) 0x80488ec
0x0000000a (STRSZ) 3051 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x8095ff4
0x00000002 (PLTRELSZ) 1472 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x804a55c
0x00000011 (REL) 0x804a52c
0x00000012 (RELSZ) 48 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x804a38c
0x6fffffff (VERNEEDNUM) 7
0x6ffffff0 (VERSYM) 0x804a1e8
0x00000000 (NULL) 0x0
Executing this from the shell, running it from the IDE and debugging it from the IDE all work.
Now the question is: How can I get the C::B build process to only put the name of the shared lib in the “Dynamic section” of the EXE without using a relative path?
Thank you,
edwin