且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用cygwin在Windows上安装GMP

更新时间:2023-12-03 22:40:46

欢迎使用***(SO).

Welcome to *** (SO).

GMP的源目录应该包含名为configure的文件.这是您必须在环境中执行"configure" 构建系统的脚本.这意味着在配置期间 Autotools (用于构建GMP的构建系统)将收集有关您的环境并生成相应的makefile.收集信息包括以下内容:了解您在Windows上,了解您正在使用Cygwin,了解您的编译器是 GCC 及其版本为xyz等.所有这些步骤对于成功构建都很重要.

The source directory of GMP should probably contain the file called configure. This is the script which you have to execute to "configure" the build system in your environment. It means that during configuration Autotools (the build system which is used to build GMP) will gather information about your environment and generate the appropriate makefile. Gathering information includes things like: understanding that you are on Windows, understanding that you are using Cygwin, understanding that your compiler is GCC and its version is x.y.z, and etc. All these steps are important for successful build.

您可以为此configure脚本指定很多不同的选项,以调整配置过程.在您的情况下,您可以指定prefix选项,该选项确定安装目录,即您希望已构建的即用型GMP发行版驻留的目录.例如:

You can specify a lot of different options to this configure script to tweak the configuration process. In your case, you specify the prefix option which determines the installation directory, i.e. the directory where you want the built and ready-to-use GMP distribution to reside. For example:

./configure --prefix=/D/Libraries/GMP

将配置构建系统以将GMP二进制文件安装到D:\Libraries\GMP目录.

will configure the build system to install the GMP binaries to D:\Libraries\GMP directory.

假设GMP源目录(从*.tar提取的目录)位于D:\Users\Me\Downloads\GMP,为了构建和安装GMP,您应该执行以下操作:

Assuming that the GMP source directory (the one you extracted from *.tar) is located at say D:\Users\Me\Downloads\GMP, in order to build and install GMP you should do the following:

cd /D/Users/Me/Downloads/GMP
./configure --prefix=/D/Libraries/GMP
make
make install

注意: make命令实际上将执行我前面提到的makefile(由configure脚本生成).该文件描述了在系统上构建和安装GMP的过程.

NOTE: The make command will actually execute the makefile (which was generated by configure script) I've mentioned earlier. This file describes the process of building and installing GMP on your system.

注意: ${gmp_install}没什么,只是一个环境变量.例如,您可以这样做:

NOTE: ${gmp_install} is nothing, but an environment variable. For instance, you could do:

export gmp_install=/D/Libraries/GMP
./configure --prefix=${gmp_install}

这很有用,例如,当您必须在多个地方使用同一路径并且不想每次都键入它时.在其他情况下,这很有用,但为此您必须学习有关环境变量的信息,它们的用途,以及一般的 Bash 脚本.但是,所有这些远远超出了您问题的答案.

this can be useful, for example, when you have to use the same path in multiple places, and don't want to type it everytime. There are other cases, when this is useful, but for that you'll have to learn more about environment variables, what they are for, and Bash scripting in general. However, all this goes far beyond the answer on your question.

您将不得不花一些时间来理解所有这些内容以及它们如何组合在一起,并且您可能不得不在SO上提出更多问题,因为仅对于初学者而言,理解所有这些内容可能会非常具有挑战性.

You'll have to spend quite some time to understand all these things and how they fit together, and you'd probably have to ask more questions here on SO as understanding all that stuff for a beginner alone might be very challenging.