您好我正在尝试编译gmp,因为我需要它用于Perl模块。我必须手动安装eveyrthing,因为机器可以访问Internet。我运行了configure并在gMP文件夹中的cygwin中使用了这个命令:
./configure --prefix=C:\gmp --disable-static --enable-shared
现在,当我运行时,也可以毫无问题地工作并创建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
现在我不知道该怎么做。我也尝试过没有任何参数,它仍然会给出同样的错误。
答案 0 :(得分:1)
切换到Strawberry Perl并使用本教程,这就是解决方案:
答案 1 :(得分:1)
2年半以后,但我可以回答遇到类似问题的人(比如我!)。
打开一个cygwin终端,创建一个名为hello.txt
的小文本文件并在其中放入少量文本,然后执行以下命令:
ln -s hello.txt link.txt
现在,cat link.txt
将显示您的文字。但是,如果你进入Windows,打开笔记本并在那里打开link.txt from
,你会看到一些非常奇怪的字符。您可能会看到" 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失败了。
当您运行config.status
时,此链接由configure
创建。
现在,这样做:
rm link.txt
export CYGWIN=winsymlinks
ln -s hello.txt link.txt
现在,cat link.txt
和“笔记本”都应显示hello.txt
的内容。原因是设置CYGWIN=winsymlinks
告诉cygwin创建Windows链接文件。在Chapter 3 of the Cygwin User's Guide中了解有关cygwin链接的更多信息。
现在设置了CYGWIN
环境变量,再次运行configure,它将使用" right"重新创建链接。 Windows链接文件。
error: stray '\377' in program
问题以外的任何错误都有其他原因。