Problems compiling root with gcc 9.1


ROOT Version: 6.14.04, 6.14.06, and 6.16.00
Platform: CentOS 6.10
Compiler: gcc 9.1


Hi,

I’m having issues compiling the latest root 6 versions (6.14.04, 6.14.06, or 6.16.00) on CentOS 6.10 using gcc 9.1.
I’ve installed gcc 9.1 in /opt/gcc9 and adjusted the PATH and LD_LIBRARY_PATH accordingly (also ran ldconfig). The 6.14 versions compile fine using gcc 4.9.3 installed similarly under /usr/local (6.16 fails to compile using gcc 4.9.3 as well).

The errors are for 6.14.04 and 6.14.06:

CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::ReOpen(char const*)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:354: undefined reference to `XrdCl::File::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::OpenFlags::Flags, XrdCl::Access::Mode, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::GetVectorReadLimits()':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:725: undefined reference to `XrdCl::File::GetProperty(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:727: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::SetEnv()':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:781: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:786: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:791: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:796: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:801: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o:/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:806: more undefined references to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' follow
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::SetEnv()':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:836: undefined reference to `XrdCl::Env::PutString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:841: undefined reference to `XrdCl::Env::PutString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:846: undefined reference to `XrdCl::Env::PutString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:849: undefined reference to `XrdCl::Env::PutInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:141: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:174: undefined reference to `XrdCl::File::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::OpenFlags::Flags, XrdCl::Access::Mode, XrdCl::ResponseHandler*, unsigned short)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGFile.cxx:183: undefined reference to `XrdCl::File::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::OpenFlags::Flags, XrdCl::Access::Mode, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `_ZNK5XrdCl12XRootDStatus5ToStrB5cxx11Ev':
/usr/include/xrootd/XrdCl/XrdClXRootDResponses.hh:261: undefined reference to `_ZNK5XrdCl6Status8ToStringB5cxx11Ev'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::GetDirEntry(void*)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:163: undefined reference to `XrdCl::FileSystem::DirList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::DirListFlags::Flags, XrdCl::DirectoryList*&, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `DirectoryInfo':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:54: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::MakeDirectory(char const*)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:127: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:128: undefined reference to `XrdCl::FileSystem::MkDir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::MkDirFlags::Flags, XrdCl::Access::Mode, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::Unlink(char const*)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:284: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:287: undefined reference to `XrdCl::FileSystem::Stat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::StatInfo*&, unsigned short)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:294: undefined reference to `XrdCl::FileSystem::RmDir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:296: undefined reference to `XrdCl::FileSystem::Rm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::GetPathInfo(char const*, FileStat_t&)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:192: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:193: undefined reference to `XrdCl::FileSystem::Stat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::StatInfo*&, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::ConsistentWith(char const*, void*)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:248: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:89: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:90: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::Stage(TCollection*, unsigned char)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:416: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:419: undefined reference to `XrdCl::FileSystem::Prepare(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, XrdCl::PrepareFlags::Flags, unsigned char, XrdCl::Buffer*&, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGSystem.cxx.o: In function `TNetXNGSystem::Locate(char const*, TString&)':
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:330: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:333: undefined reference to `XrdCl::FileSystem::Locate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::OpenFlags::Flags, XrdCl::LocationInfo*&, unsigned short)'
/opt/cern/root/root-6.14.04/net/netxng/src/TNetXNGSystem.cxx:342: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libNetxNG.so] Error 1
make[1]: *** [net/netxng/CMakeFiles/NetxNG.dir/all] Error 2
make: *** [all] Error 2

For 6.16.00 the errors are the same whether using gcc 4.9.3 or 9.1 (or even trying to compile root 7):

/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx: In function ‘int {anonymous}::VfsRdOnlyOpen(sqlite3_vfs*, const char*, sqlite3_file*, int, int*)’:
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx:205:4: error: too many initializers for ‘const sqlite3_io_methods’
    };
    ^
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx: At global scope:
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx:332:1: error: too many initializers for ‘sqlite3_vfs’
 };
 ^
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx: In destructor ‘virtual ROOT::RDF::RSqliteDS::~RSqliteDS()’:
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx:480:34: error: ‘sqlite3_close_v2’ was not declared in this scope
    sqlite3_close_v2(fDataSet->fDb);
                                  ^
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx: In member function ‘void ROOT::RDF::RSqliteDS::SqliteError(int)’:
/opt/cern/root/root-6.16.00/tree/dataframe/src/RSqliteDS.cxx:632:36: error: ‘sqlite3_errstr’ was not declared in this scope
    errmsg += sqlite3_errstr(errcode);

Is this a know error aka should I use a different version of gcc, or am I doing something wrong?

Old versions of ROOT usually do not support the latest compilers. Please use the master branch with GCC 9. You will see some warnings, since we are still finishing the fixes for those, but you will not get errors. Your problem is not because of ROOT, however. You are trying to link ABI-incompatible libraries. GCC does not guarantee compatibility between major versions, and there was a big change in ABI from GCC 4.x and 5.x and above. That’s why the ROOT you compile with GCC 9 cannot link againt the standard libraries on your computer (which were compiled with the system compiler, probably GCC 4.8 or earlier). You will need to use libstdc++ from GCC 9 to be able to compile ROOT with GCC 9.

Thanks amadio. I thought I’d set everything up to link against the GCC 9 libraries by setting the LD_LIBRARY_PATH, but I guess I need to tell cmake somehow how to compile things using those libraries as well?

I will try the master branch and see if I can get that to work for me.

So the master branch isn’t working either. I get the same error as for version 6.16.00 and that is whether I use gcc 9.1 or 4.9.3 (so it can’t be a library issue).

I also added a -DCMAKE_SYSTEM_LIBRARY_PATH to set the correct path for the gcc 9.1 libraries. The output from cmake says:

Cling will look for C++ headers in '/opt/gcc9/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0:/opt/gcc9/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/x86_64-pc-linux-gnu:/opt/gcc9/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/backward' at runtime.

So at least it uses the right headers (couldn’t find any output about libraries from cmake). I also tried to run the command that failed with a manually added -L with the same error.
And it seems that the undefined reference to XrdCl::File::Open is part of the root code, not c++?

Where are you getting XRootD from? If you are using the builtin, then its libraries should be found automatically.

It’s the built in xrootd, at least I didn’t configure any external xrootd to be used.

Can you try to use an external xrootd or disabling it?

I disabled xrootd and re-compiled the master branch using gcc 4.9.3 and now I’m getting this error:

/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx: In function 'int {anonymous}::VfsRdOnlyOpen(sqlite3_vfs*, const char*, sqlite3_file*, int, int*)':
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx:205:4: error: too many initializers for 'const sqlite3_io_methods'
    };
    ^
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx: At global scope:
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx:332:1: error: too many initializers for 'sqlite3_vfs'
 };
 ^
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx: In destructor 'virtual ROOT::RDF::RSqliteDS::~RSqliteDS()':
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx:480:34: error: 'sqlite3_close_v2' was not declared in this scope
    sqlite3_close_v2(fDataSet->fDb);
                                  ^
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx: In member function 'void ROOT::RDF::RSqliteDS::SqliteError(int)':
/opt/cern/root/root-newest/tree/dataframe/src/RSqliteDS.cxx:632:36: error: 'sqlite3_errstr' was not declared in this scope
    errmsg += sqlite3_errstr(errcode);

This seems to be the same error I’ve been getting for 6.16.00.

If you don’t care about sqlite support, you can also disable it with -Dsqlite=OFF. You probably have an old version of sqlite that doesn’t work with ROOT.

I’ve disabled sqlite and it now compiles using gcc 4.9.3. Using gcc 9.1 however I now get this error:

CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::ReOpen(char const*)':
/opt/cern/root/root-newest/net/netxng/src/TNetXNGFile.cxx:368: undefined reference to `XrdCl::File::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, XrdCl::OpenFlags::Flags, XrdCl::Access::Mode, unsigned short)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::GetVectorReadLimits()':
/opt/cern/root/root-newest/net/netxng/src/TNetXNGFile.cxx:738: undefined reference to `XrdCl::File::GetProperty(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
/opt/cern/root/root-newest/net/netxng/src/TNetXNGFile.cxx:739: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/opt/cern/root/root-newest/net/netxng/src/TNetXNGFile.cxx:751: undefined reference to `XrdCl::File::GetProperty(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
/opt/cern/root/root-newest/net/netxng/src/TNetXNGFile.cxx:753: undefined reference to `XrdCl::URL::URL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/NetxNG.dir/src/TNetXNGFile.cxx.o: In function `TNetXNGFile::SetEnv()':

Looking into this it seems to me that these libraries are part of proof, how do I turn of the use of those and does that impact the use of proof?

That’s an ABI problem again, please check your configuration for GCC 9, it’s mixing libstdc++ that is incompatible.

So the problem seems to be that it’s still trying to link against the standard installed /usr/lib64/libXrdCl.so. That library is part of the xrootd-client-devel-4.8.4-1.el6.x86_64 package which of course links against default installed libraries. But why is it linking against xrootd when I use -DXROOTD=OFF? Shouldn’t this turn off the use of rooted?

“-Dxrootd=OFF” or “-Dbuiltin_xrootd=ON”

Didn’t know this was case sensitive. It seemed to work when using gcc 4.9.3 (but same cmake version), at least it changed the error I was getting.
Changing -DXROOTD=OFF to -Dxrootd=OFF solved this issue. I will try to use the -Dbuiltin_xrootd=ON flag next and also check if this solves my issues with the other versions.
Thanks for your help!

The -Dbuiltin_xrootd=ON flag works for the master branch. I tried using the same flag for the previous versions (6.14.04, 6.14.06, and 6.16.00) and got the error:

[I] No git repository info found. Trying to interpret VERSION_INFO
[I] src/XrdVersion.hh successfully generated
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc: In member function 'XrdXrootdProtocol XrdXrootdProtocol::operator=(const XrdXrootdProtocol&)':
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc:234:12: error: implicitly-declared 'XrdXrootdProtocol::XrdXrootdProtocol(XrdXrootdProtocol&)' is deprecated [-Werror=deprecated-copy]
  234 |    return *this;
      |            ^~~~
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc:215:19: note: because 'XrdXrootdProtocol' has user-provided 'XrdXrootdProtocol XrdXrootdProtocol::operator=(const XrdXrootdProtocol&)'
  215 | XrdXrootdProtocol XrdXrootdProtocol::operator =(const XrdXrootdProtocol &rhs)
      |                   ^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/XrdServer.dir/XrdXrootd/XrdXrootdProtocol.cc.o] Error 1
make[4]: *** [src/CMakeFiles/XrdServer.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [all] Error 2

So I tried using the -Dxrootd=OFF flag instead, and this works for all three versions.

So to recap, compiling on CentOS 6 with a custom gcc 9.1 requires the use of -Dsqlite=OFF as well as -Dxrootd=OFF for all older versions and -Dbuiltin_xrootd=ON for the newest version.

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