ROOT 5.30 does not compile with gcc 4.61?

Hello everybody. I would install the “triad” (Ubuntu 11.10)

root: v5-30-02
aliroot: trunk
geant3:v1-12

but I have problem compiling root.

ok, seems to work.

./configure --enable-roofit --enable-minuit2 --enable-builtin-freetype

make -j4 LDFLAGS="-Wl,–no-as-needed" (j4 refers to a quad processor)

At revision 41540. Kernel 3.0.0-12-generic.

Thank you madcow.

Hello everyone,

i also had trouble compiling root within ubuntu 11.10.
Because i am not very experienced in linux stuff and i needed root i switched to fedora, but want my ubuntu back…
So here is my question:
I’ve read your advices on installing root and it seems to work.
But before i switch back to ubuntu i want to know if its also possible to compile root with gsl support.
I need this library and normaly i can include them with a configure option.
Has anyone compiled root with gsl support yet?
Do you think it works when i will do:

Do i need:

or is this user specific stuff?
Afterwards i will do:

make -j6 LDFLAGS="-Wl,--no-as-needed" (got a 6 core)
Do you think that would work?
Have i something missed?

I would appreciate your help.
Thanks.

Jo

yes you can use ubuntu’s gsl but only the shared library, the static one is not built with PIC (at least the last time I checked which was quite a while ago)

make sure you have libgsl0-dev install and enable the use of the shared library by adding --enable-gsl-shared to configure
libdir and incdir must not be set if you are using the standard packaged installation

Hi,

thanks for the answer.
I’ve always used

to get root working with gsl.
Why it is not necessary and why i have to use it in the past?
Does

more or less the same?
And what do you mean with PIC?
Sorry for this maybe stupid questions, but i want to understand roughly what i am doing.

Thank you

Jo

[quote=“Sabaism”]Hi,

thanks for the answer.
I’ve always used

./configure --with-gsl-incdir="/usr/include/" --with-gsl-libdir="/usr/lib/

to get root working with gsl.
Why it is not necessary and why i have to use it in the past?
[/quote]
/usr/include and /usr/lib are searched by gcc for headers and libraries by default (unless you explicitly tell it not too, which root does not do).
Those flags should only be required when you want to use a different gsl version than the system one.

no it just tells root to favor the shared library over the static one.
Shared libraries are loaded at runtime and one copy in memory serves all applications using it (= dll’s in windows). Static libraries are copied into the compiled objects at compile time. This makes applications larger but they have less runtime dependencies.
To copy static libraries into shared libraries they must be compiled as position independant code (man gcc see -fPIC):
en.wikipedia.org/wiki/Position-independent_code

Hi,

thank you for the detailed answer and for the link.
I will try to install root on my ubuntu machine.

Best regards
Jo

Hi,

i’ve tried again to install root, but it failed again.
First i got the error message, that some of the librarys are not there, but i installed them right before.
at the end the configure was successful with:

./configure --enable-gsl-shared --with-x11-libdir=/usr/lib/x86_64-linux-gnu --with-xft-libdir=/usr/lib/x86_64-linux-gnu --with-xext-libdir=/usr/lib/x86_64-linux-gnu
after that i run:

an after a little time i get:

