草庐IT

windows - 在 Windows 32 位上构建 GMP

coder 2024-06-10 原文

您好,我正在尝试编译 gmp,因为我需要它用于 Perl 模块。我必须手动安装所有东西,因为机器无法访问 Internet。我在 GMP 文件夹中的 cygwin 中运行了配置并使用了这个命令:

./configure --prefix=C:\gmp --disable-static --enable-shared

现在这也没有问题,并且在我运行 make 时创建了 MAKEFILE:

$ make
gcc -std=gnu99 `test -f 'gen-fac.c' || echo './'`gen-fac.c -o gen-fac.exe
./gen-fac 32 0 >fac_table.h || (rm -f fac_table.h; exit 1)
gcc -std=gnu99 `test -f 'gen-fib.c' || echo './'`gen-fib.c -o gen-fib.exe
./gen-fib header 32 0 >fib_table.h || (rm -f fib_table.h; exit 1)
./gen-fib table 32 0 >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
gcc -std=gnu99 `test -f 'gen-bases.c' || echo './'`gen-bases.c -o gen-bases.exe -lm
./gen-bases header 32 0 >mp_bases.h || (rm -f mp_bases.h; exit 1)
./gen-bases table 32 0 >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
gcc -std=gnu99 `test -f 'gen-trialdivtab.c' || echo './'`gen-trialdivtab.c -o gen-trialdivtab.exe -lm
./gen-trialdivtab 32 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1)
gcc -std=gnu99 `test -f 'gen-jacobitab.c' || echo './'`gen-jacobitab.c -o gen-jacobitab.exe
./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
gcc -std=gnu99 `test -f 'gen-psqr.c' || echo './'`gen-psqr.c -o gen-psqr.exe -lm
./gen-psqr 32 0 >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
make  all-recursive
make[1]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp'
Making all in tests
make[2]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests'
Making all in .
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests'
make[3]: Für das Ziel »all-am« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests'
Making all in devel
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/devel'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/devel'
Making all in mpn
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpn'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpn'
Making all in mpz
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpz'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpz'
Making all in mpq
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpq'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpq'
Making all in mpf
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpf'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/mpf'
Making all in rand
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/rand'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/rand'
Making all in misc
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/misc'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/misc'
Making all in cxx
make[3]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/cxx'
make[3]: Für das Ziel »all« ist nichts zu tun.
make[3]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests/cxx'
make[2]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/tests'
Making all in mpn
make[2]: Entering directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/mpn'
/bin/sh ../libtool --tag=CC    --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I..  -DOPERATION_`echo fib_table | sed 's/_$//'`     -m32 -O2 -pedantic -fomit-frame-pointer -mtune=corei7 -march=corei7 -c -o fib_table.lo fib_table.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_fib_table -m32 -O2 -pedantic -fomit-frame-pointer -mtune=corei7 -march=corei7 -c fib_table.c  -DDLL_EXPORT -DPIC -o .libs/fib_table.o
In file included from ../gmp-impl.h:134:0,
                 from fib_table.c:4:
../gmp-mparam.h:1:1: error: expected identifier or '(' before '!' token
../gmp-mparam.h:1:1: error: stray '\377' in program
../gmp-mparam.h:1:1: error: stray '\376' in program
../gmp-mparam.h:1:14: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:16: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:18: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:20: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:22: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:24: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:26: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:28: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:30: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:32: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:34: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:36: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:38: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:40: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:42: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:44: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:46: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:48: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:50: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:52: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:54: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:56: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:58: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:60: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:62: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:64: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:66: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:68: warning: null character(s) ignored [enabled by default]
../gmp-mparam.h:1:70: warning: null character(s) ignored [enabled by default]
In file included from ../gmp-impl.h:144:0,
                 from fib_table.c:4:
e:\fagprogramme\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/inttypes.h:272:1: error: unknown type name 'wchar_t'
e:\fagprogramme\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/inttypes.h:273:29: error: unknown type name 'wchar_t'
e:\fagprogramme\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/inttypes.h:274:1: error: unknown type name 'wchar_t'
e:\fagprogramme\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/inttypes.h:275:9: error: unknown type name 'wchar_t'
Makefile:389: recipe for target `fib_table.lo' failed
make[2]: *** [fib_table.lo] Error 1
make[2]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp/mpn'
Makefile:833: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/cygdrive/e/FAGProgramme/Perl Modules/gmp'
Makefile:656: recipe for target `all' failed
make: *** [all] Error 2

