GMP Install Instruction for Windows Platform

15 篇文章 0 订阅
6 篇文章 0 订阅
 

Currently Core Library (from v1.4) uses GNU Multiple Precision Arithmetic Library (GMP) as its low level big number package. GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. As GMP was originally designed to work under Unix platform, there is few information about how to compile and install under Windows platform. I wrote this page to help you simplify installation.

While there are many C/C++ compilers available under Windows Platform, I will only focus on the following 4 compilers/environments: Cygwin GCC, MinGW GCC, Visual C++ 6.0 and .Net which are freely available or widely used. If you have experiences on other compilers, please let me know.

To help your development, GMP 4.1 source distribution and pre-compiled libraries for these environments are provided here for download. It should work for Pentium III or above.

In the following, I assume that you want to download GMP to ${gmp_download}, build GMP at ${gmp_build}, and install GMP to ${gmp_install}

Cygwin & MinGW (Building static GMP library)

  • Cygwin is a free Unix-like environment, developed by Red Hat, for Windows. This environment is very stable and has no hidden overhead (unlike some other operating systems). All the common tools and functionality you expect in a Unix environment are available, including "make", "gcc", "gdb", etc. Installing GMP under Cygwin is very similar with the installations under other Unix platforms, e.g. Solaris and Linux, except that you cannot build static and shared libraries at the same time. Here is the detail instruction:
    1. Install latest Cygwin. Make sure that you choose to install "gcc", "m4" and "make" since the default installation doesn't include them.
    2. Download latest GMP from GNU MP to ${gmp_download}.
    3. Run "Cygwin Bash", unzip and untar GMP into ${gmp_build} using following command:
        cd ${gmp_build}
        tar xzvf ${gmp_download}/gmp-x.x.x.tar.gz
    4. Configure GMP for compilation:
        cd gmp-x.x.x
        ./configure --prefix=${gmp_install}
    5. Build GMP:
        make
    6. Install GMP header files and lib files:
        make install
  • MinGW is a collection of header files and import libraries combined with GNU toolsets that allow one to use GCC and produce native Win32 programs that do not rely on any 3rd-party DLLs, while the programs compiled under cygwin need a DLL named "cygwin1.dll". To provide a similar environment like cygwin, MSYS(Minimal SYStem) was created. If you have installed MSYS Version 1.0.7 or above, then the installation is as same as above cygwin environment:
    1. Install latest MinGW first, and then MSYS.
    2. Download latest GMP from GNU MP to ${gmp_download}.
    3. Run "MSYS", unzip and untar GMP into ${gmp_build} using following command:
        cd ${gmp_build}
        tar xzvf ${gmp_download}/gmp-x.x.x.tar.gz
    4. Configure GMP for compilation:
        cd gmp-x.x.x
        ./configure --prefix=${gmp_install}
    5. Build GMP:
        make
    6. Install GMP header files and lib files:
        make install
    For MSYS's earlier version, "make.exe" and "ranlib.exe" in MSYS will fail to process GMP's configure script. To fix this, you can download "make.exe" and "ranlib.exe" to overwrite your old version, then follow step 2-6.
  • For those who would like to use the Cygwin environment for development MinGW, you can follow these steps:
    1. Install latest Cygwin. Make sure that you choose to install "gcc", "m4" and "make" since the default installation doesn't include them.
    2. Install latest MinGW into ${mingw}.
    3. (For MinGW 2.0 earlier only) Rename MinGW's "make.exe" (${mingw}/bin/make.exe) to "mingw32-make.exe".
    4. Add ${mingw}/bin at the beginning of the environment variable PATH.
        export PATH=${mingw}/bin:$PATH (for bash, sh)
      or
        setenv PATH ${mingw}/bin:$PATH (for csh, tcsh)
    5. Download latest GMP from GNU MP to ${gmp_download}.
    6. Run "Cygwin Bash", unzip and untar GMP into ${gmp_build} using following command:
        cd ${gmp_build}
        tar xzvf ${gmp_download}/gmp-x.x.x.tar.gz
    7. Modify the "configure" script in GMP, change these lines (toward the end)
        # Make a symlink if possible; otherwise try a hard link.
        ln -s $ac_rel_source $ac_dest 2>/dev/null ||
          ln $srcdir/$ac_source $ac_dest ||
      to
        # Make a symlink if possible; otherwise try a hard link.
        #ln -s $ac_rel_source $ac_dest 2>/dev/null ||
          ln $srcdir/$ac_source $ac_dest ||
      (Add a comment on first "ln -s" so hard link are created instead of symbolic link)
    8. Configure GMP for compilation:
        cd gmp-x.x.x
        ./configure --build=pentium3-pc-mingw32 --prefix=${gmp_install}
      (replace "pentium3-pc" by your CPU type)
    9. Build GMP:
        make
    10. Install GMP header files and lib files:
        make install

