EGSnrc
EGSnrc copied to clipboard
Installation error on macOS 12 (Monterey)
Description
Installation fails on pegs4 compilation with the message:
********************* Compiling pegs4 ******************
Generating pegs4_osx.f from pegs4.mortran
At line 2504 of file mortran3.f (unit = 1, file = '/Users/blakewalters/EGSnrc/HEN_HOUSE/bin/osx/mortran3.dat')
Fortran runtime error: End of file
On closer investigation, this looks like an error in compiling the mortran3 compiler which generates an incomplete mortran3.dat file.
Compilers
Failure happens with:
- gcc, g++, gfortran installed with gcc-8 - gcc-11
- Any of the above gfortran compilers and the native (clang) versions of gcc, g++.
- gmake and the Mac's own (Xcode) make utility.
Solution
Reverting back to OS 10 (Catalina) and reinstalling gcc, etc, solved the issue. I'm not sure if OS 11 works as well. OS 12 was just released in Oct. 2021, so I'm suspecting there may be some kinks to iron out, but anyone else running into a similar problem is encouraged to add their comment/solution!
I have checked that EGSnrc installs on macOS 11 (Big Sur), and I have tweaked the macOS installation instructions accordingly. The more recent version of Homebrew faciliates installation on macOS significantly, including compiling the GUIs.
I used macOS version 11.6 and brew install
which provides:
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
gcc-11 (Homebrew GCC 11.2.0_3) 11.2.0
g++-11 (Homebrew GCC 11.2.0_3) 11.2.0
However I had previously previously xcode-select --install
, so in fact the gcc
and g++
in /usr/bin
take precedence. There are both linked to Apple clang version 13.0.0 (clang-1300.0.29.3)
, but everything compiled as expected. Let me know if you can't get it working at your end, we will figure it out!
Here is the full rundown:
$ make --version; gfortran --version; gcc --version; g++ --version
---
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
---
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
---
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
---
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
@ftessier, have you tried compiling a shared library on Mac? I'm using gfortran-8 and I'm running into an issue with the flags "-Wl,-Bsymbolic." I get the error: "ld: unknown option: -Bsymbolic." This error goes away if I eliminate the "-Wl" flag and the "-Bsymbolic" flag, although I can also leave the latter flag in place, and the shared library compiles successfully. What do these flags do? "-W" defines a warning level, but what about "-Bsymbolic," or is this also related to the warning level (perhaps intended to generate warnings about symbolic links)?