Illegal instruction Error on macOS Sequoia

Dear FLUKA experts,

I have been using FLUKA 4-4.x on macOS Sonoma for a while and it worked as expected. Recently, after updating to macOS Sequoia 15.1 and doing a MacPorts migration, FLUKA stopped working.

The program runs normally if I use any executable that I previously complied before the update. However, if I compile any user routine now, the executable is built successfully, but using it results in an error. I get the same error if I use the built-in fluka and flukadpm executables (probably because I reinstalled FLUKA after the update in an attempt to fix the issue).

Here is the error I get after running the example.inp file included in the FLUKA directory with any newly built executable:

/Users/nairat/FLUKA/fluka4-4.1/bin/rfluka: line 376: 12015 Illegal instruction: 4  "${EXE}" "${INPF}" > "${LOGF}" 2>&1
Error: "/Users/nairat/FLUKA/fluka4-4.1/bin/flukadpm" executable returned RC=132

The log file gives this error:

Program received signal SIGILL: Illegal instruction.

Running the program with a debugger gives this error:

stop reason = EXC_BAD_INSTRUCTION (code=1, subcode=0x1e6a19e1)
    frame #0: 0x0000000100388920 Test`ampart_ at ampart.f:278:132

I am using gcc 13.3.0 from MacPorts. Both MacPorts and FLUKA directories are added to $PATH. The commands which rfluka, which gfortran, and gfortran -v return:

/Users/nairat/FLUKA/fluka4-4.1/bin/rfluka
/opt/local/bin/gfortran
gcc version 13.3.0 (MacPorts gcc13 13.3.0_2+stdlib_flag) 

I tried reinstalling FLUKA, wiping all the installed ports and reinstalling them, and installing gcc14 instead of gcc13. But none of that resolved the issue.

I would greatly appreciate any advice you may have.

Best,
Obada

Dear @Obada,

I believe the issue is related to Command Line Tools 16 or Xcode 16. We’ve encountered a similar problem before, which was resolved by downgrading to CLT 15.3. Not ideal, but this was a workaround.

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

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
xcodebuild -version

Now, the challenge is that MacPorts requires CLT 16 on macOS Sequoia 15.1, and we haven’t found a permanent solution yet. I unsuccessfully tried to install MacPort with CLT15.

We’ll keep you updated as soon as we have more information. Please let us know if you can share any additional observations.

I’m sorry for this inconvenience.

Best, Luigi

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 line 49:
    ${FC} -ld_classic -o $@ ${LFLAGS} ${INTOBJS} -L${LIBPATH} ${LIBRQMD} ${LIB} ${LIBDPM}
    
  • In the directory src, issue the commands make clean and make.

This workaround should allow you to run FLUKA in the meantime.

Please note that this is not a permanent solution, as -ld_classic is deprecated. We are working on a proper fix to ensure long-term compatibility with the CLT linker.

Please let us know if this works for you or if you have any further questions.

Best, Luigi

1 Like

Dear Luigi,

My current CLT version is 16.1. Adding -ld_classic option indeed solved the problem, so I can confirm that the issue is related to the new linker.

Thanks for your help, this will solve my issue for now.

Best,
Obada

Dear Luigi,

In case this helps, I was trying to figure out the issue with the new linker, so I tried comparing the output of nm /pathtofluka/bin/fluka after building it with and without -ld_classic.

I noticed that for some reason there were missing symbols from the executable built with the new linker compared to the classic one. I tried to force loading them by adding this option:

-Wl,-u,_bdandi_,-u,_bdcdwr_,-u,_bdesje_,-u,_bdevap_,-u,_bdgnsc_,-u,_bdhdr1_,-u,_bdhdr2_,-u,_bdhdr3_,-u,_bdinpt_,-u,_bdmuls_,-u,_bdnopt_,-u,_bdpart_,-u,_bdphfl_,-u,_bdprdc_,-u,_bdpree_,-u,_bdpwxs_,-u,_bdrndm_,-u,_bdspdc_,-u,_bdsqzi_,-u,_bdstnh_,-u,_bdtbme_,-u,_bdtrns_,-u,_countr_,-u,_hadini_,-u,_rqprcm_

For flukadpm executable the missing symbols are:

-Wl,-u,_bdandi_,-u,_bdcdwr_,-u,_bdesje_,-u,_bdevap_,-u,_bdgnsc_,-u,_bdhdr1_,-u,_bdhdr2_,-u,_bdhdr3_,-u,_bdinpt_,-u,_bdmuls_,-u,_bdnopt_,-u,_bdpart_,-u,_bdphfl_,-u,_bdprdc_,-u,_bdpree_,-u,_bdpwxs_,-u,_bdrndm_,-u,_bdspdc_,-u,_bdsqzi_,-u,_bdstnh_,-u,_bdtbme_,-u,_bdtrns_,-u,_countr_,-u,_dt_blkd43_,-u,_dt_blkd46_,-u,_dt_blkd47_,-u,_dt_defset_,-u,_dt_hadprp_,-u,_dt_noname_,-u,_dt_runtt_,-u,_dt_zk_,-u,_hadini_,-u,_hnaddn_,-u,_ludata_,-u,_pybins_,-u,_pydata_,-u,_pylh3c_,-u,_pylh3p_,-u,_resdat_,-u,_rqmdat_,-u,_tubdat_

Everything worked as expected after that, without the need for the deprecated -ld_classic option.

Thanks again for your help.

Best,
Obada

1 Like