Cygwin & MinGW (Building dynamic GMP library)

As I mentioned above, GMP cannot build static and shared libraries at the same time and it will only build static library by default. To use dynamic library, i.e DLL under windows platform, you need to add the options "--disable-static --enable-shared" when you configure GMP, i.e. run this command:

  ./configure --prefix=${gmp_install} --disable-static --enable-shared
A windows DLL "cyggmp-3.dll" (Cygwin) or "libgmp-3.dll" (MinGW) will be generated and you can link it with your executable programs as usual under Cygwin & MinGW except that when you run them, you have put these DLLs in some path which is listed in environment variable $PATH.

To ensure that these DLLs can be called by a Microsoft Visual C++ program, you must generate an import library (.lib) for them, using Microsoft LIB tool:

  cd gmp-x.x.x/.libs
  lib /machine:i386 /def:cyggmp-3.dll-def (for Cygwin) 
or
  
  lib /machine:i386 /def:libgmp-3.dll-def (for MinGW) 

Visual C++ 6.0 & Visual C++ .Net

In Core Library distribution, we provide patch files for building GMP library under Visual C++:

  1. Download latest GMP and unzip to ${gmp_build}
  2. Copy all files under patches/4.1-static (or patches/4.1-dynamic for building DLL) to ${gmp_build}
  3. Open gmp.dsw (gmp.vcproj for VC++.Net) to build GMP
  4. After building, you can use gmp.h, lib/gmp.lib, lib/gmpDebug.lib to build your GMP application. (If you build GMP DLL, then you need gmp.dll or gmpDebug.dll for runing your application.)

Enjoy!

--Zilin Du (zilin "at" cs.nyu.edu)

Last Update: Jan 12, 2006

http://cs.nyu.edu/exact/core/gmp/
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Cadence Xcelium Logic是一种逻辑仿真工具,用于设计和验证电子设计自动化(EDA)中的逻辑电路。下面是安装Cadence Xcelium Logic的教程: 步骤一:下载软件 首先,在Cadence官网上找到Xcelium Logic的安装程序,并下载到本地计算机中。 步骤二:解压文件 将下载的安装程序文件解压到指定的文件夹中。 步骤三:配置环境变量 在计算机中配置环境变量,使系统能够正确识别和调用Xcelium Logic。在环境变量中添加CADENCE_HOME变量,并将其值设置为Xcelium Logic的安装路径。 步骤四:安装依赖库 Xcelium Logic安装过程中可能需要一些依赖库的支持,因此需要根据系统要求安装相应的依赖库,并确保依赖库的版本与Xcelium Logic兼容。 步骤五:运行安装程序 找到解压后的安装程序文件夹,在终端中进入该文件夹,并运行安装命令。根据提示操作,选择安装路径和其他选项。等待安装程序完成。 步骤六:验证安装 安装完成后,通过在终端中输入xrun -v命令,验证Xcelium Logic是否成功安装。如果终端输出Xcelium Logic的版本信息,则表示安装成功。 总结: 以上是安装Cadence Xcelium Logic的基本步骤。根据实际情况,可能还需要进行其他的配置和设置,在安装过程中仔细阅读文档和遵循提示,确保安装正确完成。安装完成后,可以使用Xcelium Logic进行逻辑电路的设计和验证工作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值