bash - LIBTOOL 尝试编译 GMP 时失败

标签 bash gcc makefile gmp libtool

我正在尝试按照 https://code.google.com/p/gmpy/wiki/InstallingGmpy2 中的说明安装 gmp2在 ubuntu 12.04 LTS 下。

因此我需要编译 GMP、MPFR 和 MPC。

为了编译 GMP,根据上面的说明,我需要:

$ cd ~/src/gmp-5.1.0
$ ./configure --prefix=/home/case/local
$ make
$ make check
$ make install

./configure 步骤运行良好,尽管我必须在命令前加上 /bin/bash>.

当我调用 make 命令时,我遇到了涉及 libtool 的错误:

/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=core2 -march=core2 -c -o fib_table.lo fib_table.c
../libtool: 1581: ../libtool: preserve_args+= --tag CC: not found
../libtool: 1: eval: base_compile+= gcc: not found
../libtool: 1: eval: base_compile+= -std=gnu99: not found
../libtool: 1: eval: base_compile+= -DHAVE_CONFIG_H: not found
../libtool: 1: eval: base_compile+= -I.: not found
../libtool: 1: eval: base_compile+= -I..: not found
../libtool: 1: eval: base_compile+= -D__GMP_WITHIN_GMP: not found
../libtool: 1: eval: base_compile+= -I..: not found
../libtool: 1: eval: base_compile+= -DOPERATION_fib_table: not found
../libtool: 1: eval: base_compile+= -m32: not found
../libtool: 1: eval: base_compile+= -O2: not found
../libtool: 1: eval: base_compile+= -pedantic: not found
../libtool: 1: eval: base_compile+= -fomit-frame-pointer: not found
../libtool: 1: eval: base_compile+= -mtune=core2: not found
../libtool: 1: eval: base_compile+= -march=core2: not found
../libtool: 1: eval: base_compile+= -c: not found
libtool: compile: you must specify a compilation command
libtool: compile: Try 'libtool --help --mode=compile' for more information. make[2]: *** [fib_table.lo] Error 1
make[2]: Leaving directory '/home/nicolas/Dropbox/crypto/gcc-lib/gmp-5.1.3/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nicolas/Dropbox/crypto/gcc-lib/gmp-5.1.3'
make: *** [all] Error 2

我怀疑以 /bin/sh 为前缀的 libtool 调用是错误的,但我不知道如何更改它:

  • 在 MakeFile 中,我将 SHELL=/bin/sh 更改为 SHELL=/bin/bash:没有区别
  • 当我“printenv SHELL”时,我得到/bin/bash

知道如何完成GMP编译吗?

最佳答案

正如您所说,发生这种情况是因为对 libtool 的调用以 /bin/sh 和您的 /bin/sh 实现为前缀(我的有根据的猜测:dash)没有实现+=语法(这不是 POSIX 功能)。 libtool 本身有 /bin/bash 作为 hashbang。

如果您无法弄清楚 SHELL 前缀来自何处,您可以通过更改所有出现的以下内容来“修复”libtool 本身:

base_compile+=" ${foo}"

base_compile="${base_compile} ${foo}"

请注意,这是一个快速破解,您应该解决使用 /bin/sh 调用 libtool 的根本问题。

(在尝试构建 apr-util 时,由于 shellshock,我将默认 shell 从 bash 切换到 dash 后遇到了同样的问题。 )

关于bash - LIBTOOL 尝试编译 GMP 时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22114431/

相关文章:

c++ - 制作文件 - 编译并将引用放入系统文件夹

linux - 在 Docker 容器中构建 make 用户时返回非零值 :error 9,

Cygwin 出现错误 : *** target pattern contains no `%'

bash - 形式 "for i in {1..171}"的循环不起作用(仅循环一次,使用 i ='{1..171}' )

linux - 在不使用插件的情况下增加 Maven 版本

arrays - 如果第一个表达式在 bash 中返回错误,则为数组赋值

c++ - 参数包函数参数可以默认吗?

c - gcc 未使用/读取 LIBRARY_PATH 环境变量

c - 为什么 * 和 % 在此规则中表现不同?

linux - 如何确定 NTP 通信状态