How to install GSL on linux (ubuntu)
来源:互联网 发布:许佳琪吴哲晗吵架知乎 编辑:程序博客网 时间:2024/05/13 14:19
The GNU Scientific Library is an open source (GPL) library of useful routines for scientific and numerical computing. It will (should) build on ony system with an ANSI C compiler.
Using GSL on the department Linux machines
I did this istallation on atlas, which is running Linux on Intel and has gcc installed. Results may (but shouldn't) be different on one of the Sun machines like zeus.
the current version of GSL and place the file in your home directory. This tutorial assumes version 1.7, so change filenames as appropriate.
Unpack the file with the following command:
tar -zxvf gsl-1.7.tar.gzThis will create a directory called gsl-1.7 in your home directory. Change to this directory.
cd gsl-1.7The next step is to configure the installation and tell the system where to install the files. I have a directory called "dev" in my home directory that I use for this sort of thing. These instructions will install the files in the directory /home/steve/dev.
First, create the dev directory.
mkdir /home/steve/devNow configure the installation and tell it to use your new directory. This step may take a minute.
./configure --prefix=/home/steve/devIf there are no errors, compile the library. This step will take several minutes.
makeNow it is a good idea to test the library before actually installing it. Again, this step will take some time.
make checkIf there are no errors, go ahead and install the library.
make installNow we can write a test program to see if the library works. Create the following program and name it example.c
#include <stdio.h>#include <gsl/gsl_sf_bessel.h>intmain (void){ double x = 5.0; double y = gsl_sf_bessel_J0 (x); printf ("J0(%g) = %.18e/n", x, y); return 0;}Compile and link the program with the following commands (but use the correct path for your username):
gcc -Wall -I/home/steve/dev/include -c example.c
gcc -L/home/steve/dev/lib example.o -lgsl -lgslcblas -lmNow try running your program!
./a.outYou should get the following output:
J0(5) = -1.775967713143382920e-01Now that you have the GSL installed, you can remove the gsl-1.7 directory that was created in your home directory.
0 0
- How to install GSL on linux(ubuntu)
- How to install GSL on linux (ubuntu)
- How to install GSL on ubuntu
- How to install eclipse on ubuntu/linux
- How to Install Metasploit on Linux Ubuntu
- How to Install Scala 2.9.1 on Linux (Ubuntu 11.04) ?
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Oracle Java on Ubuntu Linux
- How to Install Oracle Java JDK on Ubuntu Linux
- How to install gcc-arm-linux-gnueabihf on Ubuntu 12.04
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Ubuntu Linux on your Dell PC
- How to Install Metasploit on Linux Ubuntu 14.04
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Fonts on Ubuntu
- How to install gCvs on ubuntu 10.04
- How to install p2psim on ubuntu.10.10
- How to install chrome on Ubuntu 10.10
- spring mvc json @ResponseBody 出现406错误 not acceptable ,解决方法,亲测可行
- sharedpreference中putStringSet和getStringSet的问题
- Qt:内建对话框
- php之字符串处理
- 杭电2072 单词数
- How to install GSL on linux (ubuntu)
- 【BZOJ】【P2258】【pku2758 Checking the Text 文本校对】【题解】【hash】
- Eclipse的命令行输入
- LauchMode页面加载模式
- poi读取excel带下拉框的单元格
- JQuery IE下如何阻止keydown事件冒泡
- 使用spring-remoting,解决HessianProtocolException: expected string at 0x6d
- 盘点冬季皮肤保养的十大陷阱
- 每日小记~10~11