[cfe-dev] Linking 'clang' with static GCC libraries

Martin J. O'Riordan Martin.ORiordan at Movidius.com
Mon Nov 17 07:33:09 PST 2014

| I can build and use 'clang' on Linux 64-bit using standard settings
| and GCC v4.8.2, but I cannot run the resulting 'clang' executable on
| some machines because the version of GCC on the system is too old, 
| and 'clang' cannot find the required version GCC shared libraries
| such as 'glibcxx/libstdc++'.  Unfortunately, for various reasons, it
| is not possible to upgrade the version of GCC that is deployed on
| these machines.
| So I was trying to figure out how I can link 'clang' with the regular
| static GCC libraries, but I haven't been able to find a configuration
| option for doing this in either 'CMake' or with 'configure'.
| Is there a way of building 'clang' that will use the static versions of
the GCC libraries?

I think I found the solution to this.  I have reconfigured using 'CMake'
and added the following:

   "-DCMAKE_EXE_LINKER_FLAGS:STRING=-static-libgcc -static-libstdc++

to the command-line, and that appears to have resolved it.


	Martin O'Riordan (Movidius Ltd.)

More information about the cfe-dev mailing list