zoukankan      html  css  js  c++  java
  • How to install GSL on linux(ubuntu,centos,redhat)

    Test:

    ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz  success.

    ftp://ftp.gnu.org/gnu/gsl/gsl-1.13.0.tar.gz  failed.

    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.

    download:

    ftp://ftp.gnu.org/gnu/gsl/

    wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.7.tar.gz

    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.gz

    This will create a directory called gsl-1.7 in your home directory. Change to this directory.

    cd gsl-1.7

    The 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/yourname/dev

    Now configure the installation and tell it to use your new directory. This step may take a minute.

    ./configure --prefix=/home/yourname/dev

    If there are no errors, compile the library. This step will take several minutes.

    make

    Now it is a good idea to test the library before actually installing it. Again, this step will take some time.

    make check

    If there are no errors, go ahead and install the library.

    make install

    Now 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>

    int
    main (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 -lm

    Now try running your program!

    ./a.out

    You should get the following output:

    J0(5) = -1.775967713143382920e-01

    Now that you have the GSL installed, you can remove the gsl-1.7 directory that was created in your home directory.

    ====================================================

    [root@centos gsl.1.13.0]# ./configure --prefix /root/.opam/4.00.1
    make: gsl-config: Command not found
    ocaml do_const.ml --mli > lib/const.mli
    /bin/sh: gsl-config: command not found
    Exception: End_of_file.
    make: *** [post-conf] Error 2
    E: Failure("Command 'make post-conf' terminated with error code 2")

  • 相关阅读:
    魔兽争霸3 冰封王座 w3g文件如何打开
    魔兽争霸3怎么玩
    笔记本电脑 联想 Thinkpad E420 无法打开摄像头怎么办
    笔记本能连上WIFI网络,但是无法上网怎么办
    佳能打印机 打不出黑色怎么办
    佳能打印机 出现5100错误怎么办
    UG如何把语言改成中文,UG如何把界面语言改成中文
    [Spring] Spring Data JPA
    基于控制权限和登录验证跳转的django登录界面的实现
    windows环境下nutch2.x 在eclipse中实现抓取数据存进mysql详细步骤
  • 原文地址:https://www.cnblogs.com/emanlee/p/3318337.html
Copyright © 2011-2022 走看看