Error from scons when linking

Hi all,

When I include the root include libraries in my program and compile using scons
I get the following linking error:

raw.o(.text+0x31e): In function __static_initialization_and_destruction_0': /home/users/step0ut/root/include/TVersionCheck.h:34: undefined reference toTVersionCheck::TVersionCheck(int)'
collect2: ld returned 1 exit status

The programs compiles and links cleanly without including root libraries, what could
it be wrong?

I was using a precompiled version of root before and thought that this was the problem,
but now I just install a fresh 5.20 version but still get this error.

“How one can reproduce your trouble?”

I know it takes some time of yours to describe … but I assume you want to get some answer don’t you?

In general it looks like you did not provide ROOT libraries. Just a guess. In my mind you did report such sort of problem recently.

Hi,

// So the simplest I could check is:

#include <stdio.h>
#include <TROOT.h>

int main(int argc, char **argv) {
printf(“Hello\n”);
}

//(and the file is stored as raw.cc)
//The SConstruct file looks like this:

env = Environment(CCFLAGS = “-pedantic -g -D_FILE_OFFSET_BITS=64 -I/home/users/step0ut/root/include -Wno-long-long”,)
env.Program([“raw.cc”,], LIBPATH = [".",’/home/users/step0ut/root/libs’])

//Without including the ROOT library compiles and runs fine. When switching it on I get:

scons: Reading SConscript files …
scons: done reading SConscript files.
scons: Building targets …
g++ -pedantic -g -D_FILE_OFFSET_BITS=64 -I/home/users/step0ut/root/include -Wno-long-long -c -o raw.o raw.cc
g++ -o raw raw.o -L. -L/home/users/step0ut/root/libs
raw.o(.text+0x162): In function __static_initialization_and_destruction_0': /home/users/step0ut/root/include/TVersionCheck.h:34: undefined reference toTVersionCheck::TVersionCheck(int)'
collect2: ld returned 1 exit status
scons: *** [raw] Error 1
scons: building terminated because of errors.

I must say that I am using scons for my first time so I would not be surprised if I
messed up there, however the fact when compiles g++ seems to get the right
locations for the includes and the linker for the libraries I cannot figure out what’s
wrong. I built ROOT from source in order to be sure that I am using the same
compiler.

Thanks,
Stefanos

[quote=“step0ut”]…
g++ -o raw raw.o -L. -L/home/users/step0ut/root/libs
…[/quote]You did not provide the list of the ROOT libraries.

[quote=“step0ut”]I must say that I am using scons for my first time [/quote] What about g++? Did you use it before with no scons to build the complex code?
At this point one expects to see something like this

g++ -o raw raw.o -L. `root-config --libs`Can you manage that with scons ?

…[/quote]You did not provide the list of the ROOT libraries.
Why not?
[/quote] What about g++? Did you use it before with no scons to build the complex code?
I 've used g++ with a Makefile a few hundred times.
I would not claim that I am an expert though.
In the makefiles I had indeed things like
-I$(shell root-config --cflags) and -L$(shell root-config --libs),
but I don’t know yet how to pass this in scons.
But when I type the root-config --libs
in the command line I do get the directory that I included, I don’t see the difference.

[quote=“step0ut”]Why not? [/quote]I do not know. You did not show the list. I guessed it is empty.[quote=“step0ut”]In the makefiles I had indeed things like
-I$(shell root-config --cflags) and -L$(shell root-config --libs),
[/quote]Does it :open_mouth: work? You need niether “-I” nor “-L”. You need just $(shell root-config --cflags) $(shell root-config --libs) because

~/> root-config --cflags -pthread -m32 -I$ROOTSYS/include[quote=“step0ut”]… when I type the root-config --libs
in the command line I do get the directory that I included, I don’t see the difference.[/quote] :unamused: This suggests some installation problem. You should see the $ROOTSYS/lib directory followed by the list of the libraries.
Something like this:

root-config --libs -L$ROOTSYS/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamicDid you say it provides you the empty list?

I probably messed up the installation from source because in my old precompiled version I do get the list of libraries.

[quote=“step0ut”]I probably messed up the installation from source because in my old precompiled version I do get the list of libraries.[/quote][quote=“fine”]Posted: Mon Sep 15, 2008 21:03 Post subject:
. . .
In general it looks like you did not provide ROOT libraries [/quote]