[CMake] fortran compiler failed to compile simple test program

Brad King brad.king at kitware.com
Mon Jun 15 14:04:58 EDT 2015


On 06/15/2015 01:53 PM, Ette, Anthony (CDS) wrote:
> Thank you for the response.  I suppose I should've provided
> more information about the platform up front.  Our system is a
> RHEL5 variant named "RedHawk Linux".  The kernel is a custom
> real-time kernel developed by Concurrent Computer Corporation
> and cf77 is a real-time port of the GNU f77 compiler so it

Is the compiler hosted natively on that platform or are you
cross-compiling to it?

> I have asked the developers if a preprocessor macro is
> defined for future version of Cmake to latch onto.

That would be useful, thanks.  Version information should also
be made available via preprocessor macros.

> The -lrt is the option to link to the concurrent real-time libraries
> which is the default for the compiler (regardless of rdynamic).

Okay.  If -lrt is the default for the compiler why might "rt" not
be found?

> So my problem is that, given Cmake doesn't support natively, I
> need a way to "beat" it into submission.  Correct me if I'm
> wrong, but I think I need to create a toolchain file to

A toolchain file is normally used for true cross-compiling.
You may be able to use one here too, but if you want to skip
the compiler checks then you need to use the CMakeForceCompiler
module's helpers within the toolchain file.  First I think we
should identify why the compiler doesn't work for the simple
test case though.  Maybe some other fix is needed.

Does building a simple test program by hand work?

$ cat test.f
        PROGRAM TESTFortran
        PRINT *, 'Hello'
        END
$ cf77 test.f

If the compiler requires some special environment to be loaded
then it is your responsibility to do that before running CMake.

Thanks,
-Brad



More information about the CMake mailing list