# Cannot compile FLUKA on Mac (ld: library not found for -lSystem)

**URL:** <https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925>\
**Category:** O²\
**Created:** [May 3, 2021, 4:28pm UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925 "2021-05-03T16:28:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![laphecet](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/laphecet/32/12_2.png) [@laphecet](https://alice-talk.web.cern.ch/u/laphecet)\
**Post date:** [May 3, 2021, 4:28pm UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925/1 "2021-05-03T16:28:32Z")

</div>

On my 11.2.3 Mac I fail to compile FLUKA

```auto
aliBuild --defaults o2 build FLUKA

```

fails with :

```auto
[(python) brew]~/alice/brew/sw/BUILD/FLUKA-latest/FLUKA$ make
gfortran -o /Users/laurent/alice/brew/sw/BUILD/15cec4a6a6483074c90972e4e84d114af4374768/FLUKA//bin/fluka -L/Users/laurent/alice/brew/sw/BUILD/15cec4a6a6483074c90972e4e84d114af4374768/FLUKA//lib -lfluka
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/laurent/alice/brew/sw/BUILD/15cec4a6a6483074c90972e4e84d114af4374768/FLUKA//bin/fluka] Error 1
make: *** [all] Error 2

```

```auto
> aliBuild version
aliBuild version: 1.7.1 (osx_x86-64)

```

---

<div class="post-metadata">

**Author:** ![eulisse](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/eulisse/32/19_2.png) [@eulisse](https://alice-talk.web.cern.ch/u/eulisse)\
**Post date:** [May 3, 2021, 5:41pm UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925/2 "2021-05-03T17:41:48Z")

</div>

Can you try updating to aliBuild 1.8.2? Also, how did you install `gfortran`?

---

<div class="post-metadata">

**Author:** ![laphecet](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/laphecet/32/12_2.png) [@laphecet](https://alice-talk.web.cern.ch/u/laphecet)\
**Post date:** [May 3, 2021, 6:52pm UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925/3 "2021-05-03T18:52:59Z")

</div>

same error with latest aliBuild :

```auto
[(python) brew]~/alice/brew/sw/BUILD/FLUKA-latest/FLUKA$ aliBuild version
aliBuild version: 1.8.2 (osx_x86-64)
[(python) brew]~/alice/brew/sw/BUILD/FLUKA-latest/FLUKA$ make
gfortran -o /Users/laurent/alice/brew/sw/BUILD/e34fc5d2a53f9af62a1dbdac32cffa55a2899a39/FLUKA//bin/fluka -L/Users/laurent/alice/brew/sw/BUILD/e34fc5d2a53f9af62a1dbdac32cffa55a2899a39/FLUKA//lib -lfluka
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/laurent/alice/brew/sw/BUILD/e34fc5d2a53f9af62a1dbdac32cffa55a2899a39/FLUKA//bin/fluka] Error 1
make: *** [all] Error 2

```

My fortran is from brew gcc :

```auto
[(python) brew]~/alice/brew/sw/BUILD/FLUKA-latest/FLUKA$ gfortran --version
GNU Fortran (Homebrew GCC 10.2.0_2) 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.

```

---

<div class="post-metadata">

**Author:** ![laphecet](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/laphecet/32/12_2.png) [@laphecet](https://alice-talk.web.cern.ch/u/laphecet)\
**Post date:** [May 4, 2021, 5:51pm UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925/4 "2021-05-04T17:51:54Z")

</div>

Some follow-up here.

Trying with a different (well, still gcc 10.2 but compiled with spack) gfortran I can compile FLUKA just fine so it seems the issue is indeed the fortran compiler.

My brew one (10.2.0\_2) is not the latest, but if I try to upgrade (to 10.2.0\_4) brew compilation fails…  
(hence the test with a spack built one)

Don’t quite understand what’s going on…

---

<div class="post-metadata">

**Author:** ![eulisse](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/eulisse/32/19_2.png) [@eulisse](https://alice-talk.web.cern.ch/u/eulisse)\
**Post date:** [May 5, 2021, 7:54am UTC](https://alice-talk.web.cern.ch/t/cannot-compile-fluka-on-mac-ld-library-not-found-for-lsystem/925/5 "2021-05-05T07:54:27Z")

</div>

For what is worth:

```auto
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.2.0_1/libexec/gcc/x86_64-apple-darwin20/10.2.0/lto-wrapper
Target: x86_64-apple-darwin20
Configured with: ../configure --build=x86_64-apple-darwin20 --prefix=/usr/local/Cellar/gcc/10.2.0_1 --libdir=/usr/local/Cellar/gcc/10.2.0_1/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0_1' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (Homebrew GCC 10.2.0_1)

```

is what works for me.
