cling::printValue(void const**) unresolved while linking [cling interface function]!

Hi,

I use Ubuntu 15.10 with gcc 5.2.1. I built ROOT from the sources.

I create a small tree for testing purposes using the following code …

void createtree(){

 //create a tree file tree1.root - create the file, the Tree and a few branches
   TFile f("testtree.root","recreate");
   TTree t1("t1","a simple Tree with simple variables");
   Float_t px, py, pz;
   Double_t random;
   Int_t ev;
   t1.Branch("px",&px,"px/F");
   t1.Branch("py",&py,"py/F");
   t1.Branch("pz",&pz,"pz/F");   t1.Branch("ev",&ev,"ev/I");

//fill the tree
   for (Int_t i=0; i<10000; i++) {
gRandom->Rannor(px,py);                             
pz = px*px + py*py;
random = gRandom->Rndm();
 ev = i;
t1.Fill();
   }
   //save the Tree heade; the file will be automatically closed
   //when going out of the function scope
   t1.Write();
}

when loading the created tree I get the following error message:

/home/peters/test/tmva/deep/higgs> root -l testtree.root 
root [0] 
Attaching file testtree.root as _file0...
IncrementalExecutor::executeFunction: symbol '_ZN5cling10printValueEPPKv' unresolved while linking [cling interface function]!
You are probably missing the definition of cling::printValue(void const**)
Maybe you need to load the corresponding shared library?
(TFile *) Error in ValuePrinter: missing output string.
root [1] 

What can be the reason for this behavior?

cheers,
Peter

Unfortunately we do not support yet GCC version >= 5.1. The reason is that the LLVM/clang we use for the interpreter does not supper the new GCC ABI. Thus the missing symbol you encountered. We will integrate a new version of LLVM/clang as soon as possible.

I confirm, I discovered this problem also. And I am not able to compile version 5.34 under ubuntu15.10.

I don’t see how this is “solved”. [-X

As a workaround it seems to help to tell gcc to use the old ABI.

For building root e.g.:

CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" cmake -DCMAKE_INSTALL_PREFIX=/usr/local/  -Dgnuinstall=ON  ../root

When linking an own executable define _GLIBCXX_USE_CXX11_ABI to 0 for compiling your sources.

Hi,

gcc 5.2 introduce a new ABI (for std::string in particular) and clang has yet to add support for it :frowning:

To work around it you need to force gcc 5.2 to use the old ABI either by building gcc 5.2 with:

 /usr/src/gcc-5.2.0/configure --with-default-libstdcxx-abi=gcc4-compatible

A more risky solution from gcc.gnu.org/gcc-5/changes.html#libstdcxx
Runtime Library (libstdc++)

A Dual ABI is provided by the library. A new ABI is enabled by default. The old ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers.

But see the part about “Troubleshooting” in
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

Cheers,
Philippe.

Did anyone got this working ?

I tried :

cmake -Drpath=ON
-Dexplicitlink=ON
-Dxrootd=OFF
-D_builtin-freetype=OFF
-DCMAKE_CXX_COMPILER=/usr/local/products/gcc/5.2.0-nogold/bin/g++
-DCMAKE_C_COMPILER=/usr/local/products/gcc/5.2.0-nogold/bin/gcc
-DCMAKE_INSTALL_PREFIX=my_directory
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
my_source_directory

Some remarks:

  • The fail-on-missing flag does not work: it complains that gsl is missing although building
    option for gsl was not turned on
  • how do I specify the linker. CMAKE_LINKER resulted in cmake error . It is suspiciously missing
    from the root page giving build options
  • cmake – build . -target install does NOT fire off a test with simple.C , like make install does

After a successful build of root I start up root and get the error:

error: definition of macro ‘_GLIBCXX_USE_CXX11_ABI’ differs between the
precompiled header (‘1’) and the command line (‘0’)

So what is going on ?

-Eddy

It seems to be a problem with the build system and a JIRA ticket has been submitted:

sft.its.cern.ch/jira/browse/ROOT-7870

Did you try with the following parameter : -DCLINGCXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"

(cf. comment on the JIRA :
sft.its.cern.ch/jira/browse/ROO … ment-73174 )

Cheers,

Y.

Hi,

An update for people still ending up here: since a few months, cling supports the GCC 5 just fine.

Axel.

Hi Axel,
what do you mean exactly that cling now supports gcc just fine? I tried to compile root 6.06.08 on ubuntu 16.04 (gcc version 5.4.0 20160609) by ignoring the ABI check in cmake CheckCompiler.cmake.
The compilation ran just fine and I can run root, but I’ve got the usual issue when using the interpreter:

root [0] int x
IncrementalExecutor::executeFunction: symbol '_ZN5cling10printValueEPKi' unresolved while linking [cling interface function]!
You are probably missing the definition of cling::printValue(int const*)
Maybe you need to load the corresponding shared library?
(int) Error in ValuePrinter: missing output string.

Clean your build directory, and try to compile again without just cmake …/pathToSources, do not use the ABI flag anymore.

I think Axel means at least 6.08.x or newer.
For 6.06.x you still need -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"

Hi all.
I found a solution to this: I had to install clang-3.9 on my system before compiling.
Luckily LLVM maintains many versions for many systems, so it was quite straightforward.
Here is the exact complete sequence:

Prerequisites

# Required packages
sudo apt-get install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev

# Optional packages
sudo apt-get install gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev

Clang 3.9

# LLVM & clang 3.9
cat >> llvm-toolchain-3.9.list << @EOF
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
@EOF
sudo mv llvm-toolchain-3.9.list /etc/apt/sources.list.d/
sudo chown root. /etc/apt/sources.list.d/llvm-toolchain-3.9.list
sudo apt-get update
sudo apt-get install clang-3.9

Usual installation

# Git clone
git clone http://root.cern.ch/git/root.git root_src

# actual make
mkdir root_build
cd root_build
unset ROOTSYS
cmake -Dall="ON" -Dr="OFF" -Dsoversion="ON" -Dqtgsi="OFF" ../root_src >> cmake.out.txt 2>&1
cmake --build . -- -j7 | tee cmake.out.txt 2>&1

# make install
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/root/ -P cmake_install.cmake >> cmake_install.out.txt 2>&1

Hi,

This is not a real solution; your ROOT build will still cause issues with distro C++ libraries, because those are still using the new ABI. I’d also argue that using ROOT 6.08 might be simpler than building llvm…

Cheers, Axel.