【问题标题】:Error while compiling GCC-7.2编译 GCC-7.2 时出错
【发布时间】:2018-02-05 10:28:36
【问题描述】:

我在从头开始为 Linux 编译 GCC pass 2 时遇到此错误。

    configure: summary of build options:

  Version:           GNU MP 6.1.2
  Host type:         none-pc-linux-gnu
  ABI:               standard
  Install prefix:    /tools
  Compiler:          x86_64-lfs-linux-gnu-gcc
  Static libraries:  yes
  Shared libraries:  no

make[1]: Leaving directory '/mnt/lfs/sources/gcc-7.2.0/build'
Makefile:900: recipe for target 'all' failed
make: *** [all] Error 2

当我再次制作(只是再次输入 make)而不更改或重新配置任何内容时,我得到了不同的错误。

configure: error: libmpfr not found or uses a different ABI (including static vs shared).
Makefile:5232: recipe for target 'configure-mpc' failed
make[1]: *** [configure-mpc] Error 1
make[1]: Leaving directory '/mnt/lfs/sources/gcc-7.2.0/build'
Makefile:900: recipe for target 'all' failed
make: *** [all] Error 2

我正在关注this 指南。配置是:

CC=$LFS_TGT-gcc                                    \
CXX=$LFS_TGT-g++                                   \
AR=$LFS_TGT-ar                                     \
RANLIB=$LFS_TGT-ranlib                             \
../configure                                       \
    --prefix=/tools                                \
    --with-local-prefix=/tools                     \
    --with-native-system-header-dir=/tools/include \
    --enable-languages=c,c++                       \
    --disable-libstdcxx-pch                        \
    --disable-multilib                             \
    --disable-bootstrap                            \
    --disable-libgomp

使用以下版本的mpfr、gmp、mpc

mpfr-4.0.0 
gmp-6.1.2 
mpc-1.1.0

【问题讨论】:

  • 编译器的错误是什么?这份报告还不够。在您制作时捕获您的stderrstdout,并在那里查找错误。
  • 当我再次制作而不更改或重新配置任何东西时,我得到了不同的错误。
  • 之前尝试make cleanmake clean all。如果失败,请下载到一个干净的目录中,然后在那里尝试。
  • 我错过了新错误 - 这是我们可以解决的问题。 stackoverflow.com/questions/25831680/… 有帮助吗?
  • 另一个问题。你跑./configure了吗?

标签: c linux gcc


【解决方案1】:

这是大多数gcc 构建教程中的重要说明:

首先,我们强烈建议将 GCC 构建到单独的目录中 来自不位于源树中的源。这是 我们通常如何构建 GCC;在 srcdir == objdir 应该建立的地方 仍然有效,但没有得到广泛的测试;构建objdir 是 srcdir 的子目录不受支持。

此外,在一个演练中(我现在找不到,也许稍后会找到)明确指出您不能从它所在的同一目录运行 configure。

假设您有一个文件夹“srcdir=/path/to/parent/srcdir”,那么开始配置构建的推荐方法是:

cd /path/to/parent
mkdir objdir
cd objdir
$srcdir/configure

写在这里:https://gcc.gnu.org/install/configure.html

整个安装文档是https://gcc.gnu.org/install/

【讨论】:

  • 我已将其编译到名为“build”的新单独目录中
  • 我在 KALI LINUX 上运行它,我将发行版更改为 LINUX MINT 从一开始就开始了一切。现在它的工作。感谢您的帮助。
【解决方案2】:

问题出在 mpfrmpc 版本上。下载它们时出现错误,后来我错误地下载了错误的版本。 (大多数新手都会犯这个错误,因为 LFS 书中的某些链接已损坏,所以请仔细检查损坏的链接并下载正确的版本)我已将其更改为正确的版本,如LFS。重新编译后,成功了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-28
    • 2015-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多