Error linking when compiling (after update)

Hi all, I get an “Error linking” message (see the screenshot) when compiling with source_newgen.f. Apparently, this has started happening after the recent FLUKA+Flair updates. Before the updates, the same project compiled and linked with no errors and I am quite confident I have changed nothing since then. Can you please help and check if it is an actual bug or if I am overlooking something? Thank you in advance.

prot spettro steelwedge LiF.flair (4.9 KB)
prot spettro steelwedge LiF.inp (3.1 KB)
source_newgen.f (18.7 KB)
spettro.dat (25.7 KB)


Dear Enrico,

for me your source routine compiles without an error. Could you let us know, what is the output of the compilation, with pressing the output button in the error pop-up?


Dear David, thank you for checking it. Here is my output.

Started 2022.10.03 16:15:07

- Compiling: /usr/local/fluka/bin/fff source_newgen.f
gfortran -c -I/usr/local/fluka/include -g -cpp -O3 -fd-lines-as-comments -Wall -Waggregate-return -Wcast-align -Wline-truncation -Wno-conversion -Wno-integer-division -Wno-tabs -Wno-unused-dummy-argument -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wsystem-headers -Wuninitialized -Wunused-label -mtune=generic -msse2 -mfpmath=sse -fPIC -fexpensive-optimizations -funroll-loops -fstrength-reduce -fno-automatic -finit-local-zero -ffixed-line-length-132 -fbackslash -funderscoring -frecord-marker=4 -falign-commons -fbacktrace -frange-check -fbounds-check -fdump-core -ftrapping-math -ffpe-trap=invalid,zero,overflow -o source_newgen.o source_newgen.f

- Linking: /usr/local/fluka/bin/lfluka -o my_fluka.exe source_newgen.o
gfortran -o my_fluka.exe -fuse-ld=bfd source_newgen.o -L/usr/local/fluka/lib -lfluka -lstdc++ -lz
/usr/bin/ld.bfd: cannot find -lz
collect2: error: ld returned 1 exit status
Ended: 2022.10.03 16:15:09

Error linking
Error: executable is not generated

Dear Enrico,

could you check if you have the package libz-dev (on Ubuntu) installed on your system?
If not, please install it and try the compilation again.


1 Like

Dear David,
(I report the steps I took just in case I have to repeat them in my other PC)

  • I checked presence of libz-dev with the command $ apt list --installed
    I saw no libz-dev in the list
  • I requested to install it with the command $ sudo apt install libz-dev
    something happened and I got no error messages in the terminal
  • I restarted Ubuntu to be safe
  • I started Flair and loaded the project
  • It compiled fine!

Strange thing: repeating $ apt list --installed, I still see no libz-dev file, just a libzstd1 one. However, now compilation works fine. THANK YOU!