[CMake] fortran compiler failed to compile simple test program

Ette, Anthony (CDS) Anthony.R.Ette at controlsdata.com
Tue Jun 16 01:21:40 EDT 2015


>The environment is not for CMake but for the compiler itself.  I was just saying that CMake is not going to know what environment variables the toolchain needs to have set in order for the compiler >to work.
>If you invoke CMake from the same environment as that by-hand test that worked earlier then that is the required environment.


Ok Yep - so the environment is good.  You mentioned that cmake doesn't take "much if anything" from my CmakeFiles.txt contents into consideration when compiling the test program, but what control does the user have over the compilation of the test program?  I.e. can I tell cmake to add -L (where to look for libraries) or -v (cf77 compiler verbose flag) when compiling the test program to avoid having to go to a full toolchain file and forcing the compiler?  Note that working with developers from Concurrent, I have found the -lrt is coming from /usr/lib/librt.so (for dynamic linking) and /usr/lib/librt.a (for static linking).  If /usr/lib is in my path, and cmake is being invoked from the same environment where I can compile hello world.f, then wouldn't this indicate a problem unique to cmake?  Why can't cmake find -lrt?  For reference, here's detailed output below when I compile the hello world.f; does this provide any clues as to where cmake is tripping up with this compiler?

rts1-4:/home/bzpl46/test2> cf77 -v -g test.f
environment: PDE_RELEASE = 7.3
environment: PDE_LINUX_RELEASE = i386-redhat-linux
environment: PDE_GCC_VERSION = 4.1.2
environment: PDE_CPU = pentium4
Compiling: /usr/ccs/release/7.3/lib_ia32/cxf77 -v -g3 --rel=7.3 -W/tmp/F77dw1YhNSx test.f /tmp/F77r.s1SNtdW
Concurrent Fortran 77 Compiler - Version  7.3 Tue Jun 16 00:57:59 2015
Input=test.f Assembly=/tmp/F77r.s1SNtdW
Error Summary: 0 Cautions,   0 Warnings,   0 Fatals
Elapsed wall time =   0.0 seconds   CPU time used =   0.0 seconds
Reordering code: /usr/ccs/release/7.3/lib_ia32/reorder64 -Zno_optimize -dw/tmp/F77dw1YhNSx < /tmp/F77r.s1SNtdW > /tmp/F77s1cqwy9
Assembling /tmp/F77s1cqwy9: /usr/bin/as --32 -o test.o /tmp/F77s1cqwy9
Linking executable: /usr/ccs/release/7.3/lib_ia32/ld -t -melf_i386 -u MAIN__ -dynamic-linker /lib/ld-linux.so.2 --allow-multiple-definition /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginT.o -v test.o -L/usr/ccs/release/7.3/lib_ia32 -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -lhU77 -lhF77 -lhI77 -lrt -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -o a.out /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o /usr/lib/crtn.o
GNU ld version 2.17.50.0.6-5.el5 20061020
/usr/ccs/release/7.3/lib_ia32/ld: mode elf_i386
/usr/lib/crt1.o
/usr/lib/crti.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginT.o
test.o
-lhU77 (/usr/ccs/release/7.3/lib_ia32/libhU77.so)
(/usr/ccs/release/7.3/lib_ia32/libhF77.so)ioinit.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.so)main.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.so)xarg.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.so)libhF77.so.1
-lhI77 (/usr/ccs/release/7.3/lib_ia32/libhI77.so)
-lrt (/usr/lib/librt.so)
-lm (/usr/lib/libm.so)
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
/lib/ld-linux.so.2
/usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
/usr/lib/crtn.o




>You can run CMake on that minimal project with --debug-trycompile to leave behind the test project directory.  That may help dig into how the test project is invoking the compiler.
Ok thank you for that, I do remember seeing that somewhere before.
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