现在我不知道该怎么办了。我也在没有任何参数的情况下尝试过它仍然给出相同的错误。

最佳答案

2 1/2 年后,但我也许可以为遇到类似问题的任何人(比如我!)回答这个问题。

打开一个 cygwin 终端,创建一个名为 hello.txt 的小文本文件并在其中放入少量文本,然后执行此命令:

ln -s hello.txt link.txt

现在,cat link.txt 将显示您的文本。但是,如果您进入 Windows,打开 Notebook 并从那里打开 link.txt,您会看到一些非常奇怪的字符。您可能会看到“hello.txt”。或者什么都没有。

这是因为 cygwin 的 ln 命令创建了一种只有 cygwin 知道如何处理的虚假链接。 Windows 和 Windows 程序不知道这是一个 cygwin 链接,所以它们只是打开文件并看到 cygwin 放在那里的假东西。

现在,如果您查看失败的命令:

/bin/sh ../libtool --tag=CC    --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I..  -DOPERATION_`echo fib_table | sed 's/_$//'`     -m32 -O2 -pedantic -fomit-frame-pointer -mtune=corei7 -march=corei7 -c -o fib_table.lo fib_table.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_fib_table -m32 -O2 -pedantic -fomit-frame-pointer -mtune=corei7 -march=corei7 -c fib_table.c  -DDLL_EXPORT -DPIC -o .libs/fib_table.o

您会看到 libtool 正在运行 gcc,并且 gcc 必须在某个时候尝试打开 gmp-mparam.h这是一个链接。因为它将它读取为垃圾而不是 gmp-mparam.h 链接到的内容,这一定意味着 gcc 正在使用某些 Windows 库来读取文件。因此,gcc 失败了。

此链接是在您运行 configure 时由 config.status 创建的。

现在,这样做:

rm link.txt
export CYGWIN=winsymlinks
ln -s hello.txt link.txt

现在 cat link.txt 和 Notebook 都应该显示 hello.txt 的内容。原因是设置 CYGWIN=winsymlinks 告诉 cygwin 创建 Windows 链接文件。在 Chapter 3 of the Cygwin User's Guide 中阅读有关 cygwin 链接的更多信息.

现在 CYGWIN 环境变量已设置,再次运行配置,它将使用“正确的”Windows 链接文件重新创建链接。

error: stray '\377' in program 问题以外的任何错误都有其他原因。

关于windows - 在 Windows 32 位上构建 GMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15972462/

