[ROOT] Trouble with user libraries under Mac OSX (Darwin)

From: Stephen Sanders (ssanders@ku.edu)
Date: Fri Sep 06 2002 - 02:19:14 MEST


Hi,
I am attempting to port the BRAT program of the BRAHMS
Collaboration at RHIC to Darwin.  The entire BRAT system  builds fine, 
but I'm
having trouble linking in the brat classes with CINT so that they
are available without doing an explicit gSystem->Load().   Instead,
I get errors of the sort shown below. I have set DYLD_LIBRARY_PATH to 
include
the location of my shared libraries.  I am also able to  explicitly load 
the user classes.
The root classes can be accessed fine.
The code and appropriately modified build instructions do work on linux 
systems.
----------------

brat [0] Foo * foo = new Foo()    <---ON LINUX SYSTEMS THIS WORKS
Error: Symbol Foo is not defined in current scope  
FILE:/var/tmp/tmp.2.012580_cint LINE:1
Error: Symbol Foo is not defined in current scope  
FILE:/var/tmp/tmp.2.012635_cint LINE:1
Error: type Foo not defined FILE:/var/tmp/tmp.2.012635_cint LINE:1
Warning: Automatic variable Foo* foo allocated in global scope 
FILE:/var/tmp/tmp.2.012635_cint LINE:1
Error: Undeclared variable Foo* foo FILE:/var/tmp/tmp.2.012635_cint 
LINE:1
*** Interpreter error recovered ***

brat [1] gSystem->Load("foo")    <----THIS WORKS
(int)0
brat [2] Foo * foo = new Foo("a","a")
a
-------------------------
If I start the TRint derived main program in gdb,
I am able to set breakpoints on the user class Foo,
but autocompletion does not return the argument lists:

[kunuc5:~/Documents/foo] sanders% gdb ~/bin/bratroot
This GDB was configured as "powerpc-apple-macos10".
Reading symbols for shared libraries .. done
(gdb) break main
Breakpoint 1 at 0x2854
(gdb) run
Starting program: /Users/sanders/bin/bratroot
[Switching to process 12624 thread 0x1603]
Reading symbols for shared libraries ................... done

Breakpoint 1, 0x00002868 in main ()
(gdb) break Foo::Foo
Breakpoint 2 at 0x10ce228
(gdb)
---------------------------------------------------------------

To test the system, I've built a simple library libfoo with a single 
class Foo. This
is linked to a TRint derived class BrRint as shown below: (I've supplied 
links to the
actual programs.) Again, I've moved this to a linux system, commented 
out the MODULE
stuff, and everything works as it should.

----------------------------------------------------------------
AM_CPPFLAGS = -O -pipe -fPIC -I/usr/local/include/root 
-I/usr/X11R6/include -I/usr/X11R6/include/X11
ROOTLIBS=-L/usr/local/lib/root -lCore -lCint -lHist -lGraf -lGraf3d 
-lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lm -ldl
XLIBS= -L/usr/X11R6/lib -lRint -lSM -lICE -lX11 -lXpm


LIBNAME =libfoo.la
MODULE  =foo.la

pkglib_LTLIBRARIES = $(LIBNAME) $(MODULE)
pkginclude_HEADERS = "http://www.phsx.ukans.edu/~sanders/foo/foo.h"

libfoo_la_SOURCES = "http://www.phsx.ukans.edu/~sanders/foo/foo.cxx" 
foodict.cxx
libfoo_la_LDFLAGS = -ldl -lm  -R$(HOME)/Documents/foo/.libs

foo_la_SOURCES = $(libfoo_la_SOURCES)
foo_la_LDFLAGS = -module -Xlinker -bind_at_load $(ROOTLIBS) 
-R$(HOME)/Documents/foo/.libs


bin_PROGRAMS		= bratroot
bratroot_LDADD		= -lRint libfoo.la
bratroot_LDFLAGS	= -Xlinker -bind_at_load $(ROOTLIBS) $(XLIBS)
bratroot_SOURCES	= 
"http://www.phsx.ukans.edu/~sanders/foo/BrRintMain.cxx"          \
			  "http://www.phsx.ukans.edu/~sanders/foo/BrRint.cxx" 
"http://www.phsx.ukans.edu/~sanders/foo/BrRint.h" 	  \
			  BrRintDict.h BrRintDict.cxx

CLEANFILES = *Dict.*
%dict.cxx %dict.h:%.h
	rootcint -f $*dict.cxx -c -p $(AM_CPPFLAGS) $< $*Include.h $*LinkDef.h
%Dict.cxx %Dict.h:%.h
	rootcint -f $*Dict.cxx -c $(AM_CPPFLAGS) $<

-----------------------------------------------------------------------------------------------------------------------------------
The resulting  Makefile is:  
"http://www.phsx.ukans.edu/~sanders/foo/Makefile"
The log of the make operation is at : 
"http://www.phsx.ukans.edu/~sanders/foo/make.log"

Any suggestions?  Has anyone been successful getting someting like this 
to work
under Darwin?

Thanks for any help...

Steve



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:07 MET