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

From: Francesc Salvat-Pujol <francesc.salvat.pujol_at_cern.ch>
Date: Fri, 8 Feb 2019 09:26:03 +0100

Dear Enrico,

It seems like

  root-config --glibs

returns (at least in my system)

  -L/usr/lib64/root -lGui -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTDataFrame -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic

If you run

  $FLUPRO/flutil/lfluka -h

you'll see the -L option to pass library paths, and the -l option to
pass further libraries. This will hopefully accept all -L and -l options
above, and the additional -lstdc++.

I am not sure there's a precooked way to accept the remaining "-pthread"
and "-rdynamic", so more experienced/savvy users may want to comment on
that...

With kind regards,

Cesc

PS: you may have to pass an extra -L$FLUPRO

On Thu, Feb 07 2019, at 18:50 +0100, 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
>

--
Francesc Salvat Pujol
CERN-EN/STI
CH-1211 Geneva 23
Switzerland
Tel: +41 22 76 64011
Fax: +41 22 76 69474
__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Fri Feb 08 2019 - 10:50:04 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 08 2019 - 10:50:06 CET