g++ -m64 -D_ALL_SOURCE -D_REENTRANT -D_GNU_SOURCE -fPIC -rdynamic -Wall -Wno-deprecated -D__linux__ -O2 ../../obj/XrdSectestClient.o -lnsl -lrt -ldl -lc -L../../lib -lXrdSec -lXrdNet -lXrdOuc -lXrdNetUtil -lXrdSys -o ../../bin/testclient ../../lib/libXrdSec.so: undefined reference to `sem_init' ../../lib/libXrdSec.so: undefined reference to `pthread_mutexattr_settype' ../../lib/libXrdSec.so: undefined reference to `pthread_key_create' ../../lib/libXrdSec.so: undefined reference to `pthread_attr_setstacksize' ../../lib/libXrdSec.so: undefined reference to `sem_destroy' ../../lib/libXrdSec.so: undefined reference to `pthread_getspecific' ../../lib/libXrdSec.so: undefined reference to `pthread_mutexattr_destroy' ../../lib/libXrdSec.so: undefined reference to `pthread_create' ../../lib/libXrdSec.so: undefined reference to `pthread_mutexattr_init' ../../lib/libXrdSec.so: undefined reference to `sem_post' ../../lib/libXrdSec.so: undefined reference to `pthread_setspecific' ../../lib/libXrdSec.so: undefined reference to `sem_wait' ../../lib/libXrdSec.so: undefined reference to `pthread_join' collect2: ld gab 1 als Ende-Status zurück make[5]: *** [../../bin/testclient] Fehler 1 make[4]: *** [Linuxall] Fehler 2 make[3]: *** [all] Fehler 2 make[2]: *** [XrdSec] Fehler 2 make[1]: *** [all] Fehler 2 make[1]: Verlasse Verzeichnis '/home/johannes/bin/root/net/xrootd/src/xrootd' *** Error condition reported by make (rc = 2): make: *** [net/xrootd/src/xrootd/LastBuild.d] Fehler 1
why does it run at your pc’s but not on mine?
what i am doing wrong?
I downloaded root 5.30.03 for that.

Thanks.
Jo

you probably once built without disabling as-needed and this is now not rebuilt.
delete ./net/xrootd/src/xrootd/lib/libXrdSec.so and try again, if that does not help do make clean and rebuilt everything without as-needed.

you may also be able to ignore that particular issue, if you don’t need the test client. use makes -k flag to get make to continue as long as possible.

Hi MadCow,

I’ve done what you said and finally with

the build process was successful.
I tested a few things and root seems to run but unfortunately my stand alone programs don’t run anymore.
If i try to compile them i get an long list with undefined references to i think all root classes and class methods.
Have you any advice here?

Thank you .
Jo

how do you compile them?
make sure to add root-config --libs to the end of the command line

I’m also having this troubles with root since I updated to Ubuntu 11.10.
I compiled root from the trunk with the options posted here but when I compile my apps I keep getting the following linking error:
…/root/lib/libNet.so: undefined reference to `gRandom’

To build root I used:
./configure --enable-roofit --enable-minuit2 --enable-builtin-freetype
and then:
make -j2 -k LDFLAGS="-Wl,–no-as-needed"

to compile my app I’m using:
make root-config --libs

I don’t know if this is related but I also noticed that the libNet.so isn’t being loaded automatically:
root [0] gSystem->ListLibraries()

Loaded shared libraries

/home/jtsabino/sw/ROOT/root/lib/libCint.so
/home/jtsabino/sw/ROOT/root/lib/libRint.so
/home/jtsabino/sw/ROOT/root/lib/libMathCore.so
/home/jtsabino/sw/ROOT/root/lib/libCore.so

4 libraries loaded

root [1]

What am I doing wrong?

Hi MadCow,

your advice was perfect root seems to work now.
But i am still a little bit curious why i need to change things in compiling root itself and my apps which i programmed used the root librarys.
Anyway, my program successfully compiles and runs after i done:

(i call my app photon count.)
Could it be that in might one of the next root versions the build process will be run without this workarounds or do we have to live with them (i ask only out of curiosity)?

Anyway thanks for the great support and patience with my questions.

Jo

