Re: [Fwd: [ROOTDEV] undefined symbols]

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Thu, 14 Jan 2010 01:41:03 +0100


Hi Christian,

   when you are on a 64-bit Mac you have to explicitly specify that you want to link a 32-bit binary. So add -m32 to your g++ test.run link statement. Now it tries to link for 64-bit but finds only 32-bit libraries.

Cheers, Fons.

PS: if you are on a 64-bit Mac use the 64-bit MacOS build as it will run faster than the 32-bit version.

>
> Subject:
> [ROOTDEV] undefined symbols
> From:
> Christian Hansen <christian.hansen_at_cern.ch>
> Date:
> Wed, 13 Jan 2010 13:28:05 +0100
> To:
> roottalk <rootdev_at_root.cern.ch>, <roottalk_at_root.cern.ch>
>
> To:
> roottalk <rootdev_at_root.cern.ch>, <roottalk_at_root.cern.ch>
>
>
> Dear rooters,
>
> I'm trying to link root in a compilable program. I have managed this before with the Makefile
> in the attachment. But now I get these compilation errors:
>
> device2-1:TEST chris$ make
> Building test.run ....
> g++ -L/Users/chris/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lfreetype -pthread -Wl,-rpath,/Users/chris/root/lib -lm -ldl -lMinuit -L/Users/chris/TEST test.o -L/Users/chris/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lfreetype -pthread -Wl,-rpath,/Users/chris/root/lib -lm -ldl -lMinuit -o test.run
> ld: warning: in /Users/chris/root/lib/libCore.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libCint.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libRIO.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libNet.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libHist.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libGraf.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libGraf3d.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libGpad.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libTree.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libRint.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libPostscript.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libMatrix.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libPhysics.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libMathCore.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libThread.so, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libfreetype.a, file is not of required architecture
> ld: warning: in /Users/chris/root/lib/libMinuit.so, file is not of required architecture
> ld: warning: in test.o, file is not of required architecture
> Undefined symbols:
> "_main", referenced from:
> start in crt1.10.6.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make: *** [test.run] Error 1
>
>
> Here is the gcc version I'm using:
>
> device2-1:TEST chris$ g++ -v
> Using built-in specs.
> Target: i686-apple-darwin10
> Configured with: /var/tmp/gcc/gcc-5646.1~2/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
> Thread model: posix
> gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)
>
>
> Here is the root I'm using:
>
> device2-1:TEST chris$ root
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 5.26/00 14 December 2009 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
> ROOT 5.26/00 (trunk_at_31882, Dec 14 2009, 20:18:36 on macosx)
> CINT/ROOT C/C++ Interpreter version 5.17.00, Dec 21, 2008
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0]
>
>
> If I only do
>
> g++ test.cpp
>
> it compiles of course and I can run the executable. So the problem only comes when I
> try to link in ROOT. Could anyone give me a hint to why I get these compilation errors?
>
> Best regards
> /Christian
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640
Received on Thu Jan 14 2010 - 01:41:07 CET

This archive was generated by hypermail 2.2.0 : Thu Jan 14 2010 - 11:50:01 CET