Using gsl_bspline

I was trying to implement B-splines to fit histograms, and I found that there is a solution in the GSL.
First of all, I installed GSL using Synaptic ( I’m on Ubuntu 14.04 LTS ). After that I re-installed ROOT with --enabled-gsl-shared and --with-gsl-incdir/libdir prefixes.
To test this configuration I simply copied this program ( and turned it into a macros. It didn’t work and I got this error:

cannot open file "gsl/gsl_bspline.h" <path>/spline_gsl/spline_gsl.cxx:5:
I tried to use the full path of all .h in the header, but it didn’t help.
Next step: I found and followed these instructions ([url]Using GSL in ROOT
Like this:

root [1] gSystem->Load("/usr/local/lib/"); root [2] gSystem->Load("/usr/local/lib/"); root [3] gSystem->SetIncludePath("-I /usr/local/include/gsl"); root [4] gROOT->ProcessLine(".L /usr/local/include/gsl/gsl_bspline.h"); Error: cannot open file "gsl/gsl_math.h" /usr/local/include/gsl/gsl_bspline.h:26: *** Interpreter error recovered *** root [5] gROOT->ProcessLine(".L /usr/local/include/gsl/gsl_math.h"); Error: cannot open file "gsl/gsl_sys.h" /usr/local/include/gsl/gsl_math.h:24: *** Interpreter error recovered *** root [6] gROOT->ProcessLine(".L /usr/local/include/gsl/gsl_sys.h");
After that line error messages became incomprehensible.

Error: Missing one of ' \/' expected at or after line 26. Error: Unexpected end of file (G__fgetstream():2) /usr/local/include/gsl/gsl_sys.h:64: Error: extern"C"{__BEGIN_DECLSdoublegsl_log1p(constdoublex)doublegsl_expm1(constdoublex)doublegsl_hypot(constdoublex,constdoubley)doublegsl_hypot3(constdoublex,constdoubley,constdoublez)doublegsl_acosh(constdoublex)doublegsl_asinh(constdoublex)doublegsl_atanh(constdoublex)intgsl_isnan(constdoublex)intgsl_isinf(constdoublex)intgsl_finite(constdoublex)doublegsl_nan(void)doublegsl_posinf(void)doublegsl_neginf(void)doublegsl_fdiv(constdoublex,constdoubley)doublegsl_coerce_double(constdoublex)floatgsl_coerce_float(constfloatx)longdoublegsl_coerce_long_double(constlongdoublex)doublegsl_ldexp(constdoublex,constinte)doublegsl_frexp(constdoublex,int*e)intgsl_fcmp(constdoublex1,constdoublex2,constdoubleepsilon)__END_DECLS Syntax error? /usr/local/include/gsl/gsl_sys.h:64:
I’m lost, where did I go wrong? What else should I include?

Okay, I found the solution:

  1. Open ~/.rootrc
  2. Add this line: Rint.Logon: ~/rootlogon.C
  3. Create ~/rootlogon.C with the following text:

void rootlogon.C ( void ) { gSystem->SetIncludePath("-I/usr/local/include"); gSystem->Load("/usr/local/lib/"); gSystem->Load("/usr/local/lib/"); }
NB: path to these libraries may be different.
4. Execute your script:

Don’t forget the “+” in the end!
All of these will tell root to load your libraries and link them using ACLIC.

Be free to correct me if there’s a simpler way or I’ve mistaken somewhere.