Hi, On Thu, 29 Aug 2002 16:51:48 -0400 Brett Viren <bv@bnl.gov> wrote concerning "Re: [ROOT] Problem w/ Shared Library": > Hi, > > It looks like you are missing the "-shared" flag when you create > your library. Another way to go about all this in a portable (on Un*x at least), is to use Autotools. I wrote a detailed example ones [1]. But see also the root-config(1) man(1) page. In essence, you create should have myproject -+- configure.ac (or configure.in for autoconf < 2.50) | +- Makefile.am | +- MyClass.hh | +- MyClass.cc | +- MyLinkDef.hh ... [Note that the last part of the file names are not really important. If you feel more comfortable with `.cxx' and `.h', use that. Some compiles may not recognise files ending in `.cc' as C++ source files, and will bark at you.] `configure.ac' contains: AC_INIT(My Project, 0.1, my@email, myproject) AC_PREREQ(2.53) AC_COPYRIGHT(GNU General Public License) AC_REVISION($Revision$) AC_CONFIG_SRCDIR(MyClass.hh) AM_INIT_AUTOMAKE([$PACKAGE_TARNAME], [$PACKAGE_VERSION]) AC_PROG_CXX AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL ROOT_PATH AC_CONFIG_FILES(Makefile) AC_OUTPUT Alternatively `configure.in': AC_INIT(MyClass.hh) AM_INIT_AUTOMAKE(myproject, 0.1) AC_PROG_CXX AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL ROOT_PATH AC_OUTPUT(Makefile) and `Makefile.am' AUTOMAKE_OPTIONS = gnu AM_CPPFLAGS = -I@ROOTINCDIR@ pkglib_LTLIBRARIES = libMyProject.la pkginclude_HEADERS = MyProject.hh noinst_HEADERS = MyLinkDef.hh libMyProject_la_SOURCES = MyProject.cc MyDictionary.cxx libMyProject_la_LDFLAGS = -version 0:0:0 %Dictionary.cc %Dictionary.h:$(pkginclude_HEADERS) %LinkDef.hh @ROOTCINT@ -f $*.cc -c $(AM_CPPLFAGS) $(INCLUDES) $^ Then do: prompt> aclocal # create aclocal.m4 - only needed once prompt> automake -a # create Makefile.in - only needed once prompt> autoconf # create configure - only needed once Now your source tree is ready to be configured and built. Do prompt> ./configure prompt> make prompt> make install This will install your stuff like: <prefix>/include/myproject/MyClass.hh <prefix>/lib/myproject/libMyProject.so.0.0.0 <prefix>/lib/myproject/libMyProject.so.0 -> libMyProject.so.0.0.0 <prefix>/lib/myproject/libMyProject.so -> libMyProject.so.0 <prefix>/lib/myproject/libMyProject.la <prefix>/lib/myproject/libMyProject.a where <prefix> per default is `/usr/local'. Choose your prefix by passing the `--prefix=<prefix>' option to `configure'. This will work on most Un*x systems, as well as MacOSX (with Fink [2]), and most like also Windoze (with Cygwin [3]) with a reasonably new set of autotools. See also the "Goat book" [4] from O'Reilly avaliable online [5] too. This will also work regardless of wether you have a ROOTSYS driven installation of ROOT, or if you have a fixed-directory install of ROOT. One caveat: If the file `root.m4' isn't in the path search by `aclocal' (usually /usr/share/aclocal), then you need to copy the contents of that file to acinclude.m4 in the `myproject' directory. `root.m4' can be found in the ROOT source tree in `build/misc/root.m4'. If you used a fixed-directory install with `--prefix=/usr' or installed ROOT as a Debian GNU/Linux or Red Hat package then `root.m4' is already in place, and you needn't do anything. If you intend to use your library only as a loadable module, modify the Makefile.am to read AUTOMAKE_OPTIONS = gnu AM_CPPFLAGS = -I@ROOTINCDIR@ pkglib_LTLIBRARIES = MyProject.la pkginclude_HEADERS = MyProject.hh noinst_HEADERS = MyLinkDef.hh MyProject_la_SOURCES = MyProject.cc MyDictionary.cxx MyProject_la_LDFLAGS = -module -avoid-version %Dictionary.cc %Dictionary.h:$(pkginclude_HEADERS) %LinkDef.hh @ROOTCINT@ -f $*.cc -c $(AM_CPPLFAGS) $(INCLUDES) $^ Yours, ____ | Christian Holm Christensen |_| | ------------------------------------------------------------- | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 _| Denmark Office: (+45) 353 25 305 ____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm | | [1] http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk01/1108.html?Tintin#first_hit [2] http://fink.sourceforge.net [3] http://www.cygwin.com/ [4] http://sources.redhat.com/autobook/ [5] http://sources.redhat.com/autobook/autobook/autobook.html
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET