How to Install GMP in Ubuntu

转载自:http://www.ehow.com/how_8328719_install-gmp-ubuntu.html,

Although Ubuntu ships with its own implementation of the GNU Multiple Precision Arithmetic Library already installed, if you need the latest and most complete version of the software, you will need to download, compile and install it yourself. The compressed GMP archive contains all the source code and configuration utilities you need as well as a suite of demonstration programs you can build to test the libraries.

  • Download the latest stable version of GMP's source code from the developer's website using the link found in Resources.

  • Launch a Terminal session, extract the GMP archive's contents into the folder you downloaded it to and then set the extracted source code folder as your active directory. For example, if you downloaded the file "gmp-6.0.0a.tar.lz" from the GMP website, open the extracted "gmp-6.0.0" folder.

  • Build the makefile for GMP. The configure script will examine your system to see that all of GMP's hardware and software dependencies are met and then build the makefile that contains the compiler commands necessary to create binary library files. For example, if you are working with a new install of Ubuntu, the configure script will let you know that you need to install the M4 macro processor first. To build the makefile, type the following command at the command prompt and press "Enter:"

    ./configure

    If you need to install M4 or any other dependency, run the "./configure" command again.

  • Build GMP's binary library files with the Make command. Make compiles and links all the individual components of the GMP library. Type "make" at the command prompt and then press "Enter." Compilation may take awhile to complete. For example, GMP version 6.0 consists of 2581 individual files that must be pre-processes, compiled, assembled and linked.

  • Install GMP's libraries on your system. While you can compile GMP as a normal user, you will need root permission and the sudo command to install the libraries to your system. Type the following command at the terminal prompt, press "Enter," type your password and then press "Enter" to install GMP.

    sudo make install

    GMP's library files will be stored in the /usr/local/lib folder. The GMP library files that Ubuntu installs by default, however, remain /usr/lib/i386-linux-gnu/ on 32-bit systems or usr/lib/x86_64-linux-gnu/ on 64-bit systems. If a program you use needs the version of GMP you compiled, you will have to configure it to look for the libraries in the /usr/local/lib directory instead.

Tips & Warnings

  • Use the Make command to uninstall GMP if you don't want it available system-wide or you no longer need the libraries at all. GMP's makefile contains all the information needed to cleanly remove its files from your root directory. To uninstall GMP, move to the directory you compiled GMP within and then run the following command at the terminal prompt:
  • sudo make uninstall
  • Information in this article applies to Ubuntu 14.04 Trusty Tahr and GMP version 6.0.0. Procedures may vary with other versions of Ubuntu or GMP. The GMP package includes a "Check" utility that examines generated code for errors caused by your system's compiler. Before you run "make install" and add the GMP libraries to your production machine, run the following command at the terminal prompt:
  • make check

  • If no errors are reported, you can install GMP.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值