# Getting a floating point error when running the example

**URL:** <https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640>\
**Category:** Installation\
**Created:** [31 October 2024 11:00 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640 "2024-10-31T11:00:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [31 October 2024 11:00 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/1 "2024-10-31T11:00:58Z")

</div>

Hello,

First time using FLUKA, the installation went fine and everything seems ok (no errors when installing and everything went according to the installation manual).

I then tried to run the example simulation

```auto
rfluka -N0 -M5 example.inp

```

and I get this error:

```auto
9539 Floating point exception: 8 "${EXE}" "${INPF}" > "${LOGF}" 2>&1
Error: "path_to_fluka/fluka4-4.1/bin/fluka" executable returned RC=136

```

Does anyone know what is the problem here. I didn’t find anything useful on any of the manuals/website.

Thanks for your help and here’s the example.inp just in case.  
[example.inp](https://fluka-forum.web.cern.ch/uploads/short-url/1jxTluGCRUiLR1U89E6mwuLwEet.inp) (3.2 KB)

Info:

- I used gcc-13 from MacPorts to make.

---

<div class="post-metadata">

**Author:** ![luillo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@luillo](https://fluka-forum.web.cern.ch/u/luillo)\
**Post date:** [1 November 2024 09:54 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/2 "2024-11-01T09:54:58Z")

</div>

Hello @khalil.alkhour ,

It seems it is an installation issue.

What is the output of these commands?

- `echo $PATH`
- `which rfluka`
- `ls path_to_fluka/fluka4-4.1/`

Kind regards, Luigi

---

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [4 November 2024 07:51 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/3 "2024-11-04T07:51:25Z")

</div>

Thanks for your response.

The PATH that appeared contains /path-to-fluka/fluka4-4.1/bin, the which rfluka command returns /path-to-fluka/fluka4-4.1/bin/rfluka and the ls command returns the following:

AUTHORS LICENSE REFERENCES Version.tag data examples lib  
INSTALL README.md RELEASE-NOTES bin doc include src

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![luillo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@luillo](https://fluka-forum.web.cern.ch/u/luillo)\
**Post date:** [4 November 2024 09:34 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/4 "2024-11-04T09:34:13Z")

</div>

Dear @khalil.alkhour ,

From the output you provided, your FLUKA installation is directly in the root directory `/`, which is typically a read-only file system. I suggest you to install fluka in a more standard directory, such as your home (`/Users/<your_username>`).

For the sake of precision, the PATH environment variable should include also other directories, and not only `/path-to-fluka/fluka4-4.1/bin`. Do you confirm this is the case?

Moreover, your error message reports the full path of the FLUKA executable as `path_to_fluka/fluka4-4.1/bin/fluka`, while it should start with a `/` (according to your info), pointing to some error in the installation.

Cheers, Luigi

P.S. Maybe it was clear but `path_to_fluka` in the installation instructions does not indicate a specific directory name, rather it is the path where you have installed FLUKA.

---

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [4 November 2024 11:53 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/5 "2024-11-04T11:53:03Z")

</div>

Thanks for your response.

But I did install fluka in home, the path is /Users/user/fluka4-4.1. Yes the path that appeared after the echo $PATH command was huge but the last entity was the /path-to-fluka/fluka4-4.1/bin. And finally the path that I sent you and that I got for which fluka does contain a / at the very start.

I don’t know if I’m messing something but the fluka software does run showing the directory, the data, exec and input. When it starts with the first cycle, it shows a floating point exception and that the error is that the excutable returned RC=136.

---

<div class="post-metadata">

**Author:** ![luillo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@luillo](https://fluka-forum.web.cern.ch/u/luillo)\
**Post date:** [7 November 2024 10:46 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/6 "2024-11-07T10:46:31Z")

</div>

Hello @khalil.alkhour ,

can you check if there is any message in the \*.err , \*.log or \*.out files?

And the output of these commands?

`which gfortran`  
`gfortran -v`

---

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [12 November 2024 11:13 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/8 "2024-11-12T11:13:59Z")

</div>

Thanks for your response and sorry for the delayed one from my part.

There’s no .err file and the .out one is empty but the .log displays the following message:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:  
#0 0x10c670b22  
#1 0x10c670155  
#2 0x7ff806e9de9c  
#3 0x100d43891  
#4 0x100efa6e2  
#5 0x100ece62f  
#6 0x101207ac0  
#7 0x7ff806adb2cc

The gfortran version is the GNU Fortran (Homebrew GCC 14.2.0\_1) 14.2.0

Hope this helps.

---

<div class="post-metadata">

**Author:** ![luillo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@luillo](https://fluka-forum.web.cern.ch/u/luillo)\
**Post date:** [13 November 2024 07:56 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/9 "2024-11-13T07:56:53Z")

</div>

Hello @khalil.alkhour

You are using an environment based on HomeBrew, or even a mixed with MacPorts.  
We recommend to use MacPorts for FLUKA/Flair installation.

Please refer to this thread for more details to fix the issue:

> [@SIGBUS error on first run](https://fluka-forum.web.cern.ch/t/sigbus-error-on-first-run/6601/7):
>
> Hello @mrivers , I see that you have a mixed environment HomeBrew/MacPorts: this is not a good approach as libraries can be mixed and generate conflicts. For the installation of FLUKA/Flair, it is recommended to use MacPorts (at the moment we have no working solution with HomeBrew). Therefore, my recommendation is to use reinstall FLUKA in a Terminal where only MacPorts environments is defined. To do this, follow these steps: Define environment switching functions in your shell startup fil…

I hope this helps or if you have any further questions.

Cheers, Luigi

---

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [22 November 2024 10:45 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/10 "2024-11-22T10:45:45Z")

</div>

Dear Luigi,

I didn’t work, I removed everything related to Homebrew from my computer and tried with another Mac with the same setup and the problem is always is the same.

When I run the `rfluka -M1 example.inp`, I get the following error:

```auto
======================== Running FLUKA for cycle # 1 ========================
line 376: 7731 Illegal instruction: 4 "${EXE}" "${INPF}" > "${LOGF}" 2>&1
Error: "/pathtofluka/bin/fluka" executable returned RC=132

```

The gcc is the gcc14 from MacPorts:

```auto
gcc (MacPorts gcc14 14.2.0_3+stdlib_flag) 14.2.0
Copyright (C) 2024 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 idea where this error might be getting from ?

Best

---

<div class="post-metadata">

**Author:** ![luillo](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@luillo](https://fluka-forum.web.cern.ch/u/luillo)\
**Post date:** [24 November 2024 18:44 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/11 "2024-11-24T18:44:15Z")

</div>

Hello @khalil.alkhour,

Could you confirm your Xcode or CLT version using these commands?

`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`

`xcodebuild -version`

From version 16 onwards, there is a known issue in the linker. If this is the case, you can refer to this solution:

> [@Illegal instruction Error on macOS Sequoia](https://fluka-forum.web.cern.ch/t/illegal-instruction-error-on-macos-sequoia/6697/4):
>
> Dear @Obada , We’ve identified that this issue is related to the new linker introduced in the latest CLT. To get FLUKA running again, please try the following temporary fix: Open the FLUKA makefile, which you can find in the src directory of your FLUKA installation (\<path to FLUKA\>/src/makefile) Add -ld\_classic option to the linker rules for the FLUKA executables. You’ll need to add it in two places: At line 43: ${FC} -ld\_classic -o $@ ${LFLAGS} -L${LIBPATH} ${LIB} and similarly at…

Please let us know if this helps.

Best, Luigi

---

<div class="post-metadata">

**Author:** ![khalil.alkhour](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@khalil.alkhour](https://fluka-forum.web.cern.ch/u/khalil.alkhour)\
**Post date:** [25 November 2024 09:21 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/12 "2024-11-25T09:21:48Z")

</div>

This was it.

Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![rversaci](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/r/cc9497/32.png) [@rversaci](https://fluka-forum.web.cern.ch/u/rversaci)\
**Post date:** [5 December 2024 07:36 UTC](https://fluka-forum.web.cern.ch/t/getting-a-floating-point-error-when-running-the-example/6640/13 "2024-12-05T07:36:34Z")

</div>

Closed on 5 December 2024 07:36 UTC


