Install FLUKA4-1.0 on Mac OS Catalina with gfortran-10 from homebrew

Dear developers,

I am new to FLUKA and am trying to install the latest release on my personal Macbook (Catalina) using gfortran-10 (from homebrew).

❯ which gfortran
/usr/local/bin/gfortran
❯ /usr/local/bin/gfortran --version
GNU Fortran (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 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.

As instructed in https://fluka.cern/documentation/installation/fluka-linux-macos
I am in the directory of

❯ pwd
/Users/yz/Documents/fluka4-1.0/src

and use the command make -j 4.
But I got this error message:

...
gfortran -c -o usrsuwev.o -I/Users/yz/Documents/fluka4-1.0//include -J/Users/yz/Documents/fluka4-1.0//include -g -O3 -fd-lines-as-comments -Wall -Waggregate-return -Wcast-align -Wline-truncation -Wno-conversion -Wno-integer-division -Wno-tabs -Wno-unused-dummy-argument -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wsystem-headers -Wuninitialized -Wunused-label -mtune=generic -msse2 -mfpmath=sse -fPIC -fexpensive-optimizations -funroll-loops -fstrength-reduce -fno-automatic -finit-local-zero -ffixed-line-length-132 -fbackslash -funderscoring -frecord-marker=4 -falign-commons -fbacktrace -frange-check -fbounds-check -fdump-core -ftrapping-math -ffpe-trap=invalid,zero,overflow  usrsuwev.f
gcc -c -o usbmax.o -I/Users/yz/Documents/fluka4-1.0//include -g -O3 -Wpadded -Wpacked -malign-double -mpreferred-stack-boundary=8 usbmax.c
clang: error: unknown argument: '-mpreferred-stack-boundary=8'
make[1]: *** [usbmax.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [tools] Error 2

I searched it in this user forum a little bit but didn’t find a related answer, so I am posting a new one.

Thanks in advance!
Best,
Yao

Dear Yao,

it seems, that gcc command doesn’t call the gcc installed from MacPorts, but clang.

Did you run the following command during the installation?

sudo port select --set gcc mp-gcc10

Cheers,
David

P.S.: You may have to run the make clean command before you try to compile again.

Dear David,

Thanks for the timely reply.
As I mentioned, I am now using homebrew, not MacPorts.
And I also find it strange that a clang-related message appears.

❯ which gcc
gcc: aliased to gcc-10
❯ gcc --version
gcc-10 (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 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.

Do you have any ideas how I should get rid of clang besides using MacPorts?
As far as I know, I shouldn’t use MacPorts and Homebrew at the same time, no?

Best,
Yao

Dear Yao,

sorry I missed that you are using Homebrew.

The issue is the alias you set is it not used by the makefile.

You could try to create a symbolic link instead. See: https://apple.stackexchange.com/questions/245891/installed-gcc-with-homebrew-now-how-to-use-that-gcc-instead-of-clang

Cheers,
David

1 Like

Dear David,

Thanks for the information.
And the compilation now works fine!

I guess the alias I use before only works when I directly use gcc, but not for the makefile.

Thanks again and best wishes,
Yao