Symbol 'gsl_sf_bessel_J0' unresolved while linking [cling interface function]


_ROOT Version:ROOT 6.14/04
_Platform: Ubuntu Kylin 14.04
Compiler: Not Provided


Hi all , I’m trying to run The GNU Scientific Library ( GSL ) on root , so I updated my ROOT from 5.34/14 to 6.14//04 using cmake. I also made builtin_gsl:BOOL=ON by editing CMakeCache.txt.

Here is my test.c file (to check if GSL works)

#include “gsl/gsl_sf_bessel.h”

void test()
{
double x=5.0;
double y=gsl_sf_bessel_J0(x);
printf(“J0(%.3f)=%.3f\n”,x,y);
return 0;
}

When I was running the test.c on ROOT 5.34/14 which is not linked against shared libries fot GSL , I found the following error :

Error: Missing one of ’
/’ expected at or after line 29.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/gsl/gsl_mode.h:89:
*** Interpreter error recovered ***

Then I ran test.c on ROOT 6.14//04 (with GSL builtin) and a new error occured as follows:

root [0]
Processing qu.c…
IncrementalExecutor::executeFunction: symbol ‘gsl_sf_bessel_J0’ unresolved while linking [cling interface function]!

My question is whether it is due to the link between ROOT and GSL , or it concerns other factors , because it works with double y = 5.0; but failed to work with y=gsl_sf_bessel_J0(x).

Plus , I can see GSL folder in …/root-6.14/GSL-prefix/src/GSL .

In ROOT 5, you need to use ACLiC and you need to load the system provided gsl manually so, try:

root [0] gSystem->Load("/usr/lib/libgsl"); // load the system provided gsl
root [1] .x test.cxx++

In ROOT 6, there is no need to use ACLiC and your macro can automatically load the system provided gsl, if you add R__LOAD_LIBRARY(libgsl) right in the beginning of your macro.

If you have the “builtin_gsl” (i.e. when “root-config --has-builtin_gsl” returns “yes”), you may try:

root [0] gSystem->Load("libMathMore"); // force loading of the builtin_gsl
root [1] .x test.cxx

Note however that, you #include "gsl/gsl_sf_bessel.h" and this file will come from your system provided gsl, NOT from your ROOT’s “builtin_gsl” so, you will mix two different gsl versions. Expect problems.

It works now , thank you!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.