Problem:
I'm having difficulty linking glibcc / glibc ++ to a shared library using CMake and GCC4.9 on my Ubuntu 16.04 installation.
Additional terms:
Downloading the shared library poses a problem in the Red Hat production environment (where I copy it), I suppose, because it uses a different version of libstc ++ (error: GLIBCXX_3_4_20 not found). I do not have sudo permissions and cannot update the machine.
As I understood from this blog, in this post I tried to link static links with libgcc and libgc ++ using:
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
and using again
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
But that does not work. What this CMake script works:
add_library(myLib SHARED ${SOURCE_FILES}) set(CMAKE_EXE_LINKER_FLAGS " -static") target_link_libraries(myLib -static-libgcc -static-libstdc++)
This must be the wrong way to do this, as far as I know, -static -libgcc and -static-libstdC ++ are linker options, not libraries ...
Question : How to link statically with -libgcc and -libstdC ++?
Thanks in advance!
c ++ gcc g ++ cmake static-linking
DA--
source share