gpt4 book ai didi

linker - 如何为自动工具构建配置非标准链接器?

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

我想配置一个自动工具化的项目来调用一个非标准的
链接器( gold linker ),
使用 Linux Mint 16/Ubuntu 13.10 的库存自动工具

我相信我会通过以下方式实现这一目标:

  • libtoolize -ing 项目
  • 运行 ./configure LD=/path/to/my/linker ... etc.

  • 然而,这一直是无效的。 libtoolize已经成功。后
    一个标准 ./configure; make我现在看到 libtool正在做
    链接:
    /bin/bash ./libtool  --tag=CXX   --mode=link g++  -g -O2    -o helloworld helloworld.o

    但路过 LD=/path/to/my/linkerconfigure没什么区别。实验上,
    我什至跑了:
    ./configure LD=/does/not/exist

    希望引发错误,但我没有。输出包含:
    checking if the linker (/does/not/exist -m elf_x86_64) is GNU ld... no
    checking whether the g++ linker (/does/not/exist -m elf_x86_64) supports shared libraries... yes

    此后,make 继续链接,成功调用 g++和以前一样。

    配置非标准链接器的正确方法是什么?

    最佳答案

    But passing LD=/path/to/my/linker to configure makes no difference



    这是因为 LD几乎从不,也不应该用于链接任何用户空间程序。正确的链接是通过使用适当的编译器驱动程序( gccg++ 等)来执行的。

    What is the right way to configure a non-standard linker?



    如果您有 /some/path/ld你想要 gcc使用该 ld , 通 -B/some/path标记到 gcc。

    然后你可能想要:
    ./configure CC='gcc -B/some/path' CXX='g++ -B/some/path' ...

    关于linker - 如何为自动工具构建配置非标准链接器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21352487/

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