[fluka-discuss]: problem with use of external C/C++ library

From: Enrico Scomparin <scompar_at_to.infn.it>
Date: Thu, 7 Feb 2019 18:50:06 +0100

Dear experts,

I am relatively new to Fluka and I am trying to follow the guidelines
given in


in order to use a C function, containing ROOT classes, that I then call
inside my source.f . I am working on a Linux machine (Ubuntu 16.04).

With minimal adaptations of the makefile that can be found there (
http://www.fluka.org/content/examples/Makefile ) I can compile both the
fortran routines and the C code. However when the makefile invokes
lfluka I am getting an error.

More in detail, the error message is

/usr/bin/ld: FluLib.o: undefined reference to symbol '_ZN7TObjectdlEPv'
error adding symbols: DSO missing from command line

which seems related to ROOT. Indeed if I take the link command as
created by lfluka

gfortran -msse2 -mfpmath=sse -fPIC -O3 -g -mtune=generic
-fexpensive-optimizations -funroll-loops -fstrength-reduce -Wall
-Wuninitialized -Wno-tabs -Wline-truncation -Wno-unused-function
-Wno-unused-parameter -Wno-unused-dummy-argument -Wno-unused-variable
-Wno-conversion -Wunused-label -Waggregate-return -Wcast-align
-Wsystem-headers -ftrapping-math -frange-check -fbackslash -fdump-core
-fbacktrace -ffpe-trap=invalid,zero,overflow -finit-local-zero
-ffixed-form -frecord-marker=4 -funderscoring -fno-automatic
-fd-lines-as-comments -fbounds-check
-I/home/scompar/cernbox/Documents/Fluka/flukapro -v -o rootfluka
-Xlinker -Map -Xlinker rootfluka.map fluka.o dlornbck.o
source_interface.o stuprf.o magfld.o mgdraw.o FluLib.o libResults.so
-L/home/scompar/cernbox/Documents/Fluka -lflukahp -l gfortran -l m

I append by hand at the end  `root-config --glibs` -lstdc++ , and I
execute it as such, then everything works [1]. However I find no simple
way to have these two further instructions to be "generated" by the
lfluka command.

Is there a way to add qualifiers to lfluka in such a way that the link
command contains this further information ? Of course any other
alternative solution would be also welcome!

Thanks and best regards


[1] In order for the link command to work I also have to run,
immediately before, the line 'ar x
/home/scompar/cernbox/Documents/Fluka/libflukahp.a fluka.o' , to extract

You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Thu Feb 07 2019 - 22:09:20 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 07 2019 - 22:09:21 CET