xiaoyeli / superlu

Supernodal sparse direct solver. https://portal.nersc.gov/project/sparse/superlu/
Other
281 stars 96 forks source link

Unterminated #endif in superlu_config.fh with CMake #126

Closed ArmstrongJ closed 10 months ago

ArmstrongJ commented 1 year ago

When I build with CMake and _-Denablefortran=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 _superluconfig.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 _superluconfig.fh should really be generated in the build directory (probably in the FORTRAN subdirectory).

ArmstrongJ commented 1 year ago

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

gruenich commented 1 year ago

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!

xiaoyeli commented 10 months ago

This should be resolved from #135