[CMake] cmake FortranCInterface test fails in a linking step due to the -rdynamic option in Linux-GNU.cmake

Brad King brad.king at kitware.com
Thu Jan 8 13:30:30 EST 2015


On 1/8/2015 12:44 PM, Bob Walkup wrote:
> I think it would be preferable to replace "-rdynamic" with
> "-Wl,--export-dynamic" as follows:
> 
> set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,--export-dynamic")
> 
> in the Linux-GNU.cmake file that is provided by cmake.

What compiler id is reported when CMake enables Fortran?

The Linux-GNU module's behavior should not be getting invoked
for XL Fortran because the Fortran compiler id is "XL", not "GNU".

I'd like to understand how the option makes it to the link line:

 /opt/ibmcmp/xlf/15.1.1/bin/xlf90_r ... -rdynamic ...

Clearly it is choosing the Fortran compiler to drive the linker.
However, this means that

 CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS

should be used to get the flags.  How does that get -rdynamic into it?

Are you running in a fresh build tree with no remnants from a gfortran
build?

You could run cmake with the "--trace" option to get very verbose
output about how the execution proceeds.  It will be too much
to post to this list so try reading through it yourself or send
it to me off list.

Thanks,
-Brad


More information about the CMake mailing list