[quote=“jtsabino”]I’m also having this troubles with root since I updated to Ubuntu 11.10.
I compiled root from the trunk with the options posted here but when I compile my apps I keep getting the following linking error:
…/root/lib/libNet.so: undefined reference to `gRandom’

To build root I used:
./configure --enable-roofit --enable-minuit2 --enable-builtin-freetype
and then:
make -j2 -k LDFLAGS="-Wl,–no-as-needed"
[/quote]

try rebuild everything from scratch, you probably have some remains from an old build.
make clean; make distclean should do it, make sure libNet.so is relinked by deleting it.
you might encounter this bug: savannah.cern.ch/bugs/index.php?88347 but you can work around it by reexecuting the failing command with an -lz at the end and continuing make.

After following the steps in this thread I finally have gotten ROOT to compile, but now when I try to compile my personal code I get the following error :

gcc -O2 -Wall -fPIC -Wl,–no-as-needed -pthread -m32 -I/usr/local/root/include -o graphics_functions.o graphics_functions.c -L/usr/local/root/lib -lGpad -lHist -lGraf -lGraf3d -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lRIO -lNet -lThread -lCore -lCint -pthread -lm -ldl -rdynamic -lNew -lMinuit -lSpectrum -lstdc++ -lz -lRMySQL -L/usr/local/root/lib -lGui -lGpad -lHist -lGraf -lGraf3d -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lRIO -lNet -lThread -lCore -lCint -pthread -lm -ldl -rdynamic
In file included from /usr/local/root/include/Rtypes.h:30:0,
from /usr/local/root/include/TObject.h:31,
from /usr/local/root/include/TNamed.h:26,
from /usr/local/root/include/TAxis.h:25,
from graphics_functions.h:4,
from graphics_functions.c:4:
/usr/local/root/include/Rtypeinfo.h:32:20: fatal error: typeinfo: No such file or directory
compilation terminated.
make: *** [graphics_functions.o] Error 1

Hi rpattie11,

can you please write down how you compile your code?
I got the same problem afterwards building root but with a few modification i am able to compile it.

Best regards
Jo

[quote=“MadCow”][quote=“jtsabino”]I’m also having this troubles with root since I updated to Ubuntu 11.10.
I compiled root from the trunk with the options posted here but when I compile my apps I keep getting the following linking error:
…/root/lib/libNet.so: undefined reference to `gRandom’

To build root I used:
./configure --enable-roofit --enable-minuit2 --enable-builtin-freetype
and then:
make -j2 -k LDFLAGS="-Wl,–no-as-needed"
[/quote]

try rebuild everything from scratch, you probably have some remains from an old build.
make clean; make distclean should do it, make sure libNet.so is relinked by deleting it.
you might encounter this bug: savannah.cern.ch/bugs/index.php?88347 but you can work around it by reexecuting the failing command with an -lz at the end and continuing make.[/quote]
Yes, there were some old files left. I made “make clean” and “make distclean” then installed from scratch with the same commands I used before and everything is working now.
Thank you madcow!

My root (trunk) compiles fine on my ubuntu 11.10. All I am using is

./configure
make
make install

It works fine.

However my other code (GEANT4) is trying to use the root libraries, and its compilation gives undefined references errors:

Using granular libraries …
Linking Thorium_innerRod
/home/cristian/geant4/geant4.9.5.b01/tmp/Linux-g++/Thorium_innerRod/libThorium_innerRod.so: undefined reference to TPaveText::TPaveText(double, double, double, double, char const*)' /home/cristian/geant4/geant4.9.5.b01/tmp/Linux-g++/Thorium_innerRod/libThorium_innerRod.so: undefined reference toTFile::TFile(char const*, char const*, char const*, int)’
/home/cristian/geant4/geant4.9.5.b01/tmp/Linux-g++/Thorium_innerRod/libThorium_innerRod.so: undefined reference to TCanvas::TCanvas(char const*, char const*, int, int, int, int)' /home/cristian/geant4/geant4.9.5.b01/tmp/Linux-g++/Thorium_innerRod/libThorium_innerRod.so: undefined reference toTCanvas::TCanvas(bool)'
collect2: ld returned 1 exit status
make: *** [/home/cristian/geant4/geant4.9.5.b01/bin/Linux-g++/Thorium_innerRod] Error 1

In my Geant4 GNUMakefile I am using (and it used to work fine):

