gpt4 book ai didi

macos - 似乎无法使用 gcc 或 binutils 来构建新的链接器或汇编器

转载 作者:行者123 更新时间:2023-12-04 19:15:51 28 4
gpt4 key购买 nike

我正在尝试建立一个完全最新和最新的 gcc 环境......基本上是 gcc 4.6.3 和 binutils 2.22。不是 Xcode 4.2.1 附带的相当旧的 gcc 4.2.1 (llvm)。我的问题不在于编译(至少现在是这样)。我可以完美地同时编译 binutils、gcc 和两者。但是,每次我尝试编译时,我都会发现在配置输出的末尾出现类似的内容

checking where to find the target ar... just compiled
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... just compiled
checking where to find the target gcc... just compiled
checking where to find the target gcj... just compiled
checking where to find the target gfortran... just compiled
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... just compiled
checking where to find the target objdump... just compiled
checking where to find the target ranlib... just compiled
checking where to find the target strip... just compiled
checking where to find the target windres... just compiled
checking where to find the target windmc... just compiled



我在 gcc 源文件夹中为 ld、opcodes、bfd、gas、gprof 和 binutils 创建了符号链接(symbolic link)以获取此输出...(如果有帮助)

如您所见,我可以获得大多数软件的“刚刚编译”版本,因为我无法弄清楚如何编译 as 和 ld。我已经阅读了 ld 文件夹中的 README 文件(在 binutils 包中),它说要执行:

make all-ld



我做了,因为我已经“制作”了源,它告诉我没有什么可做的......

我现在唯一能想到的就是暂时修改我的路径以不包含 ld。这会很容易...

又名快速检查

whereis ld



无论如何,在想到这一点之后,我立即认为现在我将没有任何链接 gcc(甚至是新版本的 ld(如果我开始工作)),这将是愚蠢的

因此,总而言之,我正在尝试编译 ld 的新副本并作为...


事实:


  • 我正在运行 Mac OS X Lion。
  • 我正在尝试使用 Mac OS X Lion (gcc 4.2.1) 附带的默认 gcc 编译 gcc 4.6.3。
  • 配置脚本似乎认为我不想编译新的链接器和汇编器。
  • 我已经成功构建了一个有效的 gcc 和 binutils,但没有新的链接器和汇编器。
  • 我尝试使用 --with-ld=yes 和 --with-gold=no 选项编译 binutils 和 gcc,它们似乎什么也没做。
  • 我使用 gcc v4.2.1 构建了 gmp v5.0.4、mpfr v3.1.0 和 mpc v0.9,并将它们安装在 gcc 和 binutils 配置中使用的相同前缀中。
  • 对于每个配置,我都明确说明了 gmp、mpfr 和 mpc 的位置。
  • 我与 gcc 分开构建了 gmp、mpfr 和 mpc(这样做会导致一些构建错误)。
  • gcc、binutils、gmp、mpfr 和 mpc 都构建在一个单独的目录中,该目录不是源目录的子目录(按照 gcc 安装说明的建议)。

  • 我正在使用以下选项编译 gcc:

    ../gcc-4.6.3/configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --enable-checking=release --program -suffix=-4.6.3 --enable-ld=yes --enable-gold=no

  • 我主要关注this tutorial .
  • 因为我的计算机上没有其他编译器,所以我被迫使用我阅读的 mac os x 默认 llvm 编译器(我之前将其描述为 gcc 4.2.1)here不起作用,但是我的计算机上没有 gcc-4.2。
  • 使用我刚刚编译的新版本 gcc (gcc-4.6.3) 编译 gcc-4.7.0(最近的快照)会导致编译器错误(我设置了环境变量 CC 和 CXX)。

  • 我尝试先编译 gcc,而不是 binutils,反之亦然,最终我决定用 binutils 构建 gcc 是要走的路。您上面的输出同时编译

  • 我读了 this关于黄金的小帖子,并尝试添加--enable-gold 和--enable-ld。他们什么都没改变

  • 我做事的顺序:

  • 编译 gmp。

  • 安装它。

  • 编译mpfr。

  • 安装它。

  • 编译mpc。

  • 安装它。

  • 为 ld、gas、binutils、opcodes、gprof、bfd 制作指向 gcc src 主目录的符号链接(symbolic link)。

  • 配置 gcc。

  • 找到那个“状态报告”。

  • 考虑另一种可能构建 ld 和 as 的方法。

  • 失败了。

  • 继续堆栈溢出。



  • 正如“fazo”所说,我并没有真正告诉任何人我是如何编译 binutils 的……所以这里是……

    我首先尝试编译 gcc,而不是使用 gcc 构建 binutils,它编译得很好,但没有 ld、as 甚至 gold。然后我尝试使用 llvm 编译器来构建 binutils 然后是 gcc。它也运行良好,但仍然没有 ld、as 或 gold。终于看完了 here我可以对 binutils 中的某些项目进行符号链接(symbolic link),gcc 会检测并构建它们......我做到了。并且 gcc 找到了其中的大部分(正如我在 gcc 目录中为 ld、opcodes、bfd、gas、gprof 和 binutils 放置符号链接(symbolic link)之前所述)我在这里的实际问题是告诉配置脚本编译一个新的汇编器和链接器。此外,让我感到困惑的是,在 binutils README 文件夹中,它说仅仅 ./configure make make install 将构建和安装所有工具,我试图弄清楚为什么不是这种情况。

    最后的命令是:
    ../binutils-2.22/configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --program-suffix=-4.6.3 -- enable-ld --with-gnu-as --with-gnu-ld

    但我仍然没有精神,也没有汽油。

    任何帮助是极大的赞赏! (另外,如果您想要一些我没有提供的信息,请询问)

    谢谢... :)

    最佳答案

    Afaik 与标准构建 (configure;make),结果命名不同。 gas-new 和 gld-new 左右。

    请注意,OS X 通常不使用 binutils,而是使用 Apple 自己的 Mach-O 链接器 (cctools)。即使您成功了,也可能无法找到可行的解决方案

    关于macos - 似乎无法使用 gcc 或 binutils 来构建新的链接器或汇编器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9574023/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com