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

From: Mikhail Polkovnikov <pmk_at_ihep.ru>
Date: Fri, 8 Feb 2019 15:43:37 +0300

Dear Enrico,

I can send you a small working example, based on the example from FLUKA
site, with Makefile how to compile and link FLUKA object files and
ROOT/С++ object files. I don't use classes derived from TObject, so if
you are going to use standard ROOT classes and objects, it might be helpful.

I'm using ROOT-6.08.06 and GCC 8.2.0 multilib.


Best regards,
Mikhail


On 07.02.2019 20:50, Enrico Scomparin wrote:
> Dear experts,
>
> I am relatively new to Fluka and I am trying to follow the guidelines
> given in
>
> http://www.fluka.org/fluka.php?id=examples&sub=example3&node=4
>
> 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'
> /home/scompar/alice/sw/ubuntu1604_x86-64/ROOT/v5-34-30-alice9-1/lib/libCore.so.5:
> 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
> -shared-libgcc
>
> 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
>
> Enrico
>
> [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 fluka.o
>
> __________________________________________________________________________
>
> You can manage unsubscription from this mailing list at
> https://www.fluka.org/fluka.php?id=acc_info


__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Fri Feb 08 2019 - 15:13:57 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 08 2019 - 15:14:01 CET