broken cmake compilation
jvo203 opened this issue · 2 comments
jvo203 commented
The file src/nf/nf_activation.f90 listed in CMakeList.txt does not exist. The source folder contains nf_activation_1d.f90 instead.
chris@studio build % cmake .. -DSERIAL=1
-- Configuring build for serial execution
-- Configuring to build with -fcoarray=single
-- h5fortran 4.6.3 CMake 3.25.0
-- Looking for H5_HAVE_FILTER_SZIP
-- Looking for H5_HAVE_FILTER_SZIP - found
-- Looking for H5_HAVE_FILTER_DEFLATE
-- Looking for H5_HAVE_FILTER_DEFLATE - found
-- Looking for H5_HAVE_PARALLEL
-- Looking for H5_HAVE_PARALLEL - not found
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found SZIP: /opt/homebrew/lib/libsz.dylib
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HDF5_C_links
-- Performing Test HDF5_C_links - Success
-- Performing Test HDF5_Fortran_links
-- Performing Test HDF5_Fortran_links - Success
-- Found HDF5: /opt/homebrew/Cellar/hdf5/1.12.2_2/lib/libhdf5_hl.dylib;/opt/homebrew/Cellar/hdf5/1.12.2_2/lib/libhdf5.dylib (found suitable version "1.12.2", minimum required is "1.8.7") found components: Fortran HL
-- Found HDF5: /opt/homebrew/Cellar/hdf5/1.12.2_2/lib/libhdf5_hl.dylib;/opt/homebrew/Cellar/hdf5/1.12.2_2/lib/libhdf5.dylib (found version "1.12.2") found components: Fortran
-- Configuring done
CMake Error at CMakeLists.txt:25 (add_library):
Cannot find source file:
src/nf/nf_activation.f90
CMake Error at CMakeLists.txt:25 (add_library):
No SOURCES given to target: neural
CMake Generate step failed. Build files cannot be regenerated correctly.
The next file simply does not exist at all:
CMake Error at CMakeLists.txt:25 (add_library):
Cannot find source file:
src/nf/nf_base_layer_submodule.f90
After fixing CMakeLists.txt the compilation stops with an error:
[ 33%] Building Fortran object CMakeFiles/neural.dir/src/nf/nf_conv2d_layer.f90.o
/Users/chris/projects/neural-fortran/src/nf/nf_conv2d_layer.f90:5:7:
5 | use nf_activation_3d, only: activation_function
| 1
Fatal Error: Cannot open module file 'nf_activation_3d.mod' for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/neural.dir/src/nf/nf_conv2d_layer.f90.o] Error 1
make[1]: *** [CMakeFiles/neural.dir/all] Error 2
make: *** [all] Error 2
Adding src/nf/nf_activation_3d.f90 after src/nf/nf_activation_1d.f90 to the CMakeLists.txt fixed the compilation problem. The code compiled fine afterwards.
milancurcic commented
Thanks! Would you like to submit this fix as a PR?
We should also add, as a separate PR, a CMake build in GitHub Actions which would have caught this (currently only building and testing in CI using fpm).