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

Ådne Hovda ahovda at openit.com
Fri Feb 7 09:03:27 EST 2014


Hi

I'm building binaries for AIX using GCC and native ld (also testing with 
GCC cross-compiler with GNU binutils) and I get issues with exceptions 
not being caught like they should.

I'm linking a number of static C and C++ archives into several binaries 
and I notice that under certain conditions CMake adds libgcc_eh.a to the 
linker line. It actually appears twice in between target_link_libraries 
libs and the RPATH section at the end. Something like this:

c++ -g <object_files> -o <executable> -Wl,-brtl,-bexpall \
<link_libraries> \
<full_path_to>/libgcc_eh.a \
<full_path_to>/libgcc_eh.a \
-Wl,-blibpath:<rpath>

If I manually add libsupc++.a to the linker line my program links and 
runs correctly, BUT if I strip both libgcc_eh.a and libsupc++.a from the 
linker command it also links and runs correctly. Since supc++ is a 
subset of stdc++ I thought I wouldn't need that anyway.

Is this expected behavior? Is libgcc_eh.a really needed here or is there 
a way to avoid it? Or should CMake also add libsupc++?

Best Regards,
Ådne Hovda



More information about the cmake-developers mailing list