[cmake-developers] CMake adds libgcc_eh.a to the linker line on AIX

Brad King brad.king at kitware.com
Fri Feb 7 09:33:53 EST 2014


On 02/07/2014 09:03 AM, Ådne Hovda wrote:
> I notice that under certain conditions CMake adds libgcc_eh.a to the 
> linker line.

CMake has no builtin knowledge of this library so it must be coming
the detection of libraries implicitly added by the compiler front-end.
Take a look at CMakeFiles/<cmake-version>/CMake(C|CXX)Compiler.cmake
files in the build tree.  There should be lines that set variables
like CMAKE_C_IMPLICIT_LINK_LIBRARIES.  Does libgcc_eh.a appear in
any of them?  Also look at CMakeFiles/CMakeOutput.log for content
following lines like

 Parsed C implicit link information from above output

and

 Parsed CXX implicit link information from above output

That has verbose information about how CMake detects these libraries.

This is related to the mixed-language support, usually used for linking
C++/Fortran together.  When computing a link line CMake looks at all
the languages that it knows have been compiled into object files
involved in the link.  It wants to ensure that the libraries normally
added by the compiler for each language will appear.  Whatever lang's
compiler is used to drive the link has a known set of libraries.  All
other libraries implicitly used by the other languages will be added
to the link line explicitly.

-Brad




More information about the cmake-developers mailing list