Undefined Reference Compiling


ROOT Version: 6.17/01
Platform: Ubuntu 16.04
Compiler: g++ 7.4.0


Hi there, yesterday I compiled successfully ROOT in my old laptop. Now I just want to compile a first test with this Makefile:

ROOT_FLAGS = $(shell root-config --glibs) 
ROOT_INC = $(shell root-config --incdir)
ROOT_CFLAGS = $(shell root-config --cflags)
ROOT_LDFLAGS = $(shell root-config --ldflags)
 
test1: test1.cc
    g++ -o test1 test1.cc -I$(ROOT_INC) $(ROOT_FLAGS) $(ROOT_LDFLAGS) $(ROOT_LDFLAGS)

The Makefile produces the command line:

g++ -o test1 test1.cc -I/usr/local/include -L/usr/local/lib -lGui -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic -m32 -msse -mfpmath=sse -m32 -msse -mfpmath=sse

and the result is

/usr/local/lib/libImt.so: undefined reference to `tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, int)'
collect2: error: ld returned 1 exit status

but I can execute successfully from command line:

$ root

and follow the examples from the tutorial. I think is properly installed in the system, so I can’t see any way to solve the problem and compile my first test. This is the code:

# include <iostream>
# include "TRandom.h"

using namespace std;

int main(void)
{
  TRandom *rnd = new TRandom(time(0));
  return 0;
}

Thank you for your help

Hi,

do you have a $ROOTSYS/lib/libtbb.so" file in your build? If not, against what tbb is your ROOT built (the initial cmake output should say that).
In addition, supposing you linked against the tbb on your system, could you add “-l tbb” to your ROOT_LDFLAGS variable?

Cheers,
D

Dear,

I met the similar problem. I built ROOT with python3 support successfully. But I always got the following message when I imported ROOT in python:

ImportError: /home/zhangxf/.local/root_v6.16/lib/libImt.so: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl

The output of ldd -r /home/zhangxf/.local/root_v6.16/lib/libImt.so was:

linux-vdso.so.1 =>  (0x00007ffea010c000)
	libThread.so => /home/zhangxf/.local/root_v6.16/lib/libThread.so (0x00007f5e58228000)
	libtbb.so.2 => /opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7/libtbb.so.2 (0x00007f5e57fce000)
	libCore.so => /home/zhangxf/.local/root_v6.16/lib/libCore.so (0x00007f5e57959000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5e5773d000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f5e57436000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f5e57134000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5e56f1e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f5e56b51000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f5e5868e000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f5e5694d000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f5e56745000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f5e564e3000)
	libpcreposix.so.0 => /lib64/libpcreposix.so.0 (0x00007f5e562e0000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f5e560ba000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f5e55ea4000)
undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl   (/home/zhangxf/.local/root_v6.16/lib/libImt.so)

And the output of c++filt _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl was tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)

The list of locate libtbb.so is as follows ($ROOTSYS=/home/zhangxf/.local/root_v6.16):

/home/zhangxf/.local/root_v6.16/lib/libtbb.so
/home/zhangxf/.local/root_v6.16/lib/libtbb.so.2
/home/zhangxf/Downloads/root-6.16.00-build/TBB-prefix/src/TBB/build/linux_intel64_gcc_cc4.8.5_libc2.17_kernel3.10.0_release/libtbb.so
/home/zhangxf/Downloads/root-6.16.00-build/TBB-prefix/src/TBB/build/linux_intel64_gcc_cc4.8.5_libc2.17_kernel3.10.0_release/libtbb.so.2
/home/zhangxf/Downloads/root-6.16.00-build/lib/libtbb.so
/home/zhangxf/Downloads/root-6.16.00-build/lib/libtbb.so.2
/opt/intel/advisor_2017.1.5.527008/lib32/libtbb.so
/opt/intel/advisor_2017.1.5.527008/lib32/libtbb.so.2
/opt/intel/advisor_2017.1.5.527008/lib64/libtbb.so
/opt/intel/advisor_2017.1.5.527008/lib64/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.1/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.1/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.4/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.4/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.7/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/ia32_lin/gcc4.7/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.1/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.1/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.4/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.4/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.7/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin/gcc4.7/libtbb.so.2
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin_mic/libtbb.so
/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64_lin_mic/libtbb.so.2
/opt/intel/inspector_2017.1.4.527006/lib32/libtbb.so
/opt/intel/inspector_2017.1.4.527006/lib32/libtbb.so.2
/opt/intel/inspector_2017.1.4.527006/lib64/libtbb.so
/opt/intel/inspector_2017.1.4.527006/lib64/libtbb.so.2
/opt/intel/vtune_amplifier_xe_2017.6.0.554757/lib32/libtbb.so
/opt/intel/vtune_amplifier_xe_2017.6.0.554757/lib32/libtbb.so.2
/opt/intel/vtune_amplifier_xe_2017.6.0.554757/lib64/libtbb.so
/opt/intel/vtune_amplifier_xe_2017.6.0.554757/lib64/libtbb.so.2

Any help will be greatly appreciated.
ROOT version: v6.16.00
Compiler: gcc 4.8.5, g++ 4.8.5
OS: CentOS 7.6, with kernel 3.10.0-957.5.1.el7.x86_64

It’s possible that the libtbb.so picked at runtime is an older version and does not have the symbol shown in the error message. Please post the output of echo $LD_LIBRARY_PATH here and what versions of TBB you have installed in the various places.

Thanks for your help. I found that the error message resulted from multiple libtbb.so in my $LD_LIBRARY_PATH. Since Intel compiler was also installed on the server, there are both libtbb.so in $ROOTSYS/lib and $IntelEnv/lib64 in my $LD_LIBRARY_PATH.

Could you tell me how to set the path for libtbb.so if I want to import ROOT in python? Now I have to comment $IntelEnv in my ~/.bashrc or execute source $ROOTSYS/bin/thisroot.sh again after the export of $IntelEnv if I want to do that. Thank you very much.

I think that you are already doing what you need, i.e. sourcing ROOT environment after everything else, to avoid unwanted TBB installations to be picked up. For using python, you need to export PYTHONPATH=$ROOTSYS/lib, but that should already be done by sourcing thisroot.sh. You just need to make sure that the python you use to import ROOT is the same that ROOT was compiled against. Cheers,

Hi,

I had the same situation … the libtbb.so installed with the system (/usr/lib64) and the other one by the the ROOT installation ($ROOTSYS/lib).
As @amadio recommended just sourcing the ROOT environment ($ROOTSYS/bin/thisroot.sh) solved the problem.

1 Like