[CMake] pass compile flags to initial compiler test..

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Tue Sep 21 11:07:53 EDT 2010


Hi,

The output follows below this message. It fails because of the -rdynamic flag I think. In the CMakeLists.txt file I can suppress this with the command "SET(CMAKE_SKIP_RPATH ON)", but this does not seem to have any effect in the toolchain file (?). If I try to manually compile/link without the rdynamic flag I get this:
> $ lf95 -fPIC -Wa,--32 CMakeFiles/CompilerIdFortran/CMakeFortranCompilerId.F90 -L/usr/lib
> f95: warning: Invalid suboption PIC specified for -f.
> Encountered 0 errors, 0 warnings in file CMakeFiles/CompilerIdFortran/CMakeFortranCompilerId.F90.
> $ ls -gh
> total 28K
> -rwxr-xr-x 1 si  13K 21.09.2010 17:04 a.out*
> -rw-r--r-- 1 si  13K 21.09.2010 16:58 CMakeCache.txt
> drwxr-xr-x 6 si 2.0K 21.09.2010 16:58 CMakeFiles/

Best Regards
Yngve I. Levinsen


Output from cmake with toolchain file:
> $ cmake -DCMAKE_TOOLCHAIN_FILE=../LinuxLF95.cmake ..
> -- The C compiler identification is GNU
> -- The CXX compiler identification is GNU
> -- The Fortran compiler identification is unknown
> -- Check for working C compiler: /afs/cern.ch/sw/lcg/contrib/gcc/4.3.2/x86_64-slc5-gcc34-opt/bin/gcc
> -- Check for working C compiler: /afs/cern.ch/sw/lcg/contrib/gcc/4.3.2/x86_64-slc5-gcc34-opt/bin/gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /afs/cern.ch/sw/lcg/contrib/gcc/4.3.2/x86_64-slc5-gcc34-opt/bin/g++
> -- Check for working CXX compiler: /afs/cern.ch/sw/lcg/contrib/gcc/4.3.2/x86_64-slc5-gcc34-opt/bin/g++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working Fortran compiler: /afs/cern.ch/sw/fortran/lahey/lf9562c/bin/lf95
> -- Check for working Fortran compiler: /afs/cern.ch/sw/fortran/lahey/lf9562c/bin/lf95 -- broken
> CMake Error at /usr/share/cmake/Modules/CMakeTestFortranCompiler.cmake:25 (MESSAGE):
>   The Fortran compiler "/afs/cern.ch/sw/fortran/lahey/lf9562c/bin/lf95" is
>   not able to compile a simple test program.
> 
>   It fails with the following output:
> 
>    Change Dir: /afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp
> 
>   
> 
>   Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
> 
>   /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
>   CMakeFiles/cmTryCompileExec.dir/build
> 
>   gmake[1]: Entering directory
>   `/afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp'
> 
> 
>   /usr/bin/cmake -E cmake_progress_report
>   /afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp/CMakeFiles
>   1
> 
>   Building Fortran object
>   CMakeFiles/cmTryCompileExec.dir/testFortranCompiler.f.o
> 
>   /afs/cern.ch/sw/fortran/lahey/lf9562c/bin/lf95 -o
>   CMakeFiles/cmTryCompileExec.dir/testFortranCompiler.f.o -Wa,--32 -c
>   /afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp/testFortranCompiler.f
> 
> 
>   Encountered 0 errors, 0 warnings in file
>   /afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp/testFortranCompiler.f.
> 
> 
>   Linking Fortran executable cmTryCompileExec
> 
>   /usr/bin/cmake -E cmake_link_script
>   CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
> 
>   /afs/cern.ch/sw/fortran/lahey/lf9562c/bin/lf95 -fPIC -Wa,--32
>   CMakeFiles/cmTryCompileExec.dir/testFortranCompiler.f.o -o cmTryCompileExec
>   -rdynamic
> 
>   /usr/bin/ld: bad -rpath option
> 
>   gmake[1]: *** [cmTryCompileExec] Error 1
> 
>   gmake[1]: Leaving directory
>   `/afs/cern.ch/user/y/ylevinse/scratch1/public/madx-cmake/buildlahey/CMakeFiles/CMakeTmp'
> 
> 
>   gmake: *** [cmTryCompileExec/fast] Error 2
> 
>   
> 
>   
> 
>   CMake will not be able to correctly generate this project.
> Call Stack (most recent call first):
>   CMakeLists.txt:3 (PROJECT)
> 
> 
> -- Configuring incomplete, errors occurred!






