The program cannot find the correct version of glibc / libstdc ++, although it was statically linked

I am trying to link my program statically with glibc because the version of glibc on the target machine is pretty much unpredictable. I used the linker flags -static-libgcc and -static-libstdC ++ and it worked fine. The executable is large, but I can live with it. Unfortunately, when I run my executable on the target machine (in the example below it is called "mytest"), I get the following error:

./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by libboost_log.so.1.53.0)
./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by libboost_log.so.1.53.0)
./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by libboost_log.so.1.53.0)
./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by libboost_date_time.so.1.53.0)
./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by libboost_thread.so.1.53.0)

If I do the "lines" in mytest, it gives me

$ strings mytest | grep GLIBC
GLIBC_2.9
GLIBC_2.7
GLIBC_2.8
GLIBC_2.3.2
GLIBC_2.2.5
GLIBCXX_3.4.15
GLIBCXX_3.4.11
GLIBCXX_3.4.14
GLIBCXX_3.4.9
GLIBCXX_3.4

Which means, I think the static link is working fine. Why is the loader still trying to look for my functions in common glibc and libstdc ++? What am I doing wrong?

Thank!

+5
source
2

glibc, glibc . - -static-libgcc -static-libstd++, .

glibc (libc), libgcc libstdc++. , , , .

-static, .

Update:

; glibc. , libboost_log.so, libstdc++.so.6.

libboost*.a libboost*.so. :

g++ $(OBJS) -static-libgcc -static-libstdc++ -Wl,-Bstatic -lboost_log ... \
  -Wl,-Bdynamic

( -Wl,-Bdynamic.)

+5

-static-libgcc -static-libstdc++ . , boost (, ), libgcc libstd++.

:

ldd mytest

" ". - , , . , -static , .

+1

All Articles