[ROOT] ACLiC and GSL problem

From: Andy Buckley (buckley@hep.phy.cam.ac.uk)
Date: Mon Sep 29 2003 - 15:12:19 MEST


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