RE: [ROOT] ACLiC and GSL problem

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Sep 29 2003 - 21:16:19 MEST


> dlopen error: /path/to/gsltest_cpp.so: undefined symbol: gsl_rng_taus

To solve this problem you need to either load a the gsl shared library
or linked against the static version of the gsl library.

In your example, I assume that there is a library 'libgsl.so' and a
library libgslcblas.so.  Those needs to be loaded first (and if you
do then you wont have to add them to the ACLiC linked line by hand).

> I'd also like to be able to run the macro in non-interactive mode (i.e.
> from my shell command line rather than in CINT) -- how would I go about
> compiling/linking to the .so file and executing a function defined in it
> this way?

Just write a script containgin:
	gROOT->ProcessLine(".L gsltest.cpp+");
(or use TSystem->CompileMacro).

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Andy Buckley
Sent: Monday, September 29, 2003 8:12 AM
To: roottalk@cern.ch
Subject: [ROOT] ACLiC and GSL problem



Hi all,

I'm trying to use the GSL random number functions from a ROOT macro that
I'm compiling via ACLiC but without luck so far. The code I'm trying to
compile is like this:

--
#include <gsl/gsl_rng.h>
#include <iostream>

int main() {
  // GSL random number generator test
  double randno;
  gsl_rng* r = gsl_rng_alloc(gsl_rng_taus);
  for (int i=0; i<5; ++i) {
    randno = gsl_rng_get(r) / (gsl_rng_max(r) + 1.0);
    cout << randno << endl;
  }
  gsl_rng_free(r);

  return 0;
}
--

and I'm invoking ACLiC with these inputs to CINT:

--
TString libs = gSystem->GetLinkedLibs();
libs.Append(" -lgsl -lgslcblas");
gSystem->SetLinkedLibs(libs.Data());
.L gsltest.cpp+
--

which results in

--
dlopen error: /path/to/gsltest_cpp.so: undefined symbol: gsl_rng_taus
Load Error: Failed to load Dynamic link library /path/to/gsltest_cpp.so
*** Interpreter error recovered ***
--

Any suggestions? I can compile the same minimal test file with e.g.
g++ -o rngtest -lgsl -lgslcblas gsltest.cpp so there's no problem with
the system GSL setup as far as I can tell.

I'd also like to be able to run the macro in non-interactive mode (i.e.
from my shell command line rather than in CINT) -- how would I go about
compiling/linking to the .so file and executing a function defined in it
this way?

Thanks,
Andy

-- 
Andy Buckley, HEP Group, Cavendish Lab, Cambridge
http://www.insectnation.org


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET