Illegal Instruction Error with User Routines on MacOS Sequoia

Dear FLUKA experts,

After upgrading to MacOS Sequoia (with XCode and CommandLineTools 16), my FLUKA installation (v 4.4.1) stopped working with an immediate runtime error stating “illegal instruction”. Following the instructions mentioned in this post, I was able to get FLUKA running again by adding the “-ld_classic” flag.

However, when I try to use a user routine such as magfld,f or source.f, the error reappears. I tried adding the flag into the lfluka executable as well but this had no effect. The routines worked on an older MacOS version and on a Linux installation, so I think it’s related to the above issue but I’m not sure how else to fix it so any guidance would be appreciated.

If relevant, I’m using MacPorts gfortran-14 to compile.

Many thanks,
Kyle

Dear @kyle.fleck ,

Good point. Indeed, the fix mentioned works only for the default executables.

To address this, please add the -ld_classic option to the FLUKA linker script <path to FLUKA>/bin/lfluka at line 159 (last one):

${FC} -ld_classic -o ${OUTPUT} ${LFLAGS} ${OBJS} ${INTOBJS} ${LOBJS} ${USERLIBPATH} ${BEFORE} ${LIBPATH} ${LIB} ${AFTER}

and, then, recompile your FLUKA executable.

In the next release, this will be automatically implemented.

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

Best, Luigi

Dear @luillo ,

Thanks very much for your prompt reply. I’ve applied this fix and it works for a custom source_newgen.f routine. However, I can’t seem to get a simple magfld.f routine to work - FLUKA crashes immediately with the “Illegal instruction” error, and suggesting that the executable magfld returned RC=132.

I’ve attached my magfld.f file here in case there is an obvious mistake that I am overlooking.
magfld.f (2.7 KB)

Many thanks,
Kyle

Dear @kyle.fleck ,

To reproduce your error, could you please provide me with these files?

  • FLUKA input
  • user routines
  • Any data files if required.

Thanks, Luigi

P.S. Please let me know if this code worked before the upgrade to Sequoia

Dear @luillo,

I had another look at the magfld.f file and there turned out to be a fortran issue. I have fixed this and it works as expected.

In short, adding the “-ld_classic” linker flag to the lfluka executable does get fluka to run with user routines as expected.

Thanks again for your help!

Best regards,
Kyle