Skip to content
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

Build error on Silicon with NAG Fortran #78

Open
dpo opened this issue Jan 23, 2023 · 5 comments
Open

Build error on Silicon with NAG Fortran #78

dpo opened this issue Jan 23, 2023 · 5 comments

Comments

@dpo
Copy link
Collaborator

dpo commented Jan 23, 2023

[110/1503] Compiling Fortran object libgalahad_hsl_single.dylib.p/src_kinds_kinds.F90.o
FAILED: libgalahad_hsl_single.dylib.p/src_kinds_kinds.F90.o libgalahad_hsl_single.dylib.p/galahad_kinds.mod
nagfor -Ilibgalahad_hsl_single.dylib.p -I. -I.. -I../include -Ilibgalahad_lapack.dylib.p -Ilibgalahad_blas.dylib.p -quiet -O0 -g -PIC -DGALAHAD_SINGLE -DSPRAL_SINGLE -DSPRAL_NO_HWLOC -DSPRAL_HAVE_SCHED_GETCPU -mdir libgalahad_hsl_single.dylib.p -o libgalahad_hsl_single.dylib.p/src_kinds_kinds.F90.o -c ../src/kinds/kinds.F90
Error: ../src/kinds/kinds.F90, line 45: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 46: Syntax error
       detected at <invalid token>@INTEGER
Error: ../src/kinds/kinds.F90, line 50: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 51: Syntax error
       detected at <invalid token>@INTEGER
Error: ../src/kinds/kinds.F90, line 52: Duplicate type declaration for RP_
       detected at RP_@=
Error: ../src/kinds/kinds.F90, line 52: PARAMETER RP_ has already been defined
       detected at R8_@<end-of-statement>
Error: ../src/kinds/kinds.F90, line 53: Duplicate type declaration for CP_
       detected at CP_@=
Error: ../src/kinds/kinds.F90, line 53: PARAMETER CP_ has already been defined
       detected at C8_@<end-of-statement>
Error: ../src/kinds/kinds.F90, line 54: Duplicate type declaration for RPC_
       detected at RPC_@=
Error: ../src/kinds/kinds.F90, line 54: PARAMETER RPC_ has already been defined
       detected at C_DOUBLE@<end-of-statement>
Error: ../src/kinds/kinds.F90, line 55: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 57: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 57: Syntax error
Error: ../src/kinds/kinds.F90, line 60: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 61: Syntax error
       detected at <invalid token>@INTEGER
Error: ../src/kinds/kinds.F90, line 62: Duplicate type declaration for IPC_
       detected at IPC_@=
Error: ../src/kinds/kinds.F90, line 62: PARAMETER IPC_ has already been defined
       detected at C_INT32_T@<end-of-statement>
Error: ../src/kinds/kinds.F90, line 63: Invalid #line directive
Error: ../src/kinds/kinds.F90, line 65: Syntax error
       detected at <invalid token>@END
@nimgould
Copy link
Contributor

If the compiler doesn't understand standard #ifdef then it will never work. The linux version of nagfor does understand this, and https://www.nag.com/nagware/np/r70_doc/fpp.html suggests that this is generally supported. What does
nagfor -c kinds.F90
report?

@dpo
Copy link
Collaborator Author

dpo commented Jan 23, 2023

nagfor -c kinds.F90 complains as above, but nagfor -fpp -c kinds.F90 works. It seems the preprocessor is not activated by defauilt.

@nimgould
Copy link
Contributor

Excellent. Under linux, a .F90 suffix implies -fpp, a bit odd that this doesn't follow for Macs

@dpo dpo reopened this Jan 24, 2023
@dpo
Copy link
Collaborator Author

dpo commented Jan 24, 2023

I'm reopening this because it requires a fix. What's happening is that fpp isn't triggered automatically by the F90 extension (capital F) on macOS. The reason is that most users don't install macOS as case sensitive (it isn't by default).

So we should really add the preprocessing flag to all compilers by default on macOS. Same thing on Windows.

@nimgould
Copy link
Contributor

Nice! Mac trying to emulate the best features of Windows

AFAIK, for Mac it is

-cpp for gfortran and
-fpp for nagfor and ifort, although for the latter it is on by default

I'll add these for the osx files on archdefs (for those of us who
might still use the makefiles)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants