Root compilation fail at cling step because of 'stdlib.h' file not found

Hi
I try to compile root version 6.08.06 on Linux 2.6.32 x86_64 with gcc 6.1.1, and with headers and libraries in a non standard place.
It always fails at the rootcling step:

[ 63%] Built target rootcling
Scanning dependencies of target G__Minuit
[ 63%] Generating G__Minuit.cxx, ../../lib/libMinuit_rdict.pcm, ../../lib/libMinuit.rootmap
Scanning dependencies of target G__Fumili
Scanning dependencies of target G__MathMore
Scanning dependencies of target G__Matrix
[ 63%] Generating G__Fumili.cxx, ../../lib/libFumili_rdict.pcm, ../../lib/libFumili.rootmap
[ 63%] Generating G__MathMore.cxx, ../../lib/libMathMore_rdict.pcm, ../../lib/libMathMore.rootmap
Scanning dependencies of target G__MathCore
[ 63%] Generating G__Matrix.cxx, ../../lib/libMatrix_rdict.pcm, ../../lib/libMatrix.rootmap
[ 63%] Generating G__MathCore.cxx, ../../lib/libMathCore_rdict.pcm, ../../lib/libMathCore.rootmap
Scanning dependencies of target G__MultiProc
[ 63%] Generating G__MultiProc.cxx, ../../lib/libMultiProc_rdict.pcm, ../../lib/libMultiProc.rootmap
Scanning dependencies of target G__Physics
[ 63%] Generating G__Physics.cxx, ../../lib/libPhysics_rdict.pcm, ../../lib/libPhysics.rootmap
Scanning dependencies of target G__PyMVA
[ 63%] Generating G__PyMVA.cxx, ../../lib/libPyMVA_rdict.pcm, ../../lib/libPyMVA.rootmap
In file included from input_line_3:2:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/string:52:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/bits/basic_string.h:5402:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/ext/string_conversions.h:41:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/cstdlib:75:
/builddir/build/BUILD/root-6.08.06/mybuild/etc/cling/lib/clang/3.9.0/include/stdlib.h:8:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^

 *** Break *** segmentation violation
Error in <TUnixSystem::StackTrace> script /software/Development/root/6.08.06-minimal/etc/root/gdb-backtrace.sh is missing
In file included from input_line_3:2:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/string:52:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/bits/basic_string.h:5402:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/ext/string_conversions.h:41:
In file included from /software/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/cstdlib:75:
/builddir/build/BUILD/root-6.08.06/mybuild/etc/cling/lib/clang/3.9.0/include/stdlib.h:8:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^

 *** Break *** segmentation violation
Error in <TUnixSystem::StackTrace> script /software/Development/root/6.08.06-minimal/etc/root/gdb-backtrace.sh is missing
make[2]: *** [tmva/pymva/G__PyMVA.cxx] Error 139
make[2]: *** [math/mathmore/G__MathMore.cxx] Error 139
make[1]: *** [tmva/pymva/CMakeFiles/G__PyMVA.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [math/mathmore/CMakeFiles/G__MathMore.dir/all] Error 2
[ 63%] Built target G__Physics
[ 63%] Built target G__Minuit
[ 63%] Built target G__Fumili
[ 63%] Built target G__MultiProc
[ 63%] Built target G__Matrix
[ 63%] Built target G__MathCore
make: *** [all] Error 2

I tried to add what I think is the right path for stdlib.h where “Cling will look for C++ headers” but without success.
I have the same issue with cmake or configure.
I used:

cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -Dgnuinstall=ON
make

Did I miss smth?
Thanks

Where is your stdlib.h?

@vvassilev - could the “use a different stdlib” flag help here, the one you used also for clang/non-standard-gcc builds?

One probably needs to specify -Dgcctoolchain=/path/to/the/toolchain/. Eg -Dgcctoolchain=/cvmfs/sft.cern.ch/lcg/contrib/gcc/6.2.0/

For me it the right one should be in /software/include/stdlib.h

What should be the toolchain path? We have gcc stuffs in a non-standard place.
What should I have in the toolchain path?

If you do echo “” | gcc -fsyntax-only -v
Would there be an include path to /software/include/ ?

For me it returns:

$ echo "" | gcc -fsyntax-only -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/software/libexec/gcc/x86_64-redhat-linux/6.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,go,lto --prefix=/software --mandir=/software/share/man --infodir=/software/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --without-isl --enable-libmpx --enable-gnu-indirect-function --with-arch_32=x86-64 --with-arch=nocona --with-tune=core2 --with-multilib-list=m64 --oldincludedir=/software/include --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.1.1 20160510 (Red Hat 6.1.1-2) (GCC)

So it should be /software/libexec/gcc/x86_64-redhat-linux/6.1.1 right?

Vassil forgot a crucial ‘-’: we need the output of

echo | gcc -fsyntax-only -E -v -

That will contain

#include <...> search starts here:

and tells us what the proper include path is.

Here is the output:

Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/software --mandir=/software/share/man --infodir=/software/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,fortran,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.1-20140807/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.1-20140807/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-arch_32=x86-64 --with-arch=nocona --with-tune=core2 --with-multilib-list=m64 --oldincludedir=/software/include --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.1 20140807 (Red Hat 4.9.1-5) (GCC) 
COLLECT_GCC_OPTIONS='-fsyntax-only' '-E' '-v' '-mtune=core2' '-march=nocona'
 /software/bin/../libexec/gcc/x86_64-redhat-linux/4.9.1/cc1 -E -quiet -v -iprefix /software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/ - -mtune=core2 -march=nocona -fsyntax-only
ignoring nonexistent directory "/software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/include-fixed"
ignoring nonexistent directory "/software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory "/software/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.9.1/include"
ignoring nonexistent directory "/software/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.9.1/include-fixed"
ignoring nonexistent directory "/software/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.9.1/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory "/software/include"
#include "..." search starts here:
#include <...> search starts here:
 /software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/include
 /usr/local/include
 /software/bin/../lib/gcc/../../include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/software/include/stdc-predef.h" 1 3
# 1 "<command-line>" 2
# 1 "<stdin>"
COMPILER_PATH=/software/bin/../libexec/gcc/x86_64-redhat-linux/4.9.1/:/software/bin/../libexec/gcc/
LIBRARY_PATH=/software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/:/software/bin/../lib/gcc/:/software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/../../../../lib64/:/software/lib/../lib64/:/software/lib64/../lib64/:/software/bin/../lib/gcc/x86_64-redhat-linux/4.9.1/../../../:/software/lib/:/software/lib64/
COLLECT_GCC_OPTIONS='-fsyntax-only' '-E' '-v' '-mtune=core2' '-march=nocona'

I guess this -Dgcctoolchain=/software/lib/gcc should then do. @vvassilev - is that correct?

What should contain the gcc toolchain directory, if
I want to recognize it by myself.

It does not work with -Dgcctoolchain=/software/lib/gcc on my side.

@vvassilev we could really use your help here…

That should be: -Dgcctoolchain=$(dirname $(dirname `which gcc`))

I still have the same issue with -Dgcctoolchain=$(dirname $(dirname which gcc))

I have created https://sft.its.cern.ch/jira/browse/ROOT-8900

We’re in the middle of the summer vacation period; we’ll see who will do this when. I don’t think we support system headers in a non-standard location; part of ROOT-8900 will be to determine whether that’s a reasonable feature for us to support.

Cheers, Axel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.