GMP Install Instruction for Windows Platform
来源:互联网 发布:数据库详细设计文档 编辑:程序博客网 时间:2024/05/28 16:06
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.
- GMP 4.1 source distribution: gmp-4.1.tar.gz
- static GMP library and header file for Cygwin: gmp-static-cygwin-4.1.tar.gz
- static GMP library and header file for MinGW: gmp-static-mingw-4.1.tar.gz
- static GMP library and header file for Visual C++: gmp-static-vc-4.1.2.zip
- dynamic GMP library and header file for Cygwin: gmp-dynamic-cygwin-4.1.tar.gz
- dynamic GMP library and header file for MinGW: gmp-dynamic-mingw-4.1.tar.gz
- dynamic GMP library and header file for Visual C++: gmp-dynamic-vc-4.1.2.zip
- patches and project files
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:
- Install latest Cygwin. Make sure that you choose to install "gcc", "m4" and "make" since the default installation doesn't include them.
- Download latest GMP from GNU MP to ${gmp_download}.
- 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
- Configure GMP for compilation:
cd gmp-x.x.x ./configure --prefix=${gmp_install}
- Build GMP:
make
- 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:
- Install latest MinGW first, and then MSYS.
- Download latest GMP from GNU MP to ${gmp_download}.
- 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
- Configure GMP for compilation:
cd gmp-x.x.x ./configure --prefix=${gmp_install}
- Build GMP:
make
- Install GMP header files and lib files:
make install
- For those who would like to use the Cygwin environment for development MinGW, you can follow these steps:
- Install latest Cygwin. Make sure that you choose to install "gcc", "m4" and "make" since the default installation doesn't include them.
- Install latest MinGW into ${mingw}.
- (For MinGW 2.0 earlier only) Rename MinGW's "make.exe" (${mingw}/bin/make.exe) to "mingw32-make.exe".
- Add ${mingw}/bin at the beginning of the environment variable PATH.
export PATH=${mingw}/bin:$PATH (for bash, sh)
orsetenv PATH ${mingw}/bin:$PATH (for csh, tcsh)
- Download latest GMP from GNU MP to ${gmp_download}.
- 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
- 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) - Configure GMP for compilation:
cd gmp-x.x.x ./configure --build=pentium3-pc-mingw32 --prefix=${gmp_install}
(replace "pentium3-pc" by your CPU type) - Build GMP:
make
- 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-sharedA 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++:
- Download latest GMP and unzip to ${gmp_build}
- Copy all files under
patches/4.1-static
(orpatches/4.1-dynamic
for building DLL) to ${gmp_build} - Open
gmp.dsw
(gmp.vcproj
for VC++.Net) to build GMP - 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 needgmp.dll
orgmpDebug.dll
for runing your application.)
Enjoy!
--Zilin Du (zilin "at" cs.nyu.edu)
- GMP Install Instruction for Windows Platform
- MySql--Install For Windows
- MySql--Install For Windows
- Install Github for windows
- debian8 install instruction
- Platform SDK for Windows Xp & Windows 2003
- windows install lxml for scrapy
- win7 install solution for intel SKL and BSW platform
- Wine's instruction,install and configure【For Ubuntu Feisty (7.04)】【WorldofWarcraft's installation】
- How to Install GMP in Ubuntu
- ORBSLAM24Windows: ORBSLAM2 Project 4(for) Windows Platform
- Install boost on Windows for Visual C++
- oracle 11g R2 install for windows
- Install PEAR for windows appsrv 2.59
- Oracle 12c agent install for windows
- Window Platform Install Tool
- gmp 5.0.1 windows 下编译使用
- 学习笔记:安装流媒体服务器Catra Streaming Platform For Windows
- Cisco Callmanager介绍
- Android编译时java版本不对修改方法
- DHCPV4 VS DHCPV6
- windows phone 7 中怎样定义和使用资源(Resource)
- java调cmd命令
- GMP Install Instruction for Windows Platform
- sql server问题--单数据库实现和动态数据库实现
- 用Eclipse CDT 配置C/C++ 编译环境
- unix的sed 用法介绍
- Java获取客户端代码大全
- C++纯虚函数
- 离线安装WindowBuilder
- oracle: OCA-047-题解与实验(2)
- Cannot open precompiled header file: 'Release/BeastScaner.pch' 解决办法