[ 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/libpthread.so 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/libc.so 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
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.
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.