[CMake] fortran compiler failed to compile simple test program

Ette, Anthony (CDS) Anthony.R.Ette at controlsdata.com
Mon Jun 15 15:42:25 EDT 2015


>Some information is considered but not all.  Try a minimal CMakeLists.txt:
> cmake_minimum_required(VERSION ...)
> project(TestProject Fortran)
>Does this enable Fortran correctly with cf77?  If so then you can start stripping down your project to debug this.
No joy.  Same error.  Must mean that the -lrt is not being added by Cmake or by myself so it must be the compiler. In either case, you mention that it is my responsibility to setup the environment before invoking Cmake and while I agree, it's just not clear to me what speficially Cmake requires to be setup.  I.e. PATH, LD_LIBRARY_PATH, etc.  Can you please elaborate on precisely how Cmake finds everything it needs to compile the simple test and what hooks/env vars the user has at his disposal to control this behavior?  I apologize if this is well documented somewhere and I just haven't been able to find it.  I'm pretty sure the lib that contains the -lrt is in /usr/lib/libccur_rt.a, but adding /usr/lib to the PATH and LD_LIBRARY_PATH aren't helping Cmake find it...

> So, in order of appropriateness, is it:
>  1) fix simple test case
Yes.
> 2) use toolchain file, then
> 3) force compiler using CMakeForceCompiler?
>>Those go together.  CMakeForceCompiler must be used in a toolchain file.
Ok, I didn't realize that.  If you look at my current toolchain file that I was playing around with, I'm not currently using the CMakeForceCompiler command.  I will keep in mind in case I have to go down this path.

>Okay.  One can see from the build log in the error message that CMake is not adding -lrt itself so the compiler front-end must be choosing to do it somehow.  What did you mean by "default for the >compiler"
>if it is not adding -lrt by default?
I'm not sure what I mean. :)  I'm working with concurrent to better understand where the -lrt is coming from and why it's needed.  I think it's more like certain "features" require this linkage.  E.g. when we link an executable that contains shared memory, we have to throw this flag.  Also note that we've architected such that FORTRAN is only ever used as a subroutine.  In other words, we no longer support FORTRAN main programs, and as such, we always use C/CXX to perform the link and thus have to manually point C/CXX to the fortran instrinsic libs.


Thanks,
-Brad


______________________________________________________________________
This email has been scanned.
This e-mail (including attachments) contains contents owned by Rolls-Royce plc and its subsidiaries, affiliated companies or customers and covered by the laws of England and Wales, Brazil, US, or Canada (federal, state or provincial). The information contained in this email is intended to be confidential, may be legally privileged and subject to export controls which may restrict the access to and transfer of the information. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, interception or copying of this communication is strictly prohibited and may subject you to further legal action. Reply to the sender if you received this email by accident, and then delete the email and any attachments.


More information about the CMake mailing list