On Tuesday 21 September 2010 15:33:04 Molsen, Hannes wrote:
> Hi,
> 
> what part of the compiler test fails? The "detect ABI" or the "check working" test? Could you post the output?
> Maybe it's a similar problem as I had in [1]
> 
> - Hannes
> 
> [1] http://www.mail-archive.com/cmake@cmake.org/msg31486.html
> 
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Yngve Inntjore Levinsen
> Sent: Dienstag, 21. September 2010 14:55
> To: cmake at cmake.org
> Subject: Re: [CMake] pass compile flags to initial compiler test.. now an assembler issue
> 
> Hi,
> 
> Again Hannes, thank you for your help! It is very valuable to me and I'm learning even more about how cmake and compiling in general works! :)
> 
> I added a toolchain file (did not know about this feature before), but it seems that the option "SET(CMAKE_SKIP_RPATH ON)" is ignored in the toolchain file? This means that the compiler test fails. I could skip this by using the command "CMAKE_FORCE_Fortran_COMPILER(lf95 Lahey)" but sadly this was from what I can see added in CMake 2.8.1 (for C and CXX it is available in 2.6.x). Since on our server we have version 2.6.4 installed, I find myself "very close but no sigar".
> 
> Perhaps I should rather try to convince the person in charge that we don't need support for this compiler...
> 
> Best Regards
> Yngve I. Levinsen
> 
> 
> On Tuesday 21 September 2010 08:23:17 Molsen, Hannes wrote:
> > Hi Yngve,
> > 
> > > -----Original Message-----
> > > From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Yngve Inntjore Levinsen
> > > Sent: Montag, 20. September 2010 18:38
> > > To: cmake at cmake.org
> > > Subject: Re: [CMake] pass compile flags to initial compiler test.. now an assembler issue
> > >
> > > Hi,
> > >
> > > Thank you for your very quick response Hannes! I tried to set SET(CMAKE_Fortran_FLAGS_INIT "...") in my CMakeLists.txt, but since it didn't work I tried to dig a bit deeper.
> > 
> > If you put that in your CMakeLists.txt it will not be used for the initial compiler test, as the CMakeLists.txt is processed after the test. You have to write it either in a toolchain / platform file [1] or add it (haven't tried this myself) to your toolchain in the gui (+ add entry) [2]
> > 
> > [1] http://www.paraview.org/Wiki/CMake_Cross_Compiling
> > [2] http://mash-project.eu/wiki/images/5/51/CMakeGui_Start.png
> > 
> > 
> > > It seems that my early assumptions were wrong, if I enter the folder CMakeFiles/CompilerIdFortran/ and try to compile manually I get the following output:
> > > $ lf95 CMakeFortranCompilerId.F 
> > > Encountered 0 errors, 0 warnings in file CMakeFortranCompilerId.F.
> > > /tmp/asmHexTje.s: Assembler messages:
> > > /tmp/asmHexTje.s:51: Error: suffix or operands invalid for `push'
> > >
> > > Does anyone know what this means? I hardly know what an assembler is.. 
> > 
> > Just for the assembler:
> > Usually you compile your file from high language to the binary with intermediate steps. The last step before the object code is the assembler where mnemonics are translated into processor operation codes [3]. One of these mnemonics is "push" which causes a data word to be pushed on the stack.
> > 
> > For me this looks like a problem regarding your compiler flags, because this error message may arise if you try to push between 32 and 64 bit words. I suppose you double check your compiler manual for the correct flags. But I'm not really speaking from experience in this point, it's more an idea what to look for than a solution :)
> > 
> > [3] http://en.wikipedia.org/wiki/Assembly_language#Assembler
> > 
> > > Yngve
> > >
> > 
> > - Hannes
> > ---
> > This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
> > 
> > Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
> > 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> 


More information about the CMake mailing list