Cannot install ROOT 5.34.34 - "multiple definition of `stat'"

I am trying to install ROOT 5.34.34 from source. I need to install one of the 5.34.xx releases (>= 5.34.20) as a dependency of CNVnator.

This is on CentOS, and I am using gcc 5.1 installed with linuxbrew.

Here is my configure command:

./configure linuxx8664gcc --minimal --prefix=/home/didionjp/local/ --with-cc=/home/didionjp/.linuxbrew/bin/gcc --with-cxx=/home/didionjp/.linuxbrew/bin/g++ --with-ld=/home/didionjp/.linuxbrew/bin/g++ --with-ssl=/home/didionjp/.linuxbrew/bin/openssl --enable-builtin-afterimage --enable-builtin-ftgl --enable-builtin-freetype --enable-builtin-glew --enable-builtin-pcre --enable-builtin-zlib --enable-builtin-lzma --disable-cling --enable-explicitlink --enable-soversion --enable-cxx14

And here is the error:

/home/didionjp/.linuxbrew/bin/g++ -shared -Wl,-soname, -m64 -O2 -Wl,–no-undefined -Wl,–as-needed -o cint/cint/include/ cint/cint/lib/G__c_posix.o cint/cint/lib/posix/exten.o -Llib -lCint
cint/cint/lib/posix/exten.o: In function stat': exten.c:(.text+0x0): multiple definition ofstat’
cint/cint/lib/G__c_posix.o:G__c_posix.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [cint/cint/include/posix.dll] Error 1

I have tried 5.34.30 and 5.34.32 and get the same error.

Please try with CMake.

Same problem occurs when using cmake:

[ 44%] Linking C shared library …/…/lib/posix.dll
CMakeFiles/posix.dir/__/cint/lib/posix/exten.c.o: In function stat': /home/didionjp/.linuxbrew/Cellar/gcc/5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed/sys/stat.h:489: multiple definition ofstat’
CMakeFiles/posix.dir/G__c_posix.c.o:/home/didionjp/.linuxbrew/Cellar/gcc/5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed/sys/stat.h:489: first defined here
/home/didionjp/.linuxbrew/bin/ld: skipping incompatible /usr/lib/ when searching for -lpthread
/home/didionjp/.linuxbrew/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/home/didionjp/.linuxbrew/bin/ld: skipping incompatible /usr/lib/ when searching for -lc
/home/didionjp/.linuxbrew/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
collect2: error: ld returned 1 exit status
gmake[2]: *** [lib/posix.dll] Error 1
gmake[1]: *** [cint/ROOT/CMakeFiles/posix.dir/all] Error 2
gmake: *** [all] Error 2

I am trying to reproduce. I am assuming is CentOS 7.

more /etc/*-release: CentOS release 5.10 (Final)
uname -r:

Though I am using linuxbrew to run modern versions of gcc and other dependencies.

My assumption was then wrong. Then, I’ll not be able to reproduce it. On CentOS 7 works nicely.
I can provide you a way to disabling to build the posix.dll dictionary and cross the fingers that is not really used in your case.

--- a/cint/ROOT/CMakeLists.txt
+++ b/cint/ROOT/CMakeLists.txt
@@ -57,9 +57,8 @@ set(CINTINCDLLHEADERS
 if(NOT WIN32)
-    ${CMAKE_SOURCE_DIR}/cint/cint/lib/posix/exten.h 

Getting closer. Now I get:

gmake[2]: *** No rule to make target cint/cint/include/sys/types.h', needed bycint/ROOT/G__c_ipc.c’. Stop.
gmake[1]: *** [cint/ROOT/CMakeFiles/ipc.dir/all] Error 2
gmake: *** [all] Error 2

Remove all these lines then:


Hooray! That worked. Fingers crossed that the posix functions won’t be used.

Sorry for necrobumping this thread, but I found an alternative solution which doesn’t require to disable posix nor using CMake, and I’d like to share it. In my system (Root 5.34.36 on 32 bit SL5 with glibc 2.5 and custom built gcc 6.3.0) the problem stems from gcc using a fixed version of sys/stat.h (automatically fixed by fixincludes) which does not play well with online functions and the default c11 dialect used by gcc >= 5. This caused the inline version of the stat function defined in sys/stat.h to be compiled and exported in two different object files, causing then the linker error. I’m not a compiler expert so I couldn’t fully understand the issue, but then I read that C99 changed the semantics of inline so I tried to force the C standard to gnu90 and it worked. To do so, add this line:

EXTRA_CFLAGS += -std=gnu90

to config/Makefile.linux (or to the config/Makefile.XXX corresponding to your architecture).

Hope this will be of some help for people trying to build Root with a new custom gcc on a system with an old glibc.