CPPFLAGS += -DG4ANALYSIS_USE_ROOT $(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs) -lMinuit -lHtml
ROOTLIBS := $(filter-out -lNew,$(ROOTLIBS))
#ROOTLIBS := $(filter-out -lThread,$(ROOTLIBS))
ROOTLIBS := $(filter-out -lpthread,$(ROOTLIBS))
LDLIBS += $(ROOTLIBS)

I would be very grateful for any suggestion on how to fix the undefined references.

Thank you very much,

Best regards,

Cristian

Hi,

Could you double check that the 5.32 release candidate is working properly in your environment?

Cheers,
Philippe.

Hi,

I tried compiling ROOT 5.30 on Fedora 16 which uses gcc 4.62 and I could not successfully compile it either, though my errors were completely different from what others here are reporting. This is the error I received:

g++ -O2 -pipe -m32 -Wall -W -Woverloaded-virtual -fPIC -Iinclude -DR__HAVE_CONFIG -pthread -DUSE_ROOT_ERROR   -I. -I/home/whanlon/src/root/cint/cint/inc  -o math/mathcore/src/G__MathCore.o -c math/mathcore/src/G__MathCore.cxx
Generating dictionary math/mathcore/src/G__MathFit.cxx...
core/utils/src/rootcint_tmp -cint -f math/mathcore/src/G__MathFit.cxx -c /home/whanlon/src/root/math/mathcore/inc/Fit/DataVector.h /home/whanlon/src/root/math/mathcore/inc/Fit/DataRange.h /home/whanlon/src/root/math/mathcore/inc/Fit/PoissonLikelihoodFCN.h /home/whanlon/src/root/math/mathcore/inc/Fit/DataVectorfwd.h /home/whanlon/src/root/math/mathcore/inc/Fit/LogLikelihoodFCN.h /home/whanlon/src/root/math/mathcore/inc/Fit/SparseData.h /home/whanlon/src/root/math/mathcore/inc/Fit/FitResult.h /home/whanlon/src/root/math/mathcore/inc/Fit/Fitter.h /home/whanlon/src/root/math/mathcore/inc/Fit/FitUtilParallel.h /home/whanlon/src/root/math/mathcore/inc/Fit/BinData.h /home/whanlon/src/root/math/mathcore/inc/Fit/FitUtil.h /home/whanlon/src/root/math/mathcore/inc/Fit/FcnAdapter.h /home/whanlon/src/root/math/mathcore/inc/Fit/Chi2FCN.h /home/whanlon/src/root/math/mathcore/inc/Fit/BinPoint.h /home/whanlon/src/root/math/mathcore/inc/Fit/ParameterSettings.h /home/whanlon/src/root/math/mathcore/inc/Fit/DataOptions.h /home/whanlon/src/root/math/mathcore/inc/Fit/FitConfig.h /home/whanlon/src/root/math/mathcore/inc/Fit/UnBinData.h /home/whanlon/src/root/math/mathcore/inc/LinkDef3.h
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:61:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:61:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:61:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/PoissonLikelihoodFCN.h:61:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:59:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:59:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:62:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:62:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:59:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:59:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:62:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/LogLikelihoodFCN.h:62:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:80:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:80:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:58:
Error: class,struct,union or type BaseObjFunction::Type_t not defined  include/Fit/Chi2FCN.h:84:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:80:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:80:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:58:
Error: class,struct,union or type ROOT::Ma not defined  include/Fit/Chi2FCN.h:58:
Error: class,struct,union or type BaseObjFunction::Type_t not defined  include/Fit/Chi2FCN.h:84:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing math/mathcore/src/G__MathFit.cxx math/mathcore/src/G__MathFit.h !!!
Error: core/utils/src/rootcint_tmp: error loading headers...
make: *** [math/mathcore/src/G__MathFit.cxx] Error 1

The lines in question referened ROOT::Math. I do not understand why they were being interpreted as ROOT::Ma by rootcint_tmp.

Anyway, I’m reporting that ROOT 5.32/00-rc2 compiles without error using gcc 4.62.