NCLibardi
NCLibardi

Reputation: 1

Problems when running application in target machine

I have a c++ project which uses c++20 std and is compiled in my local machine using gcc11 (the target machine has gcc8.5). Then I transfer the executable to my target machine and use ldd command to check if I have all the necessary shared libraries to my executable in my target machine. Obviously, the output is the following:

./tests_ss_vs_ms: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./tests_ss_vs_ms)
./tests_ss_vs_ms: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./tests_ss_vs_ms)
./tests_ss_vs_ms: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by ./tests_ss_vs_ms)
    linux-vdso.so.1 (0x00007ffdfcff5000)
    libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f4aa5717000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f4aa5395000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f4aa4fd0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4aa6139000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f4aa4dcc000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4aa4bac000)  

What I have tried so far:

  1. To cross compile using gcc8.5. Problem: my project uses concepts, which gcc8.5 is not able to recognize, thus compilation errors occur.
  2. To statically link the libraries by setting some cmake environment variable, like: set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so"),
    set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") or set(CMAKE_EXE_LINKER_FLAGS 'static'). Problems: libm.so and libc.so are still built dynamically and using -static give me problems because it try to link libgomp.so statically (libc.so and libm.so have static versions but libgomp.so doesn't).
  3. Lastly, to transfer libc.so.6 and libm.so.6 to my target machine and use LD_PRELOAD trick. Problem: it results in segmentation fault when running the application, which does not happen when I run it in my local machine.

OBS: I only have permission to run things in my target machine, hence I am not allowed to update libc.so and libm.so in my target machine.

Anyone has any idea of what I could do? Thanks in advance!

Upvotes: 0

Views: 55

Answers (0)

Related Questions