Minimum root build failing

There is a code I am forced to use, namely:

https://applgrid.hepforge.org/

which has root as a dependency. I would like to perform the minimal possible Cern-Root build that is able to serve as dependence for that piece of code. It requires essentially to be able to open and write a tree to disk. In particular, I am not interested in building cling or having things like openssl or krberos as a dependency.

I am however unable to configure root using cmake for that purpose.

I am trying to build:

root_v6.11.02

on a linux machine (ubunru 16.04)

mkdir bld
cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} \
	     -Dx11=OFF \
		 -Dxrootd=OFF \
		 -Dxml=OFF \
		 -Dxft=OFF \
		 -Dtable=OFF \
		 -Dssl=OFF \
		 -Dsrp=OFF \
		 -Dsqlite=OFF \
		 -Dshadowpw=OFF \
		 -Dsapdb=OFF \
		 -Drfio=OFF \
		 -Droofit=OFF \
		 -Dqt=OFF \
		 -Dqtgsi=OFF \
		 -Dpython=OFF \
		 -Dpythia8=OFF \
		 -Dpythia6=OFF \
		 -Dpgsql=OFF \
		 -Doracle=OFF \
		 -Dopengl=OFF \
		 -Dodbc=OFF \
		 -Dmysql=OFF \
                 -Dmonalisa=OFF \
		 -Dminuit2=OFF \
		 -Dminimal=ON \
		 -Dmathmore=OFF \
		 -Dldap=OFF \
		 -Dkrb5=OFF \
		 -Dimt=OFF \
		 -Dhdfs=OFF \
		 -Dgviz=OFF \
		 -Dglite=OFF \
		 -Dgfal=OFF \
		 -Dgenvector=OFF \
                 -Dfitsio=OFF \
		 -Dfftw3=OFF \
		 -Dfail-on-missing=ON \
		 -Ddcache=OFF \
		 -Dcastor=OFF \
		 -Dbuiltin_llvm=OFF \
		 -Dbuiltin_glew=OFF \
		 -Dbuiltin_ftgl=ON \
		 -Dbuiltin_freetype=OFF \
		 -Dbuiltin_afterimage=OFF \
		 -Dbonjour=OFF \
		 -Dastiff=OFF \
		 -Dasimage=OFF \
		 -Dalien=OFF \
		 -Dtvma=OFF \
                 -Dcling=OFF

When I run this, different parts of cmake seem to disagree on whether cling or llvm should be build.

