I've a problem that drive me crazy. I've an Ubuntu developer machine. I've downloaded a toolkit and I've included it into my C project (eclipse). Well, if I build the project using eclipse on a centos VM the resultant application, copied to the ubuntu system works well. On the centos machine the command make produce at any time a working application.
If I copy the project, including the makefile, on the ubuntu machine and rebuild by means of make command (the makefile doesn't change!!!!!!!) the application built has a "symbol lookup error: .... undefined symbol ...."
the function that is not found is 'declared' (but not implemented) into a library (included into the toolkit, not my production!!!) and implemented into another library (always into the toolkit clearly).
WHY???? And Above all, how to fix? I should include also these dynamic libraries at linking time? (but the makefile is the same!)
same makefile two differents OS, make doesn't work tow differents OS, copied application and relevant libraries, it works
Thanks a lot... one beer (in Bremen)to who makes me understand where I'm doing a ...
I add more details:
cmd (same on ubuntu and centos):
gcc -L/home/andrea/put/lib -o "put" ./main.o -ltrek_toolkit_ds_api -ltrek_toolkit_common_api -ltrek_toolkit_cfdp_api -lcfdp_plus -lrt
gcc versions:
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 [NOT WORKING]
gcc (GCC) 4,8,3 20140911 (Red Hat 4,8,3-9) [WORKING]
ldd put on Ubuntu:
linux-vdso.so.1 => (0x00007ffd26b15000)
libtrek_toolkit_ds_api.so.0 => not found
libtrek_toolkit_common_api.so.0 => not found
libtrek_toolkit_cfdp_api.so.0 => not found
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f23d29cb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f23d2606000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f23d23e8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f23d2bd3000)
ldd put on Centos:
linux-vdso.so.1 => (0x00007fffdd569000)
libtrek_toolkit_ds_api.so.0 => not found
libtrek_toolkit_common_api.so.0 => not found
libtrek_toolkit_cfdp_api.so.0 => not found
libcfdp_plus.so.0 => not found
<--- !!! this is the difference !!!
librt.so.1 => /lib64/librt.so.1 (0x00007f158e0c9000)
libc.so.6 => /lib64/libc.so.6 (0x00007f158dd08000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f158daec000)
/lib64/ld-linux-x86-64.so.2 (0x00007f158e2fb000)
tryed on Ubuntu (doesn't work naymore):
gcc -L/home/andrea/put/lib -o "put" ./main.o -ltrek_toolkit_ds_api -ltrek_toolkit_common_api -ltrek_toolkit_cfdp_api -Wl,--whole-archive -lcfdp_plus -Wl,--no-whole-archive -lrt
Error:
./put: symbol lookup error: /home/andrea/put/lib/libtrek_cfdp_device_api.so: undefined symbol: register_printf_debug
"register_printf_debug" is included in library cfdp_plus, that is included when built on centos and not when built on Ubuntu.
So, how to tell to the linker to do its job and to include this library?