Librerias¶
Instalación de librerías.
Librería gls¶
Para instalar la librería gls
[root@hope ~]# cd /export/apps/src/
[root@hope src]# wget http://gnu.c3sl.ufpr.br/ftp/gsl/gsl-2.6.tar.gz
[root@hope src]# gunzip -c gsl-2.6.tar.gz | tar -xvof -
[root@hope gsl-2.6]# cd gsl-2.6
[root@hope gsl-2.6]# ./configure --prefix=/share/apps
[root@hope gsl-2.6]# make
[root@hope gsl-2.6]# make install
[root@hope gsl-2.6]# make clean
Lo que falta ahora es configurar el directorio ld
[root@hope ~]# echo "/export/apps/lib" >> /etc/ld.so.conf.d/gsl.conf
[root@hope ~]# ldconfig
Para testear que todo esté funcionando creamos el archivo testgsl.c
#include <gsl/gsl_sf_trig.h>
#include <stdio.h>
int main(void){
double x,dx;
gsl_sf_result y;
x=1;
dx=0.1;
gsl_sf_sin_err_e(x,dx,&y);
printf("sin(%lf+/-%lf) = %lf+/-%lf\n",x,dx,y.val,y.err);
}
[hopeadmin@hope ~]$ gcc -I/share/apps/include -c testgsl.c -o testgsl.o
[hopeadmin@hope ~]$ gcc testgsl.o -L/share/apps/lib -lgslcblas -lgsl -o testg
sl.out
[hopeadmin@hope ~]$ ldd testgsl.out
linux-vdso.so.1 => (0x00007fffa432d000)
libgslcblas.so.0 => /export/apps/lib/libgslcblas.so.0 (0x00007ffab5ded000)
libgsl.so.25 => /export/apps/lib/libgsl.so.25 (0x00007ffab5920000)
libc.so.6 => /lib64/libc.so.6 (0x0000003911400000)
libm.so.6 => /lib64/libm.so.6 (0x0000003911800000)
/lib64/ld-linux-x86-64.so.2 (0x0000003911000000)
[hopeadmin@hope ~]$ ./testgsl.out
sin(1.000000+/-0.100000) = 0.841471+/-0.054030
Para compilar sin tener que pasar tantos argumentos
[hopeadmin@hope ~]$ export CPATH=/share/apps/include
[hopeadmin@hope ~]$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/apps/lib
[hopeadmin@hope ~]$ export LIBRARY_PATH=/export/apps/lib
[hopeadmin@hope ~]$ gcc -lgslcblas -lgsl testgsl.c -o testgsl.out