-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found GCC. Major version 5, minor version 4
-- Performing Test HAS_CXX11
-- Performing Test HAS_CXX11 - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found a 64bit system
-- Found GNU compiler collection
-- Performing Test GLIBCXX_USE_CXX11_ABI
-- Performing Test GLIBCXX_USE_CXX11_ABI - Success
-- ROOT Platform: linux
-- ROOT Architecture: linuxx8664gcc
-- Build Type: RelWithDebInfo
-- Compiler Flags:  -pipe -m64  -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -fPIC -pthread -std=c++11 -O2 -g -DNDEBUG
-- Looking for ZLib
-- Found ZLIB: /home/zah/anaconda3/lib/libz.so (found version "1.2.11") 
-- Looking for Unuran
-- Could NOT find UNURAN (missing:  UNURAN_LIBRARY UNURAN_INCLUDE_DIR) 
-- Unuran not found. Switching on builtin_unuran option
-- Looking for Freetype
-- Found Freetype: /home/zah/anaconda3/lib/libfreetype.so (found version "2.8.0") 
-- Looking for PCRE
-- Found PCRE: /home/zah/anaconda3/include  
-- Looking for LZMA
-- Found LZMA includes at /home/zah/anaconda3/include
-- Found LZMA library at /home/zah/anaconda3/lib/liblzma.so
-- Looking for LZ4
-- LZ4 not found. Switching on builtin_lz4 option
-- Building LZ4 version v1.7.5 included in ROOT itself
-- Looking for gl2ps
-- Could NOT find GL2PS (missing:  GL2PS_LIBRARY) 
-- gl2ps not found. Switching on builtin_gl2ps option
-- Enabled support for:  builtin_ftgl builtin_gl2ps builtin_lz4 builtin_unuran cxx11 explicitlink thread
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include  
-- Native target architecture is X86
-- Threads disabled.
-- Doxygen disabled.
-- Go bindings enabled.
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Building with -fPIC
-- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.12") 
-- Constructing LLVMBuild project information
-- Targeting X86
-- Could NOT find Z3 (missing:  Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.5")
-- Clang version: 5.0.0
-- Cling version (from VERSION file): ROOT_0.5~dev
-- Cling will look for C++ headers in '/usr/include/c++/5:/usr/include/x86_64-linux-gnu/c++/5:/usr/include/c++/5/backward' at runtime.
-- And if not found, will invoke: 'g++-5' for them.
-- Performing Test CXX_HAS_Wno_maybe_uninitialized
-- Performing Test CXX_HAS_Wno_maybe_uninitialized - Success
-- Performing Test CXX_HAS_fno_rtti
-- Performing Test CXX_HAS_fno_rtti - Success
-- Performing Test C_HAS_Wno_strict_overflow
-- Performing Test C_HAS_Wno_strict_overflow - Success
-- Performing Test C_HAS_Wno_maybe_uninitialized
-- Performing Test C_HAS_Wno_maybe_uninitialized - Success
-- Performing Test C_HAS_Wno_parentheses_equality
-- Performing Test C_HAS_Wno_parentheses_equality - Success
-- Performing Test found_setresuid
-- Performing Test found_setresuid - Success
-- Performing Test found_stdstringview
-- Performing Test found_stdstringview - Failed
-- Performing Test found_stdexpstringview
-- Performing Test found_stdexpstringview - Failed
-- Performing Test found_stdapply
-- Performing Test found_stdapply - Failed
-- Performing Test found_stdinvoke
-- Performing Test found_stdinvoke - Failed
Running /home/zah/anaconda3/conda-bld/cern-root_1516216404501/work/build/unix/compiledata.sh
Making /home/zah/anaconda3/conda-bld/cern-root_1516216404501/work/bld3/include/compiledata.h
-- Configuring done
CMake Error at core/clingutils/CMakeLists.txt:24 (add_dependencies):
  The dependency target "CLING" of target "ClingUtils" does not exist.


CMake Error at core/dictgen/CMakeLists.txt:31 (add_dependencies):
  The dependency target "CLING" of target "Dictgen" does not exist.


CMake Error at core/metacling/src/CMakeLists.txt:30 (add_dependencies):
  The dependency target "CLING" of target "MetaCling" does not exist.


CMake Error at core/rootcling_stage1/CMakeLists.txt:23 (add_dependencies):
  The dependency target "CLING" of target "rootcling_stage1" does not exist.


-- Generating done
-- Build files have been written to: /home/zah/anaconda3/conda-bld/cern-root_1516216404501/work/bld3

And make ultimately fails trying to build some AST parser that I certainly don’t want.

/home/zah/anaconda3/conda-bld/cern-root_1516216404501/work/core/clingutils/src/RStl.cxx:22:28: fatal error: clang/AST/Decl.h: No such file or directory
compilation terminated.
core/clingutils/CMakeFiles/ClingUtils.dir/build.make:62: recipe for target 'core/clingutils/CMakeFiles/ClingUtils.dir/src/RStl.cxx.o' failed
make[2]: *** [core/clingutils/CMakeFiles/ClingUtils.dir/src/RStl.cxx.o] Error 1
CMakeFiles/Makefile2:14204: recipe for target 'core/clingutils/CMakeFiles/ClingUtils.dir/all' failed
make[1]: *** [core/clingutils/CMakeFiles/ClingUtils.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Is there a way to disable all these extra features?

The problem are the options above. Please remove them from your configuration. ROOT needs to use the internal LLVM because Clang still has patches needed by ROOT, and cling is now the only interpreter, so disabling cling is not possible either. See https://github.com/root-project/root/pull/1509 for more details about the LLVM option. The cling option will be removed altogether in the next release of ROOT.

Let us know if it still doesn’t work after enabling back builtin_llvm and cling. You may also want to move to ROOT 6.12, which is the latest release.

Thanks.

Just to be sure I understood, can you please confirm that there is no way to configure ROOT to build as a C++ library without any interpreter at all?
Is there any fundamental reason for that?
Can ROOT 5 be built as a library?

You cannot build any ROOT version without the use of an C/C++ interpreter (built-in).
This is a known design flaw. The official reason is that ROOT was designed as a “framework” (i.e. not a “set of reusable libraries”).

1 Like

It’s not a design flaw. ROOT needs the interpreter to access data about C++ types at runtime to perform I/O.
Hence the builtin interpreter, be it cint for ROOT 5 or cling for ROOT 6, always needs to be built as part of ROOT.

It’s a design flaw of ROOT to rely on a language that doesn’t have reflection as a well supported feature and rely on that feature for I/O and serialization.

It’s not really the I/O that creates the problem (this could probably be easily overcome).
It’s that almost every (“important”) ROOT class has methods which access “interpreted C/C++ functions”. This enforces the constant presence of an “C/C++ interpreter” (even it you do not want to use it and your scripts are written in another language, like python).

1 Like

Removing the two flags, so as to enable cling cause the compilation to fail at 93% with what I think is this error:

https://bugs.llvm.org/show_bug.cgi?id=31658

I do not understand it, or how it was triggered. I see this failure:

Generating etc/allDict.cxx.pch
error: unknown argument: '-fno-plt'
In file included from input_line_12:21:
In file included from ./etc/dictpch/allHeaders.h:256:
In file included from ./include/TAxis.h:24:
In file included from ./include/TNamed.h:26:
In file included from ./include/TString.h:28:
./include/RStringView.h:32:4: error: redefinition of 'basic_string_view' as different kind of symbol
   using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
   ^
/home/zah/anaconda3/conda-bld/cern-root_1516271449039/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/include/c++/7.2.0/string_view:71:11: note: previous definition is here
    class basic_string_view
          ^
Error: ./bin/rootcling: compilation failure (./allDictc4f79468ae_dictUmbrella.h)
CMakeFiles/onepcm.dir/build.make:64: recipe for target 'etc/allDict.cxx.pch' failed
make[2]: *** [etc/allDict.cxx.pch] Error 1
CMakeFiles/Makefile2:442: recipe for target 'CMakeFiles/onepcm.dir/all' failed
make[1]: *** [CMakeFiles/onepcm.dir/all] Error 2
Makefile:151: recipe for target 'all' failed

as per the suggestions, I upgraded to the latest version,
https://root.cern.ch/download/root_v6.12.04.source.tar.gz

How about:

cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} -Dminimal=ON

BTW. In your first post, I can see “-Dbuiltin_ftgl=ON” which seems to suggest that you do want graphics, so maybe you should try “-Dgminimal=ON -Dbuiltin_ftgl=ON” (with or without “-Dopengl=ON”).

If python is your thing (I see ‘conda’ in your directory structure), a very minimal version of ROOT can be installed using pip. Its purpose is to install cling, but Core depends as much on I/O as vice versa, so it still contains full I/O as well:

https://pypi.python.org/pypi/cppyy-cling/

The source for this is created by a script:

https://bitbucket.org/wlav/cppyy-backend/src/20febe79f02f04d691d4f8b249e4e45e84345866/cling/create_src_directory.py?at=master&fileviewer=file-view-default

that not only removes all extraneous stuff, but also edits the cmake files and some of the source files to kill spurious dependencies. It does add some patches, but those should be mostly harmless (certainly if all you do is I/O).

The PyPA package support wheels and the binary is python-agnostic, so local caching, virtualenv, etc. all play nice.

This means that CMake and rootcling disagree on whether your compiler provides string_view or not. I bet that CMake picked /usr/bin/gcc while rootcling is taking gcc from anaconda. Can you post CMakeCache.txt to confirm?

I’d just configure with

cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_CX_COMPILER=`which gcc` /path/to/root/sources

That should make CMake and rootcling agree on the compiler.

Cheers, Axel.

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