I'm trying to build the lapack library I obtained from http://www.netlib.org/lapack/lapack-3.8.0.tar.gz. using the clang C compiler and the xlf Fortran compiler with cmake 3.11. I'm using a Power 9 Linux system running Red Hat 7
The default behavior for the xlf compiler is to mangle Fortran so the external symbol name is folded to all lower case with no trailing '_', In this case, VerifyFortran should be mangled tp verifyfortran. When I attempt to build it, my build system issues these error messages 99 CMakeFiles/VerifyFortranC.dir/main.c.o: In function `main': >> 100 /nfshome/drw/spack/spack/opt/spack/linux-rhel7-ppc64le/gcc-4.8.5/cm ake-3.11.1-rcn6qgw6pldsuuk2gkijnn4dalajl4wr/share/cmake-3.11/Module s/FortranCInterface/Verify/main.c:(.text+0x24): undefined reference to `VerifyFortran' >> 101 clang-3.8: error: linker command failed with exit code 1 (use - v to see invocation) >> 102 gmake[3]: *** [VerifyFortranC] Error 1 103 gmake[3]: Leaving directory `/tmp/drw/spack-staging/spack-stage /spack-stage-h3S7X1/lapack-3.8.0/spack-build-static/CMakeFiles/Fort ranCInterface/VerifyC' where cmake is attempting to verify Fortran/C compatibility for this pair of compilers. I tried to track this down by extracting this tar file in a scratch directory. The build process requires cmake to be invoked in a separate drectory from the source code so I created a 'build' directory in the parent directory where my lapack-3.8.0 source resided, cd to that directory and ran the command 'cmake ../lapack-3.8.0 -DCBLAS=ON' I get these messages cd /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC && /nfshome/drw/cmake/bin/cmake -E cmake_depends "Unix Makefiles" /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC/CMakeFiles/VerifyFortranC.dir/DependInfo.cmake Scanning dependencies of target VerifyFortranC gmake[3]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC' /bin/gmake -f CMakeFiles/VerifyFortranC.dir/build.make CMakeFiles/VerifyFortranC.dir/build gmake[3]: Entering directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC' [ 60%] Building C object CMakeFiles/VerifyFortranC.dir/main.c.o /opt/clang-coral/bin/clang -I/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC -O3 -DNDEBUG -o CMakeFiles/VerifyFortranC.dir/main.c.o -c /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify/main.c [ 80%] Building C object CMakeFiles/VerifyFortranC.dir/VerifyC.c.o /opt/clang-coral/bin/clang -I/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC -O3 -DNDEBUG -o CMakeFiles/VerifyFortranC.dir/VerifyC.c.o -c /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify/VerifyC.c [100%] Linking C executable VerifyFortranC /nfshome/drw/cmake/bin/cmake -E cmake_link_script CMakeFiles/VerifyFortranC.dir/link.txt --verbose=1 /opt/clang-coral/bin/clang -O3 -DNDEBUG CMakeFiles/VerifyFortranC.dir/main.c.o CMakeFiles/VerifyFortranC.dir/VerifyC.c.o -o VerifyFortranC -L/opt/ibm/xlsmp/5.1.0/lib -L/opt/ibm/xlmass/9.1.0/lib -L/opt/ibm/xlf/16.1.0/lib libVerifyFortran.a -lxlf90_r -lxlopt -lxlomp_ser -lxl -lxlfmath -ldl -lrt -lpthread -lm CMakeFiles/VerifyFortranC.dir/main.c.o: In function `main': /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify/main.c:(.text +0x24): undefined reference to `VerifyFortran' clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) gmake[3]: *** [VerifyFortranC] Error 1 gmake[3]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC' gmake[2]: *** [CMakeFiles/VerifyFortranC.dir/all] Error 2 gmake[2]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC' gmake[1]: *** [CMakeFiles/VerifyFortranC.dir/rule] Error 2 gmake[1]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC' gmake: *** [VerifyFortranC] Error 2 I tried to figure out what's happening by running cmake with the --trace-expand flag. When I backtrack thru the log, I see these error messages related to VerifyFortranC. /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (24): unset(FortranCInterface_VERIFIED_C CACHE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (25): unset(FortranCInterface_VERIFIED_CXX CACHE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (27): set(_result ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (30): set(CMAKE_TRY_COMPILE_CONFIGURATION Release ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (31): try_compile (FortranCInterface_COMPILED /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface FortranCInterface FortranCInterface CMAKE_FLAGS -DCMAKE_C_FLAGS:STRING= -DCMAKE_Fortran_FLAGS:STRING=-qfree -qthreaded -qhalt=e -qnosave -qstrict=none -qfixed -DCMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-O OUTPUT_VARIABLE FortranCInterface_OUTPUT ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (42): set(FortranCInterface_COMPILED FALSE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (43): unset(FortranCInterface_COMPILED CACHE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (46): if(FortranCInterface_COMPILED ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (54): else() /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (55): set(_result Failed to compile ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (56): set(FortranCInterface_EXE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (57): file (APPEND /nfshome/drw/spack/lapack/build/CMakeFiles/CMakeError.log Fortran/C interface test project failed with the following output: Change Dir: /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface Run Build Command:"/bin/gmake" "FortranCInterface" Scanning dependencies of target myfort [ 2%] Building Fortran object CMakeFiles/myfort.dir/my_module.f90.o COMMAND LINE 1520-022 (W) The FREE option has been replaced by the option FREE(F90). "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 1.0: 1515-005 (S) Continuation line is not permitted at beginning of program or after INCLUDE, EJECT, @PROCESS statements or comment directive. Line is ignored. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 2.0: 1515-005 (S) Continuation line is not permitted at beginning of program or after INCLUDE, EJECT, @PROCESS statements or comment directive. Line is ignored. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 3.0: 1515-005 (S) Continuation line is not permitted at beginning of program or after INCLUDE, EJECT, @PROCESS statements or comment directive. Line is ignored. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 4.3: 1515-017 (S) Label contains characters that are not permitted. Label is ignored. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 7.3: 1515-017 (S) Label contains characters that are not permitted. Label is ignored. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 8.20: 1515-030 (E) END INTERFACE card is missing. One is assumed. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", line 8.20: 1515-002 (S) END card is missing. One is assumed. "/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", 1515-002 (S) END card is missing. One is assumed. ** _main === End of Compilation 1 === 1501-511 Compilation failed for file my_module.f90. gmake[3]: *** [CMakeFiles/myfort.dir/my_module.f90.o] Error 1 gmake[2]: *** [CMakeFiles/myfort.dir/all] Error 2 gmake[1]: *** [CMakeFiles/FortranCInterface.dir/rule] Error 2 gmake: *** [FortranCInterface] Error 2 ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (63): set(FortranCInterface_SYMBOLS ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (64): if(FortranCInterface_EXE ) /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake (72): elseif(NOT _result ) These messages seem to result because the -qfixed flag is passed in the xlf invocation, while my_module.f90 is written in free format, so based on compiler options, the compiler error messages are legitimate. My problem is that I don't know if VerifyFortranC is doing somthing that is expected to fail and then recover from by alternate action or if something is broken. Can someone offer insight or resolution? Thanks Dave
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake