<html><body><p><font size="2">I'm trying to build the lapack library I obtained from </font><a href="http://www.netlib.org/lapack/lapack-3.8.0.tar.gz"><font size="2">http://www.netlib.org/lapack/lapack-3.8.0.tar.gz</font></a><font size="2">. 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</font><br><br><font size="2">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.</font><br><br><font size="2">When I attempt to build it, my build system issues these error messages</font><br><font size="2"> 99 CMakeFiles/VerifyFortranC.dir/main.c.o: In function `main':</font><br><font size="2"> >> 100 /nfshome/drw/spack/spack/opt/spack/linux-rhel7-ppc64le/gcc-4.8.5/cm</font><br><font size="2"> ake-3.11.1-rcn6qgw6pldsuuk2gkijnn4dalajl4wr/share/cmake-3.11/Module</font><br><font size="2"> s/FortranCInterface/Verify/main.c:(.text+0x24): undefined reference</font><br><font size="2"> to `VerifyFortran'</font><br><font size="2"> >> 101 clang-3.8: error: linker command failed with exit code 1 (use -</font><br><font size="2"> v to see invocation)</font><br><font size="2"> >> 102 gmake[3]: *** [VerifyFortranC] Error 1</font><br><font size="2"> 103 gmake[3]: Leaving directory `/tmp/drw/spack-staging/spack-stage</font><br><font size="2"> /spack-stage-h3S7X1/lapack-3.8.0/spack-build-static/CMakeFiles/Fort</font><br><font size="2"> ranCInterface/VerifyC'</font><br><br><font size="2">where cmake is attempting to verify Fortran/C compatibility for this pair of compilers.</font><br><br><font size="2">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</font><br><font size="2"> 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</font><br><font size="2"> Scanning dependencies of target VerifyFortranC</font><br><font size="2"> gmake[3]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC'</font><br><font size="2"> /bin/gmake -f CMakeFiles/VerifyFortranC.dir/build.make CMakeFiles/VerifyFortranC.dir/build</font><br><font size="2"> gmake[3]: Entering directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC'</font><br><font size="2"> [ 60%] Building C object CMakeFiles/VerifyFortranC.dir/main.c.o</font><br><font size="2"> /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</font><br><font size="2"> [ 80%] Building C object CMakeFiles/VerifyFortranC.dir/VerifyC.c.o</font><br><font size="2"> /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</font><br><font size="2"> [100%] Linking C executable VerifyFortranC</font><br><font size="2"> /nfshome/drw/cmake/bin/cmake -E cmake_link_script CMakeFiles/VerifyFortranC.dir/link.txt --verbose=1</font><br><font size="2"> /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</font><br><font size="2"> CMakeFiles/VerifyFortranC.dir/main.c.o: In function `main':</font><br><font size="2"> /nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Verify/main.c:(.text+0x24): undefined reference to `VerifyFortran'</font><br><font size="2"> clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)</font><br><font size="2"> gmake[3]: *** [VerifyFortranC] Error 1</font><br><font size="2"> gmake[3]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC'</font><br><font size="2"> gmake[2]: *** [CMakeFiles/VerifyFortranC.dir/all] Error 2</font><br><font size="2"> gmake[2]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC'</font><br><font size="2"> gmake[1]: *** [CMakeFiles/VerifyFortranC.dir/rule] Error 2</font><br><font size="2"> gmake[1]: Leaving directory `/nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface/VerifyC'</font><br><font size="2"> gmake: *** [VerifyFortranC] Error 2</font><br><br><font size="2">I tried to figure out what's happening by running cmake with the --trace-expand flag.</font><br><br><font size="2">When I backtrack thru the log, I see these error messages related to VerifyFortranC.</font><br><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(24): unset(FortranCInterface_VERIFIED_C CACHE )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(25): unset(FortranCInterface_VERIFIED_CXX CACHE )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(27): set(_result )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(30): set(CMAKE_TRY_COMPILE_CONFIGURATION Release )</font><br><font size="2">/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 )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(42): set(FortranCInterface_COMPILED FALSE )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(43): unset(FortranCInterface_COMPILED CACHE )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(46): if(FortranCInterface_COMPILED )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(54): else()</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(55): set(_result Failed to compile )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(56): set(FortranCInterface_EXE )</font><br><font size="2">/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:</font><br><font size="2"> Change Dir: /nfshome/drw/spack/lapack/build/CMakeFiles/FortranCInterface</font><br><br><font size="2">Run Build Command:"/bin/gmake" "FortranCInterface"</font><br><font size="2">Scanning dependencies of target myfort</font><br><font size="2">[ 2%] Building Fortran object CMakeFiles/myfort.dir/my_module.f90.o</font><br><font size="2">COMMAND LINE 1520-022 (W) The FREE option has been replaced by the option FREE(F90).</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/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.</font><br><font size="2">"/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/my_module.f90", 1515-002 (S) END card is missing. One is assumed.</font><br><font size="2">** _main === End of Compilation 1 ===</font><br><font size="2">1501-511 Compilation failed for file my_module.f90.</font><br><font size="2">gmake[3]: *** [CMakeFiles/myfort.dir/my_module.f90.o] Error 1</font><br><font size="2">gmake[2]: *** [CMakeFiles/myfort.dir/all] Error 2</font><br><font size="2">gmake[1]: *** [CMakeFiles/FortranCInterface.dir/rule] Error 2</font><br><font size="2">gmake: *** [FortranCInterface] Error 2</font><br><br><font size="2"> )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(63): set(FortranCInterface_SYMBOLS )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(64): if(FortranCInterface_EXE )</font><br><font size="2">/nfshome/drw/cmake/share/cmake-3.11/Modules/FortranCInterface/Detect.cmake(72): elseif(NOT _result )</font><br><br><font size="2">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.</font><br><br><font size="2">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.</font><br><br><font size="2">Can someone offer insight or resolution?</font><br><br><font size="2">Thanks</font><br><br><font size="2">Dave</font><br><br><br><BR>
</body></html>