xiaoyeli / superlu

Supernodal sparse direct solver. https://portal.nersc.gov/project/sparse/superlu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unterminated #endif in superlu_config.fh with CMake

ArmstrongJ opened this issue · comments

When I build with CMake and -Denable_fortran=YES, the build will fail with


    2 | #ifndef SUPERLU_CONFIG_H
      |
Error: unterminated #ifndef
FORTRAN\CMakeFiles\dfexm.dir\build.make:88: recipe for target 'FORTRAN/CMakeFiles/dfexm.dir/hbcode1.F90.obj' failed

The error stems from the steps to regenerate superlu_config.fh. Specifically, the CMake-generate sed command in the Makefile:

cd /d C:\superlu\build64\FORTRAN && sed '/^\// d' < superlu_config.h > temp.fh

Testing the sed command, you'll see that it specifically strips the line:

#endif /* SUPERLU_CONFIG_H */

out of the file entirely since it has a C comment on it. The problem originates from FORTRAN/CMakeLists.txt:96 for reference.

Also, somewhat related, but generating a file in the source tree seems highly problematic as well. I would argue that superlu_config.fh should really be generated in the build directory (probably in the FORTRAN subdirectory).

Pull Request #127 should fix this issue as well as eliminate the generation of superlu_config.fh within the source tree when using CMake.

Fortran works for me on Linux with CMake. The header contains the #endif. Probably a Windows issues. That's why it got unnoticed.
Anyway, should be fixed!

This should be resolved from #135