Skip to content

Build failure: Error: Symbol 'absolute' at (1) has no IMPLICIT type #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
barracuda156 opened this issue Mar 24, 2025 · 4 comments
Open

Comments

@barracuda156
Copy link

Build fails with gfortran 14.2.0:

/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_layer_constructors.mod CMakeFiles/neural-fortran.dir/nf_layer_constructors.mod.stamp GNU
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_linear2d_layer.mod CMakeFiles/neural-fortran.dir/nf_linear2d_layer.mod.stamp GNU
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_conv1d_layer.mod CMakeFiles/neural-fortran.dir/nf_conv1d_layer.mod.stamp GNU
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_dense_layer.mod CMakeFiles/neural-fortran.dir/nf_dense_layer.mod.stamp GNU
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_embedding_layer.mod CMakeFiles/neural-fortran.dir/nf_embedding_layer.mod.stamp GNU
/opt/local/bin/cmake -E touch CMakeFiles/neural-fortran.dir/src/nf/nf_layer_constructors.f90.o.provides.build
/opt/local/bin/cmake -E touch CMakeFiles/neural-fortran.dir/src/nf/nf_linear2d_layer.f90.o.provides.build
[ 38%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_locally_connected1d_layer.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_locally_connected1d_layer.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_locally_connected1d_layer.f90.o
/opt/local/bin/cmake -E touch CMakeFiles/neural-fortran.dir/src/nf/nf_conv1d_layer.f90.o.provides.build
[ 39%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_linear2d_layer_submodule.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_linear2d_layer_submodule.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_linear2d_layer_submodule.f90.o
[ 40%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_multihead_attention.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_multihead_attention.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_multihead_attention.f90.o
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_conv2d_layer.mod CMakeFiles/neural-fortran.dir/nf_conv2d_layer.mod.stamp GNU
[ 41%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_conv1d_layer_submodule.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_conv1d_layer_submodule.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_conv1d_layer_submodule.f90.o
/opt/local/bin/cmake -E touch CMakeFiles/neural-fortran.dir/src/nf/nf_dense_layer.f90.o.provides.build
/opt/local/bin/cmake -E touch CMakeFiles/neural-fortran.dir/src/nf/nf_embedding_layer.f90.o.provides.build
[ 42%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_dense_layer_submodule.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_dense_layer_submodule.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_dense_layer_submodule.f90.o
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_dense_layer_submodule.f90:132:2:

  132 | #ifdef PARALLEL
      |  1
Warning: Illegal preprocessor directive
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_dense_layer_submodule.f90:134:2:

  134 | #endif
      |  1
Warning: Illegal preprocessor directive
[ 43%] Building Fortran object CMakeFiles/neural-fortran.dir/src/nf/nf_embedding_layer_submodule.f90.o
/opt/local/bin/gfortran-mp-14   -pipe -Os -m32 -mmacosx-version-min=10.6 -Jinclude -fcoarray=single -c /opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90 -o CMakeFiles/neural-fortran.dir/src/nf/nf_embedding_layer_submodule.f90.o
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:1:2:

    1 | #define NONE 0
      |  1
Warning: Illegal preprocessor directive
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:2:2:

    2 | #define TRIGONOMETRIC 1
      |  1
Warning: Illegal preprocessor directive
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:3:2:

    3 | #define ABSOLUTE 2
      |  1
Warning: Illegal preprocessor directive
/opt/local/bin/cmake -E cmake_copy_f90_mod include/nf_layernorm_layer.mod CMakeFiles/neural-fortran.dir/nf_layernorm_layer.mod.stamp GNU
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:55:43:

   55 |       elseif (self % positional == ABSOLUTE) then
      |                                           1
Error: Symbol 'absolute' at (1) has no IMPLICIT type
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:53:44:

   53 |       if (self % positional == TRIGONOMETRIC) then
      |                                            1
Error: Symbol 'trigonometric' at (1) has no IMPLICIT type
/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/neural-fortran-0.20.0/src/nf/nf_embedding_layer_submodule.f90:17:29:

   17 |       res % positional = NONE
      |                             1
Error: Symbol 'none' at (1) has no IMPLICIT type
make[2]: *** [CMakeFiles/neural-fortran.dir/src/nf/nf_embedding_layer_submodule.f90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/build'
make[1]: *** [CMakeFiles/neural-fortran.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_ppcports_fortran_neural-fortran/neural-fortran/work/build'
make: *** [all] Error 2
@milancurcic
Copy link
Member

Hi Sergey, it seems that your CMake build doesn't have preprocessing enabled. Perhaps it's because your compiler is not recognized as GNU by the CMake rules? If you add -cpp to the flags, these errors should go away.

@barracuda156
Copy link
Author

@milancurcic Hmm, it should be recognized as GNU and normally it is. It might happen that the build picks a different preprocessor from system prefix (which is from gcc-4.2), and that does not work correctly with gcc-14 and its gfortran. I will look into this issue today, thank you for a suggestion.

@barracuda156
Copy link
Author

@milancurcic Okay, the problem is that the build only considers Release or Debug build:

add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-cpp;-fcheck=bounds;-fbacktrace>")
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-cpp;-Ofast;-fno-frontend-optimize;-fno-backtrace>")

Since this is not what MacPorts uses as default https://github.com/macports/macports-ports/blob/0e39368a28b6be200d5ea67196227027e1d180ac/_resources/port1.0/group/cmake-1.1.tcl#L40-L44 the needed -cpp flag was not passed.
I think it is a bug. There should be some default for build types not mentioned explicitly, since RelWithDebInfo and MinSizeRel are valid types, not specific to MacPorts.

@milancurcic
Copy link
Member

Sounds good, this change would be very welcome. If you know how to do it, can you go ahead and make a PR? Otherwise, I'll do a little bit of research and fix it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants