Problems building executable

Greetings Experts,

I am having trouble building an executable file (being done because I have large energies in my simulation). When I click “build” for my file named “practice_4_exec” using ldpmqmd I receive the following error,

Started 2020.01.02 17:50:05
- Linking: /usr/local/fluka/bin/ldpmqmd -o practice_4_execgfortran -o practice_4_exec -L/usr/local/fluka/lib /usr/local/fluka/lib/interface/asciir.o /usr/local/fluka/lib/interface/dpmjex.o /usr/local/fluka/lib/interface/evdini.o /usr/local/fluka/lib/interface/eventd.o /usr/local/fluka/lib/interface/eveout.o /usr/local/fluka/lib/interface/eveqmd.o /usr/local/fluka/lib/interface/evqmdi.o /usr/local/fluka/lib/interface/glaubr.o /usr/local/fluka/lib/interface/idd2f.o /usr/local/fluka/lib/interface/idf2d.o /usr/local/fluka/lib/interface/rqmdex.o /usr/local/fluka/lib/interface/zrdpcm.o /usr/local/fluka/lib/interface/zrrqcm.o -ldpmjet -lphojet -ldpmjet -lpythia -lrqmd -lfluka
/usr/bin/ld: /usr/local/fluka/lib/libfluka.a(fpe.o): relocation R_X86_64_32 against `.rodata.str1.1’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Ended: 2020.01.02 17:50:06

Error linking
Error: executable is not generated

Any tips would be greatly appreciated. Thank you and happy new year!


From your description I take that you are not using any user routines, correct? If yes, please post them.

I think that normally a standard executable that is prebuilt with ldpmqmd should already be available in the bin directory.

Nevertheless, building your executable should work. Your error message could originate from a mismatch of the compiler version that you are using and the prebuilt library which was built with a specific version. If you are not building an executable completely from the source code, then the compiler versions need to match.
I’d suggest to verify your compiler version with “gfortran -v” and check if you downloaded the corresponding package.


Dear @rick and @ctheis,

I was able to reproduce the error on a clean Ubuntu 18.04 using gfortran 7. I wasn’t able to compile the executables from the tar file. I got the same error messages. I think there is an incompatibility with Ubuntu 18.04 and the recompiled libraries.

Strangely, after installing gfortran 8, and configuring it as the main gfortran compiler with update-alternatives, I was able to compile the gfortran 9 version of the tar file.


Greetings @ctheis and @horvathd,

Thank you both kindly for looking into my question! I am using gfortran 7.4.0. I am a novice when it comes to linux systems, so I do not know how to implement David’s solution (if I understand you correctly that this should work). How do I download gfortran 8 and reset it to be the default compiler? Also, can I use the sudo apt install command to download and install the gfortran 9 version of FLUKA for Ubuntu 18.04? Thanks!


Dear @rick,

first of all, if you are only using linux for FLUKA, and use Windows 10 for otherwise, please take a look how to run, FLUKA with WSL on Windows 10 on
The included script automatically configures your system, and you need to install FLUKA only.

But if you still plan to use Ubuntu 18.04, you can follow these steps:

  1. To install gfortran 8 use the following command:

sudo apt install gfortran-8

  1. To configure gfortran 8 as the main fortran compiler run the two command below:

update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 10
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 20

  1. Install the gfortran 9 (.tgz) version of FLUKA, following the guide from here.

Unfortunately, the gfortran 9 (.deb) version is not compatible with Ubuntu 18.04.

I hope this helps getting FLUKA set up.


Dear @rick,

Please follow @horvathd ‘s instructions to set up your installation. For reasons of debugging could you let us know which package you have downloaded exactly when encountering this problem?

I’ve built fluka from the sources with gfortran 7 under Ubuntu 18.04 without a problem. Thus, your problems might be related to a specific version of a runtime lib that was installed on the building machine where the packages have been prepared which is in conflict with a standard Ubuntu 18.04 installation.


Dear @ctheis,

did you compile successfully from the actual source?

I think the problem is with the precompiled library (libfluka.a) included in the gfortran 7 .deb and .tgz pacakges. My guess is, for some reason, the compiler configuration on Ubuntu 18.04 doesn’t match the one used building the library. And this creates the problem during linking.


Yes, I compiled from the sources. Thus, I agree it’s most probably an issue of the configuration of the build machine.


@ctheis I am running Ubuntu 18.04.3 LTS, 64-bit, with FLAIR 3.0-2, and my fluka.spec file lists version 2011, release 3.0

Hello @horvathd, I have followed your instructions for both the gfortran and fluka installations, but now am unable to run the tutorial problem from the FLAIR site (it ran previously). I changed my FLAIR preferences to use the new fluka installation executable. I receive the following error message:

Started 2020.01.06 16:25:11
Dir: /home/rick/save_FLAIR
Cmd: /usr/bin/nohup /home/fluka2011-3.0/bin/rfluka -M 5 tutorial
Error on submission: 7

@horvathd I discovered the issue: the new fluka folder was limited access, so I used chmod to change permissions and am now running the tutorial file without issue.