Hi,
I am trying to build an executable using static libs in order to make
the executable ready to use on some machines where ROOT is not installed.
I have build libRoot.a using
[/usr/share/root/ ] make static
I use the following Makefile to build my code
LIBS:=`root-config --libs`
INCS:=`root-config --cflags`
default: foo
foo: bskStat.cc foo.cc
g++ -static -O2 -o $@ $(ROOTSYS)/lib/libRoot.a -I$(ROOTSYS)/include $^
clean:
rm -f *.o *.so foo *~ bskDict.*
bskStat.cc contains a class used by foo.cc
I get errors when I try to build the code (eroor log is reported below) .
May someone halp me to fix the problem?
Thanks
Pietro
g++ -static -O2 -o foo /usr/share/root_v5.26.00/lib/libRoot.a -I/usr/share/root_v5.26.00/include bskStat.cc foo.cc
/tmp/ccaSLPOd.o: In function bskStat::_CheckDirs()': bskStat.cc:(.text+0x7): undefined reference to
gSystem’
bskStat.cc:(.text+0x1f): undefined reference to gSystem' bskStat.cc:(.text+0x37): undefined reference to
gSystem’
/tmp/ccaSLPOd.o: In function global constructors keyed to _ZN7bskStatC2EPKc': bskStat.cc:(.text+0x296): undefined reference to
TVersionCheck::TVersionCheck(int)’
/tmp/ccaSLPOd.o: In function bskStat::_1Plot(char const*, char const*)': bskStat.cc:(.text+0x823): undefined reference to
TStorage::ObjectAlloc(unsigned int)‘
bskStat.cc:(.text+0x859): undefined reference to TH1F::TH1F(char const*, char const*, int, double, double)' bskStat.cc:(.text+0x975): undefined reference to
TH1::GetXaxis() const’
bskStat.cc:(.text+0x990): undefined reference to TH1::GetXaxis() const' bskStat.cc:(.text+0x9ac): undefined reference to
TH1::GetXaxis() const’
bskStat.cc:(.text+0x9c8): undefined reference to TH1::GetXaxis() const' bskStat.cc:(.text+0x9ec): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0xa07): undefined reference to TH1::GetYaxis() const' bskStat.cc:(.text+0xa23): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0xb7f): undefined reference to TObject::operator delete(void*)' /tmp/ccaSLPOd.o: In function
bskStat::_2Plot(std::basic_string<char, std::char_traits, std::allocator >, char const*)’:
bskStat.cc:(.text+0xc63): undefined reference to TStorage::ObjectAlloc(unsigned int)' bskStat.cc:(.text+0xcaf): undefined reference to
TH2I::TH2I(char const*, char const*, int, double, double, int, double, double)‘
bskStat.cc:(.text+0xdb9): undefined reference to TH1::GetXaxis() const' bskStat.cc:(.text+0xddd): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0xe01): undefined reference to TH1::GetYaxis() const' bskStat.cc:(.text+0xe24): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0xe47): undefined reference to TH1::GetYaxis() const' bskStat.cc:(.text+0xe6a): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0xe8d): undefined reference to TH1::GetXaxis() const' bskStat.cc:(.text+0xea8): undefined reference to
TH1::GetYaxis() const’
bskStat.cc:(.text+0x10dc): undefined reference to TObject::operator delete(void*)' /tmp/ccaSLPOd.o: In function
bskStat::PrintPlots(std::basic_string<char, std::char_traits, std::allocator >, std::basic_string<char, std::char_traits, std::allocator >)’:
bskStat.cc:(.text+0x11f9): undefined reference to TStorage::ObjectAlloc(unsigned int)' bskStat.cc:(.text+0x121f): undefined reference to
TCanvas::TCanvas(char const*, char const*, int)‘
bskStat.cc:(.text+0x16c3): undefined reference to TStorage::ObjectAlloc(unsigned int)' bskStat.cc:(.text+0x16e9): undefined reference to
TCanvas::TCanvas(char const*, char const*, int)‘
bskStat.cc:(.text+0x1d3f): undefined reference to TObject::operator delete(void*)' bskStat.cc:(.text+0x1da3): undefined reference to
TObject::operator delete(void*)’
/tmp/ccaSLPOd.o: In function bskStat::Init()': bskStat.cc:(.text+0x3e78): undefined reference to
TStorage::ObjectAlloc(unsigned int)‘
bskStat.cc:(.text+0x3ea2): undefined reference to TFile::TFile(char const*, char const*, char const*, int)' bskStat.cc:(.text+0x3f93): undefined reference to
TStorage::ObjectAlloc(unsigned int)‘
bskStat.cc:(.text+0x3fad): undefined reference to TTree::TTree(char const*, char const*, int)' bskStat.cc:(.text+0x3fc4): undefined reference to
TDataType::GetType(std::type_info const&)‘
bskStat.cc:(.text+0x3fd3): undefined reference to TBuffer::GetClass(std::type_info const&)' bskStat.cc:(.text+0x4019): undefined reference to
TDataType::GetType(std::type_info const&)‘
bskStat.cc:(.text+0x4028): undefined reference to TBuffer::GetClass(std::type_info const&)' bskStat.cc:(.text+0x406e): undefined reference to
TDataType::GetType(std::type_info const&)‘
bskStat.cc:(.text+0x407d): undefined reference to TBuffer::GetClass(std::type_info const&)' bskStat.cc:(.text+0x418a): undefined reference to
TObject::operator delete(void*)’
/tmp/ccaSLPOd.o: In function TCanvasImp::IsA() const': bskStat.cc:(.text._ZNK10TCanvasImp3IsAEv[TCanvasImp::IsA() const]+0x8): undefined reference to
TCanvasImp::Class()’
/tmp/ccaSLPOd.o:(.rodata._ZTV10TCanvasImp[vtable for TCanvasImp]+0x7c): undefined reference to TCanvasImp::ShowMembers(TMemberInspector&, char*)' /tmp/ccaSLPOd.o:(.rodata._ZTV10TCanvasImp[vtable for TCanvasImp]+0x80): undefined reference to
TCanvasImp::Streamer(TBuffer&)’
/tmp/ccoA07Jp.o: In function global constructors keyed to main': foo.cc:(.text+0x16): undefined reference to
TVersionCheck::TVersionCheck(int)’
/tmp/ccoA07Jp.o: In function main': foo.cc:(.text+0x60): undefined reference to
gROOT’
foo.cc:(.text+0x74): undefined reference to TROOT::SetStyle(char const*)' foo.cc:(.text+0xb1): undefined reference to
TApplication::TApplication(char const*, int*, char**, void*, int)‘
foo.cc:(.text+0x111): undefined reference to gSystem' foo.cc:(.text+0x1f1): undefined reference to
TApplication::~TApplication()‘
foo.cc:(.text+0x5b7): undefined reference to TApplication::Run(bool)' foo.cc:(.text+0x868): undefined reference to
TApplication::~TApplication()’
/tmp/ccoA07Jp.o: In function TApplicationImp::IsA() const': foo.cc:(.text._ZNK15TApplicationImp3IsAEv[TApplicationImp::IsA() const]+0x8): undefined reference to
TApplicationImp::Class()’
/tmp/ccoA07Jp.o: In function TApplicationImp::~TApplicationImp()': foo.cc:(.text._ZN15TApplicationImpD1Ev[TApplicationImp::~TApplicationImp()]+0x17): undefined reference to
TString::~TString()’
/tmp/ccoA07Jp.o: In function TApplicationImp::~TApplicationImp()': foo.cc:(.text._ZN15TApplicationImpD0Ev[TApplicationImp::~TApplicationImp()]+0x17): undefined reference to
TString::~TString()’
/tmp/ccoA07Jp.o:(.rodata._ZTV15TApplicationImp[vtable for TApplicationImp]+0x3c): undefined reference to TApplicationImp::ShowMembers(TMemberInspector&, char*)' /tmp/ccoA07Jp.o:(.rodata._ZTV15TApplicationImp[vtable for TApplicationImp]+0x40): undefined reference to
TApplicationImp::Streamer(TBuffer&)'
collect2: ld returned 1 exit status
make: *** [foo] Error 1
biassoni@biassoni stat: