ROOT 5.30 does not compile with gcc 4.61?

Weekly bump :slight_smile:

Fons, in your previous post you stated you did not have the same issues for your installation with 4.6.1. As our issue persists over the weeks now, it would be helpful if you could explain the steps you undertook to install successfully.

Many thanks.

Hello All,

I too cannot compile the trunk version of root with gcc version 4.6.1.

With no parameters to ./configure and then running make I get this error:

... g++ -shared -Wl,-soname,libSrvAuth.so -m32 -O2 -Wl,--no-undefined -o lib/libSrvAuth.so net/rpdutils/src/rpdutils.o net/rpdutils/src/ssh.o net/auth/src/rsaaux.o net/auth/src/rsalib.o net/auth/src/rsafun.o -Llib -lNet net/auth/src/DaemonUtils.o core/clib/src/strlcpy.o core/clib/src/strlcat.o -lcrypt -lssl -lcrypto -Llib -lCore -lCint -ldl net/auth/src/DaemonUtils.o: In function `SrvAuthImpl(TSocket*, char const*, char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&, int&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, TSeqCollection*)': DaemonUtils.cxx:(.text+0xff9): undefined reference to `TSecContext::TSecContext(char const*, char const*, int, int, char const*, char const*, TDatime, void*)' collect2: ld returned 1 exit status make: *** [lib/libSrvAuth.so] Error 1

With ./configure linuxx8664gcc, I get this error:

Configuring for linuxx8664gcc Checking for GNU Make version >= 3.80 ... ok Checking for C compiler ... gcc Checking for C++ compiler ... g++ Checking for linker (LD) ... g++ Checking for F77 compiler ... gfortran Checking for libX11 ... no configure: libX11 MUST be installed See http://root.cern.ch/drupal/content/build-prerequisites

libX11-dev is installed on my system (Ubuntu 11.10)

Many thanks,
Victor.

Just want to confirm that I cannot compile trunk with gcc 4.61 as well.

Error:

g++ -O2 -pipe -m32 -Wall -W -Woverloaded-virtual -fPIC -Iinclude  -pthread -o net/auth/src/DaemonUtils.o -c /home/tuser/root/net/auth/src/DaemonUtils.cxx
g++ -shared -Wl,-soname,libSrvAuth.so -m32 -O2 -Wl,--no-undefined -o lib/libSrvAuth.so net/rpdutils/src/rpdutils.o net/rpdutils/src/ssh.o net/auth/src/rsaaux.o net/auth/src/rsalib.o net/auth/src/rsafun.o -Llib -lNet net/auth/src/DaemonUtils.o core/clib/src/strlcpy.o core/clib/src/strlcat.o -lcrypt -lssl -lcrypto -Llib -lCore -lCint -ldl
net/auth/src/DaemonUtils.o: In function `SrvAuthImpl(TSocket*, char const*, char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&, int&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, TSeqCollection*)':
DaemonUtils.cxx:(.text+0xff9): undefined reference to `TSecContext::TSecContext(char const*, char const*, int, int, char const*, char const*, TDatime, void*)'
collect2: ld returned 1 exit status
make: *** [lib/libSrvAuth.so] Error 1

ubuntu 11.10
Root trunk revision 41405

Thanks
Karthik.

still experiencing the same issue on ubuntu 11.10…

many libraries are linked incorrectly in root, this is now exposed by ubuntus new linker settings --no-copy-dt-needed and --as-needed

A workaround is to compile without as-needed:

third party applications compiled on ubuntu may also need that flag due to roots public libraries exposed by root-config are partly underlinked

the --no-as-needed trick works!

[quote]libX11-dev is installed on my system (Ubuntu 11.10)

Many thanks,
Victor.[/quote]

Hi, Victor, I got around this issue with a quick “locate libx11”. That will reveal you the actual location of the .so library. I had to configure root with the flag:

Compiling with the LDFLAGS posted by MadCow successfully compiled ROOT 5.30 on my 32bit installation of Ubuntu 11.10.

However, xrootd is still unable to compile. The following is output by make.

Creating executable …/…/bin/testclient
g++ -D_ALL_SOURCE -D_REENTRANT -D_GNU_SOURCE -fPIC -rdynamic -Wall -Wno-deprecated -D__linux__ -m32 -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 topthread_mutexattr_settype’
…/…/lib/libXrdSec.so: undefined reference to pthread_key_create' ../../lib/libXrdSec.so: undefined reference topthread_attr_setstacksize’
…/…/lib/libXrdSec.so: undefined reference to sem_destroy' ../../lib/libXrdSec.so: undefined reference topthread_getspecific’
…/…/lib/libXrdSec.so: undefined reference to pthread_mutexattr_destroy' ../../lib/libXrdSec.so: undefined reference topthread_create’
…/…/lib/libXrdSec.so: undefined reference to pthread_mutexattr_init' ../../lib/libXrdSec.so: undefined reference tosem_post’
…/…/lib/libXrdSec.so: undefined reference to pthread_setspecific' ../../lib/libXrdSec.so: undefined reference tosem_wait’
…/…/lib/libXrdSec.so: undefined reference to pthread_join' collect2: ld returned 1 exit status make[5]: *** [../../bin/testclient] Error 1 make[4]: *** [Linuxall] Error 2 make[3]: *** [all] Error 2 make[2]: *** [XrdSec] Error 2 make[1]: *** [all] Error 2 make[1]: Leaving directory/usr/local/root/net/xrootd/src/xrootd’
*** Error condition reported by make (rc = 2):
make: *** [net/xrootd/src/xrootd/LastBuild.d] Error 1

