|
[Sponsors] |
May 9, 2012, 18:17 |
Linking GSL to OpenFOAM
|
#1 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Hi Foamers,
I need to use the GSL (Gnu Scientific Library) inside an OpenFOAM application to solve a system of complex linear equations. I want to use the GSL. I installed the libgsl0-dev as stated by the GSL manual. According to the manual one needs to link as: Code:
$ gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm Code:
EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I/usr/local/include \ -I/include EXE_LIBS = -lfiniteVolume LIB_LIBS = \ -lOpenFOAM \ -lmeshTools \ -lgsl -lgslcblas -lm Code:
Make/linux64GccDPOpt/seabed.o: In function `main': seabed.C:(.text+0x14be): undefined reference to `gsl_matrix_view_array' seabed.C:(.text+0x14d8): undefined reference to `gsl_vector_view_array' seabed.C:(.text+0x14e2): undefined reference to `gsl_vector_alloc' seabed.C:(.text+0x14ef): undefined reference to `gsl_permutation_alloc' seabed.C:(.text+0x150a): undefined reference to `gsl_linalg_LU_decomp' seabed.C:(.text+0x1525): undefined reference to `gsl_linalg_LU_solve' seabed.C:(.text+0x1561): undefined reference to `gsl_permutation_free' seabed.C:(.text+0x1569): undefined reference to `gsl_vector_free' collect2: ld returned 1 exit status make: *** [/home/hisham/OpenFOAM/hisham-2.0.1/platforms/linux64GccDPOpt/bin/seabed] Error 1 Any ideas? Best regards, Hisham El Safti |
|
May 9, 2012, 19:10 |
|
#2 |
New Member
Join Date: Apr 2010
Posts: 10
Rep Power: 16 |
Good evening Hisham,
my bet : missing library search path : Code:
.. .. .. LIB_LIBS = \ -lOpenFOAM \ -lmeshTools \ -L/usr/local/lib \ -lgsl -lgslcblas -lm Bandfrosch |
|
May 10, 2012, 03:07 |
|
#4 |
Senior Member
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18 |
Hi,
this worked for me without a problem. options: LIB_LIBS = \ -lgsl \ -lgslcblas Did you compile gsl yourself? Best Regards, Christian |
|
May 10, 2012, 03:38 |
|
#6 |
Senior Member
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18 |
Hi,
I use the provided gsl library from Ubuntu as well. Works without a problem for my case. I didn't need to define a path to the gsl library, the compiler found the it without the path. I'm not sure if this works, but could you try the following lines in the option file: -L/usr/local/lib -lgsl \ -L/usr/local/lib -lgslcblas \ Christian |
|
May 10, 2012, 04:18 |
|
#9 | |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17 |
Hi,
for me a simple Quote:
Arne |
||
May 10, 2012, 04:32 |
|
#11 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17 |
You're welcome. Greetings to Braunschweig.
|
|
March 11, 2015, 08:51 |
|
#13 |
Member
Join Date: Feb 2015
Posts: 31
Rep Power: 11 |
Hi dear Foamers,
I am having a similar problem with the link between gsl and OpenFOAM. The error in my compilation is the following: CombustionAddons/applications/generateILDM/Spline.C:70: undefined reference to `gsl_spline_free' CombustionAddons/applications/generateILDM/Spline.C:71: undefined reference to `gsl_interp_accel_free' on `Spline::interpolate(double)': CombustionAddons/applications/generateILDM/Spline.C:83: undefined reference to `gsl_spline_eval' on `Spline::create(int, std::map<double, double const*, std::less<double>, std::allocator<std:air<double const, double const*> > > const&)': CombustionAddons/applications/generateILDM/Spline.C:51: undefined reference to `gsl_interp_accel_alloc' CombustionAddons/applications/generateILDM/Spline.C:52: undefined reference to `gsl_interp_cspline' CombustionAddons/applications/generateILDM/Spline.C:52: undefined reference to `gsl_spline_alloc' CombustionAddons/applications/generateILDM/Spline.C:62: undefined reference to `gsl_spline_init' on `Spline::secondDerivative(double)': CombustionAddons/applications/generateILDM/Spline.C:108: undefined reference to `gsl_spline_eval_deriv2' I have already tried to solve with the inclusion of /usr/local/lib but the error is the same... any ideas? |
|
March 11, 2015, 09:29 |
|
#14 |
Senior Member
|
Hi,
Your error happens during compilation phase not during linking. Does your CombustionAddons/applications/generateILDM/Spline.C have the line Code:
#include <gsl/gsl_spline.h> Also maybe you should correct your options file to include -I flags pointing to include folder of GSL. |
|
March 11, 2015, 09:34 |
|
#15 |
Member
Join Date: Feb 2015
Posts: 31
Rep Power: 11 |
Hi,
in the header file that is included in Spline.C I have put the following include: #include <stdlib.h> #include <stdio.h> #include <math.h> #include "gsl/gsl_math.h" #include "gsl/gsl_errno.h" #include "/usr/local/include/gsl/gsl_spline.h" I think it is what you are thinking. Furthermore in the options file I have: EXE_INC = \ .. .. -I/usr/local/include/gsl \ EXE_LIBS= \ .. .. -L/usr/local/lib -lgsl \ -lgslcblas \ -lm \ I don't realy know which could be the problem! |
|
March 11, 2015, 09:41 |
|
#16 |
Senior Member
|
Hi,
This Code:
#include "gsl/gsl_math.h" #include "gsl/gsl_errno.h" #include "/usr/local/include/gsl/gsl_spline.h" Code:
#include "gsl/gsl_math.h" #include "gsl/gsl_errno.h" #include "gsl/gsl_spline.h" Code:
EXE_INC = \ .. .. -I/usr/local/include/gsl \ Code:
EXE_INC = \ .. .. -I/usr/local/include \ |
|
March 11, 2015, 09:43 |
|
#17 |
Senior Member
|
And post whole compilation log, maybe you are looking for the error in the wrong place.
|
|
March 11, 2015, 10:14 |
|
#18 |
Member
Join Date: Feb 2015
Posts: 31
Rep Power: 11 |
Hi and thanks for your answer.
I am trying your suggestions but i am having the same problems. As attachment you will find the resulting log file. |
|
March 11, 2015, 11:12 |
|
#19 |
Senior Member
|
Hi,
I guess you have got general problem with linking. GSL is just a tip of an iceberg, if you scroll log-file, you see there are errors while linking Cantera and gfortran libraries. As linking command is stuffed with this nice blob: Code:
-L/usr/local/cantera/lib:/usr/local/lib/octave-3.2.4:/usr/local/cantera/lib:/home/user/S oftware/sundials-2.3.0/installSundials/lib:/usr/local/cantera/lib:/home/foam/OpenFOAM-1.6-ext/OpenFO AM/OpenFOAM-1.6-ext/ThirdParty/cantera-1.7.0/installCantera/lib:/lib:/home/foam/OpenFOAM-1.6-ext/Ope nFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/ParaView-3.12.0/platforms/linux64GccDPOpt/lib/paraview-3. 12:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensourc e-src-4.7.4/platforms/linux64GccDPOpt/lib:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/Thir dParty/packages/scotch-5.1.10b/platforms/linux64GccDPOpt/lib:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/Op enFOAM-1.6-ext/ThirdParty/packages/libccmio-2.6.1/platforms/linux64GccDPOpt/lib:/home/foam/OpenFOAM- 1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/ParMGridGen-1.0/platforms/linux64GccDPOpt/lib: /home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/ParMetis-3.1.1/platforms/l inux64GccDPOpt/lib:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/metis-5 .0pre2/platforms/linux64GccDPOpt/lib:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/ThirdPart y/packages/mesquite-2.1.2/platforms/linux64GccDPOpt/lib:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOA M-1.6-ext/lib/linux64GccDPOpt/openmpi-1.4.3:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/Th irdParty/packages/openmpi-1.4.3/platforms/linux64GccDPOpt/lib:/home/user/OpenFOAM/user-1.6-ext/lib/l inux64GccDPOpt:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/site/1.6-ext/lib/linux64GccDPOpt:/home/foam/Open FOAM-1.6-ext/OpenFOAM/OpenFOAM-1.6-ext/lib/linux64GccDPOpt:/home/foam/OpenFOAM-1.6-ext/OpenFOAM/Open FOAM-1.6-ext/lib/linux64GccDPOpt/dummy;/usr/local/lib |
|
March 11, 2015, 11:32 |
|
#20 |
Member
Join Date: Feb 2015
Posts: 31
Rep Power: 11 |
Hi,
I perfectly agree with you. I am trying to compile the FGM code by Kroger but I am having strong problems both with cantera and gsl.. I don't know if you have any suggestions on these points! Thank you |
|
Tags |
complex, gnu, gsl, openfoam, scientific |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 05:36 |
Linking ALGLIB to OpenFOAM | Phicau | OpenFOAM Programming & Development | 6 | January 12, 2012 16:15 |
How to Install OpenFOAM on 64 Ubuntu 9.04 | hansel | OpenFOAM Installation | 62 | March 19, 2010 14:43 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 05:56 |
Adventure of fisrst openfoam installation on Ubuntu 710 | jussi | OpenFOAM Installation | 0 | April 24, 2008 14:25 |