I am trying to compile a program of mine, that needs C++11
features and a newer version of boost
than is installed on the target machine. I therefore compiled and installed gcc 4.9
to some local directory (/secured/local
) with an in-tree build of all dependencies and the binutils. I then downloaded boost 1.55
and ran ./boostrap.sh --prefix=/secured/local && ./b4 install
to install boost. Both compilations worked fine and gcc -std=c++11
also works.
My program is built using cmake with the usual FindXX.cmake
procedure of finding files. I am running cmake like this:
cmake ../source/ -DBOOST_ROOT=/secured/local -DCMAKE_EXE_LINKER_FLAGS='-Wl,-rpath,/secured/local/lib'
which successfully finds my new boost installation and the new version of gcc. Compilation and linking both work flawlessly. However, upon execution of my program I am getting the following errors:
$ ./surface
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./surface)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./surface)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./surface)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by ./surface)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /secured/local/lib/libconfig++.so.9)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /secured/local/lib/libboost_program_options.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /secured/local/lib/libboost_program_options.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /secured/local/lib/libboost_program_options.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /secured/local/lib/libboost_filesystem.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /secured/local/lib/libboost_regex.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /secured/local/lib/libboost_regex.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /secured/local/lib/libboost_regex.so.1.55.0)
./surface: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /secured/local/lib/libboost_regex.so.1.55.0)
Running objdump
on boost shows
objdump -x /secured/local/lib/libboost_program_options.so.1.55.0 | grep stdc++
NEEDED libstdc++.so.6
required from libstdc++.so.6:
It appears as if both the boost libs try to use the old /usr/lib64/libstdc++.so.6
instead the new one in /secured/local/lib
. What did I do wrong in my procedure?
Note, that I try to avoid setting the LD_LIBRARY_PATH
somewhere.
rpath
way of specifying the lib directory - doesn't work. Executing my program withLD_LIBRARY_PATH=/secured/local/lib
also doesn't work.