有关windows - 在 Windows 32 位上构建 GMP的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby - 在 Windows 机器上使用 Ruby 进行开发是否会适得其反? - 2

    这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby​​-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub

  3. ruby - 在 Ruby 中构建长字符串的简洁方法 - 2

    在编写Ruby(客户端脚本)时,我看到了三种构建更长字符串的方法,包括行尾,所有这些对我来说“闻起来”有点难看。有没有更干净、更好的方法?变量递增。ifrender_quote?quote="NowthatthereistheTec-9,acrappyspraygunfromSouthMiami."quote+="ThisgunisadvertisedasthemostpopularguninAmericancrime.Doyoubelievethatshit?"quote+="Itactuallysaysthatinthelittlebookthatcomeswithit:themo

  4. Vscode+Cmake配置并运行opencv环境(Windows和Ubuntu大同小异) - 2

    之前在培训新生的时候,windows环境下配置opencv环境一直教的都是网上主流的vsstudio配置属性表,但是这个似乎对新生来说难度略高(虽然个人觉得完全是他们自己的问题),加之暑假之后对cmake实在是爱不释手,且这样配置确实十分简单(其实都不需要配置),故斗胆妄言vscode下配置CV之法。其实极为简单,图比较多所以很长。如果你看此文还配不好,你应该思考一下是不是自己的问题。闲话少说,直接开始。0.CMkae简介有的人到大二了都不知道cmake是什么,我不说是谁。CMake是一个开源免费并且跨平台的构建工具,可以用简单的语句来描述所有平台的编译过程。它能够根据当前所在平台输出对应的m

  5. STM32读取串口传感器数据(颗粒物传感器,主动上传) - 2

    文章目录1.开发板选择*用到的资源2.串口通信(个人理解)3.代码分析(注释比较详细)1.主函数2.串口1配置3.串口2配置以及中断函数4.注意问题5.源码链接1.开发板选择我用的是STM32F103RCT6的板子,不过代码大概在F103系列的板子上都可以运行,我试过在野火103的霸道板上也可以,主要看一下串口对应的引脚一不一样就行了,不一样的就更改一下。*用到的资源keil5软件这里用到了两个串口资源,采集数据一个,串口通信一个,板子对应引脚如下:串口1,TX:PA9,RX:PA10串口2,TX:PA2,RX:PA32.串口通信(个人理解)我就从串口采集传感器数据这个过程说一下我自己的理解,

  6. 深度学习部署:Windows安装pycocotools报错解决方法 - 2

    深度学习部署:Windows安装pycocotools报错解决方法1.pycocotools库的简介2.pycocotools安装的坑3.解决办法更多Ai资讯:公主号AiCharm本系列是作者在跑一些深度学习实例时,遇到的各种各样的问题及解决办法,希望能够帮助到大家。ERROR:Commanderroredoutwithexitstatus1:'D:\Anaconda3\python.exe'-u-c'importsys,setuptools,tokenize;sys.argv[0]='"'"'C:\\Users\\46653\\AppData\\Local\\Temp\\pip-instal

  7. ruby - 使用 rbenv 和 ruby​​-build 构建 ruby​​ 失败,出现 undefined symbol : SSLv2_method - 2

    我正在尝试在配备ARMv7处理器的SynologyDS215j上安装ruby​​2.2.4或2.3.0。我用了optware-ng安装gcc、make、openssl、openssl-dev和zlib。我根据README中的说明安装了rbenv(版本1.0.0-19-g29b4da7)和ruby​​-build插件。.这些是随optware-ng安装的软件包及其版本binutils-2.25.1-1gcc-5.3.0-6gconv-modules-2.21-3glibc-opt-2.21-4libc-dev-2.21-1libgmp-6.0.0a-1libmpc-1.0.2-1libm

  8. ruby - 如何在 Ruby 中执行 Windows CLI 命令? - 2

    我在目录“C:\DocumentsandSettings\test.exe”中有一个文件,但是当我用单引号编写命令时`C:\DocumentsandSettings\test.exe(我无法在此框中显示),用于在Ruby中执行命令,我无法这样做,我收到的错误是找不到文件或目录。我尝试用“//”和“\”替换“\”,但似乎没有任何效果。我也使用过系统、IO.popen和exec命令,但所有的努力都是徒劳的。exec命令还使程序退出,这是我不想发生的。提前致谢。 最佳答案 反引号环境就像双引号,所以反斜杠用于转义。此外,Ruby会将空格解

  9. ruby-on-rails - 如何构建复杂的 Rails 系统 - 2

    关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭8年前。Improvethisquestion我们有以下(以及更多)系统,我们将数据从一个应用推送/拉取到另一个:托管CRM(InsideSales.com)Asterisk电话系统(内部)横幅广告系统(openx,我们托管)潜在客户生成系统(自行开发)电子商务商店(spree,我们托管)工作板(本土)一些工作网站抓取+入站工作提要电子邮件传送系统(如Mailchimp,自主开发)事件管理系统(如eventbrite,自主开发)仪表板系统(大量图表和

  10. ruby-on-rails -/usr/local/lib/libz.1.dylib,文件是为 i386 构建的,它不是被链接的体系结构 (x86_64) - 2

    在我的mac上安装几个东西时遇到这个问题,我认为这个问题来自将我的豹子升级到雪豹。我认为这个问题也与macports有关。/usr/local/lib/libz.1.dylib,filewasbuiltfori386whichisnotthearchitecturebeinglinked(x86_64)有什么想法吗?更新更具体地说,这发生在安装nokogirigem时日志看起来像:xslt_stylesheet.c:127:warning:passingargument1of‘Nokogiri_wrap_xml_document’withdifferentwidthduetoproto

随机推荐