Root 6.26.06 on ubuntu 22, compile error: undefined reference to `BrotliDecoderDecompress

Firstly, I download root 6.26.06 binary distribution for ubuntu 22.04.1. But when I was trying to compile my program using the following command:

g++ -I. root-config --glibs root-config --cflags decode.cpp

I got errors:

/usr/bin/ld: /tmp/cc78Gls8.o: in function `main':
decode.cpp:(.text+0x26e): undefined reference to `TFile::TFile(char const*, char const*, char const*, int)'
/usr/bin/ld: decode.cpp:(.text+0x273): undefined reference to `TDirectory::CurrentDirectory()'
/usr/bin/ld: decode.cpp:(.text+0x2cb): undefined reference to `TTree::TTree(char const*, char const*, int, TDirectory*)'
/usr/bin/ld: decode.cpp:(.text+0x739): undefined reference to `TFile::Write(char const*, int, int)'
/usr/bin/ld: decode.cpp:(.text+0x752): undefined reference to `TFile::Close(char const*)'
/usr/bin/ld: decode.cpp:(.text+0x775): undefined reference to `TFile::~TFile()'
/usr/bin/ld: decode.cpp:(.text+0x7f5): undefined reference to `TObject::operator delete(void*)'
/usr/bin/ld: decode.cpp:(.text+0x840): undefined reference to `TFile::~TFile()'
/usr/bin/ld: /tmp/cc78Gls8.o: in function `__static_initialization_and_destruction_0(int, int)':
decode.cpp:(.text+0x8b8): undefined reference to `TVersionCheck::TVersionCheck(int)'
/usr/bin/ld: /tmp/cc78Gls8.o: in function `TObject::operator new(unsigned long)':
decode.cpp:(.text._ZN7TObjectnwEm[_ZN7TObjectnwEm]+0x18): undefined reference to `TStorage::ObjectAlloc(unsigned long)'
collect2: error: ld returned 1 exit status

Afterwards, I compiled source version of root 6.26.06 on ubuntu 22 with command:

mkdir obj
cd obj
cmake ..
make

I got errors:

[ 53%] Linking CXX shared library ../../lib/libGraf.so
/usr/bin/ld: ../../FREETYPE-prefix/src/FREETYPE/objs/.libs/libfreetype.a(sfnt.o): in function `sfnt_init_face':
sfnt.c:(.text+0x1173a): undefined reference to `BrotliDecoderDecompress'

Could any one help. Thanks!!


ROOT Version: 6.26.06
Platform: ubuntu 22.04.1 LTS
Compiler: gcc11.3.0


`root-config --cxx --cflags` -I. decode.cpp `root-config --glibs`
1 Like

Thanks. It is solved!

(The reason for the original compilation error is that in g++ libraries need to be listed after the translation units that need them, so $(root-config --glibs) has to go last. Your ROOT installation with pre-built binaries is ok.)

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