[CMake] fortran compiler failed to compile simple test program

Brad King brad.king at kitware.com
Mon Jun 15 12:59:11 EDT 2015


On 06/15/2015 11:31 AM, Ette, Anthony (CDS) wrote:
> Any ideas?  Our FORTRAN compiler (Concurrent Computer Corporation
> port of f77) is failing to compile simple test program because the
> linker can't find -lrt

>From the log:

>   /usr/ccs/bin/cf77 -c /home/bzpl46/sandbox/AE3007/C2/build/redhawk/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTryCompileExec3634533531.dir/testFortranCompiler.f.o
>   /usr/ccs/bin/cf77 CMakeFiles/cmTryCompileExec3634533531.dir/testFortranCompiler.f.o -o   cmTryCompileExec3634533531 -rdynamic
>   /usr/ccs/release/7.3/lib_ia32/ld: cannot find -lrt

This is pretty typical usage of a compiler to compile and link a
program.  Perhaps cf77 is responding to -rdynamic and adding -lrt.

The -rdynamic flag is known to work with GNU compilers on Linux:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Linux-GNU.cmake;hb=v3.3.0-rc2#l21

That setting may be getting re-used because we don't distinguish
cf77 from GNU f77 currently.  For the Intel Fortran compiler we
turn off use of -rdynamic here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Linux-Intel-Fortran.cmake;hb=v3.3.0-rc2#l4

Something similar may be needed for this compiler.  Does it define
a preprocessor macro to identify itself?

Thanks,
-Brad



More information about the CMake mailing list