I am trying to run an executable that works fine on my machine on a computer at my university. This computer lacks a compiler, as well as the libraries that I need, such as boost libs.
So, I compiled the program on my computer and copied the binary and all the libraries that I could find using ldd / objdump on another computer. Unfortunately, when I start, the linker does not start the program:
LD_LIBRARY_PATH="." ./my_program
./my_program: relocation error: ./libc.so.6: symbol _dl_find_dso_for_object, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference
Of course, I was looking for a network: relocation errors seem to occur when the wrong version of a library is used. However, I do not see how this is possible when I put the same libraries that are present at compile time.
I read that LD_BIND_NOW can be used to debug dynamic linking; Using it, segfaults program immediately. I compiled version c -Og -ggdb, ran it on the server, and downloaded the resulting kernel kernel to my computer (there is also no gdb on the other computer). Here's the session:
$ gdb ./my_program core
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /my_program...done.
warning: core file may not match specified executable file.
[New LWP 8912]
warning: Can't read pathname for load map: Input/output error.
warning: .dynamic section for "/lib64/ld-linux-x86-64.so.2" is not at the expected address (wrong library or version mismatch?)
warning: Could not load shared library symbols for 14 libraries, e.g. ./libboost_program_options.so.1.54.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `./my_program'.
Program terminated with signal 11, Segmentation fault.
(gdb) bt
(gdb)
At this moment, I really do not know how to act. I would welcome any suggestions. Thanks!
PS: The compilation flags look like this (I also tried the flags that I use -march = native on the target machine):
/usr/bin/c++ \
-Wall -Wextra -Woverloaded-virtual -Wpedantic -std=c++11 -pthread -Og -ggdb \
-Wl,--warn-unresolved-symbols,--warn-once ... -o my_program \
-rdynamic -lboost_program_options -lboost_system -lboost_filesystem -lboost_regex