Any ideas?

indeed I had disabled xrootd…

Thanks. That (using “make LDFLAGS=”-Wl,–no-as-needed")allows me to compile root on my Ubuntu 32-bit system.

The new problem is that my code compiled aganist root libraries no longer work.
I tried the same LDFLAGS to my project’s make file, still no luck.

[quote=“MadCow”]many libraries are linked incorrectly in root, this is now exposed by ubuntus new linker settings --no-copy-dt-needed and --as-needed

A workaround is to compile without as-needed:

third party applications compiled on ubuntu may also need that flag due to roots public libraries exposed by root-config are partly underlinked[/quote]

[quote=“jrtomps”]Compiling with the LDFLAGS posted by MadCow successfully compiled ROOT 5.30 on my 32bit installation of Ubuntu 11.10.

However, xrootd is still unable to compile. The following is output by make.

Any ideas?[/quote]

This issue should be fixed in trunk. it is missing a link against libpthread. You can work around it by going into the right folder and copy paste the compile line with -pthread appended, then go back to the root folder and continue the build with make.

[quote]The new problem is that my code compiled aganist root libraries no longer work.
I tried the same LDFLAGS to my project’s make file, still no luck.[/quote]
does not work in what respect?
it fails at buildtime or runtime?
whats the error message?

I was able to compile/install root 5.30 (revision 41426) on Ubuntu 11.10 (64-bit, gcc 4.6.1) with MadCow’s suggestion. When trying to run root I got this error:

/usr/local//bin/root.exe: error while loading shared libraries: libCore.so.5.30: cannot open shared object file: No such file or directory

Since I configured like this:

./configure linuxx8664gcc --prefix=/usr/local/ --enable-rpath --enable-soversion --enable-builtin-ftgl --enable-builtin-freetype --enable-builtin-glew --enable-builtin-zlib --enable-exceptions --enable-fftw3 --enable-gviz --enable-gsl-shared --enable-mathmore --enable-minuit2 --enable-mysql --enable-opengl --enable-python --enable-tmva --enable-x11 --enable-xft --enable-roofit

my root libraries may be found in:

/usr/local/lib/root/

So I was able to get root running in full by adding to my ld.conf:

sudo echo /usr/local/lib/root >> /etc/ld.so.conf.d/root-system-common.conf sudo ldconfig

But now I can’t compile my own code against root libraries, for example I try to compile the attached file with this command:

g++ `root-config --cflags` `root-config --libs` -g -O2 analysis.cxx -o analysis

and I get the following error:

/tmp/ccSp2Whj.o: In function `main': /hepuser/frank/tmp/root-error/analysis.cxx:11: undefined reference to `TFile::Open(char const*, char const*, char const*, int, int)' /tmp/ccSp2Whj.o: In function `__static_initialization_and_destruction_0': /usr/local//include/root/TVersionCheck.h:34: undefined reference to `TVersionCheck::TVersionCheck(int)' collect2: ld returned 1 exit status

Any idea what’s wrong? Note the outputs of root-config are:

[code]root-config --cflags
-pthread -m64 -I/usr/local//include/root

root-config --libs
-L/usr/local//lib/root -lGpad -lHist -lGraf -lGraf3d -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lRIO -lNet -lThread -lCore -lCint -pthread -Wl,-rpath,/usr/local//lib/root -lm -ldl -rdynamic[/code]
test.root (30.3 KB)
analysis.cxx (176 Bytes)

I have downloaded the current version of ROOT in the trunk using svn and attempted to compile again. Once again, the compilation failed at the same spot in location with the same errors as before. I have located the proper folder ( /usr/local/root/net/xrootd/src/xrootd/src/XrdSec) responsible for compiling testclient and libXrdSec.so. I have added -pthread to the rule involved and get the same compilation error.

Creating executable …/…/bin/testclient
g++ -D_ALL_SOURCE -D_REENTRANT -D_GNU_SOURCE -fPIC -rdynamic -Wall -Wno-deprecated -D__linux__ -m32 -O2 …/…/obj/XrdSectestClient.o -lnsl -lrt -ldl -lc -pthread -L…/…/lib -lXrdSec -lXrdNet -lXrdOuc -lXrdNetUtil -lXrdSys -o …/…/bin/testclient
…/…/lib/libXrdSec.so: undefined reference to sem_init' ../../lib/libXrdSec.so: undefined reference topthread_mutexattr_settype’
…/…/lib/libXrdSec.so: undefined reference to pthread_key_create' ../../lib/libXrdSec.so: undefined reference topthread_attr_setstacksize’
…/…/lib/libXrdSec.so: undefined reference to sem_destroy' ../../lib/libXrdSec.so: undefined reference topthread_getspecific’
…/…/lib/libXrdSec.so: undefined reference to pthread_mutexattr_destroy' ../../lib/libXrdSec.so: undefined reference topthread_create’
…/…/lib/libXrdSec.so: undefined reference to pthread_mutexattr_init' ../../lib/libXrdSec.so: undefined reference tosem_post’
…/…/lib/libXrdSec.so: undefined reference to pthread_setspecific' ../../lib/libXrdSec.so: undefined reference tosem_wait’
…/…/lib/libXrdSec.so: undefined reference to `pthread_join’
collect2: ld returned 1 exit status
make[5]: *** […/…/bin/testclient] Error 1

I am still compiling with LDFLAGS="-Wl,–no-as-needed".

I have successfully compiled xrootd. MadCow, you were right that I was missing the linking flag to -pthread. In fact, I found that it was missing in almost every module that needed building. I don’t know if this is the correct way to fix the problem, but I eventually got rid of my compile time errors by adding -pthread to LDOP variable declared in ${ROOTSYS}/net/xrootd/src/xrootd/src/GNUmake.options.

In other words, I replaced the line 19 with
LDOP="$(TYPEOPT) -pthread"

Further, I found that I needed to add a -lz linking flag to ${ROOTSYS}/net/xrootd/src/xrootd/src/XrdApps/GNUmakefile at line 60

      $(ECHO)$(LD) $(LDOP) -lz $(XRDADLER32_OBJ) $(XRDADLERDEPS) $(XRDADLERLIBS) -o $(XRDADLER32)

I had to add the -pthread flag to a number of other GNUmakefile in folders such as XrdSec, XrdCrypto, XrdAcc, XrdSecsss, and XrdSecpwd. I think that that was all I had to do. In general, the build scheme needs fixing.

Finally, I compiled this on Ubuntu 11.10, which is running gcc 4.6.1 and linux kernel 3.0.0-12. For some reason, a bunch of the necessary libraries are located in the /usr/lib/i386-linux-gnu directory. I applied a bandaid to this change in location to fix a bunch of linking errors by making some symbolic links to the necessary directories to reside in the /usr/lib directory. I am sure there is a more elegant way of doing this and I would love to know what it is.

Thanks for the help and I hope that this helps others having the same problem I did.

Hi jrtomps,

I have similar problems and failed to compile a working version of ROOT using

  • 5.30.00
  • 5.30.02
  • trunk

System: Ubuntu 11.10, kernel 3.0.0-12

I also can’t follow your instructions as i.e. I don’t have this file:
${ROOTSYS}/net/xrootd/src/xrootd/src/GNUmake.options

Since it seems that only links against some libraries are missing, is it possible to create a patch?

Luke_K,

I am not sure that what I have done to make this compile is the “proper” way to fix it and thus it is probably not worthy of making a patch. I am hopeful that someone will fix this soon though since many people should be affected by it now.

However, are you sure that you don’t have the file referenced? It should be in the standard root package. Did you set the ROOTSYS variable (this is the folder containing root)?

Hi jrtomps,

I was looking in the fresh source code as it comes extracted from svn/tarball.
It seems that these files appear as soon as you attempt a compilation.

I will give your fix a try as I really need this working asap.

it has to be

objects needing symbols before objects providing them.

I’ve tried the trunk version today which came with some updates.

To configure I use

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

Which lead to a problem with the freetype library:

lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_done': ftgzip.c:(.text+0x15d): undefined reference to `inflateEnd' lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_fill_output': ftgzip.c:(.text+0x2a5): undefined reference to `inflate' lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_io': ftgzip.c:(.text+0x33d): undefined reference to `inflateReset' lib/libfreetype.a(ftgzip.o): In function `FT_Stream_OpenGzip': ftgzip.c:(.text+0x5be): undefined reference to `inflateInit2_' collect2: ld returned 1 exit status make: *** [lib/libGraf.so] Error 1 make: *** Waiting for unfinished jobs....

removing the freetype option finally gave me an error-free compilation!

Thanks a lot for the changes!

[quote=“MadCow”]

g++ `root-config --cflags`  -g -O2 analysis.cxx -o analysis `root-config --libs`

objects needing symbols before objects providing them.[/quote]

Vielen Dank! I feel a whee bit silly now #-o