【问题标题】:Reordering gnu autotools linker flags重新排序 gnu autotools 链接器标志
【发布时间】:2012-11-07 17:11:50
【问题描述】:

我在 C++ 中的项目中使用 gnu autotools(autotools 配置由 eclipse cdt 自动生成,但我认为这无关紧要)。我正在使用 LLVM 库,现在我遇到了链接器标志顺序的问题。

基本上,在构建项目时,eclipse 会执行“make”。 Make执行了很多命令,但最后它执行g++编译器如下:

g++ -DPACKAGE_NAME=\"test\" -DPACKAGE_TARNAME=\"test\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"test\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"test\" -DVERSION=\"1.0\" -I.    `llvm-config --cppflags --ldflags --libs core` -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.cpp
mv -f .deps/test.Tpo .deps/test.Po

然后是链接器:

g++ `llvm-config --cppflags --ldflags --libs core` -g -O2   -o a.out test.o

问题是,如果参数“test.o”不在行首,则链接器会失败,所以应该是:

g++ test.o `llvm-config --cppflags --ldflags --libs core` -g -O2   -o a.out

如何在 Makefile.am 或 gnu autotools 的任何配置文件中更改它?

【问题讨论】:

    标签: c++ linker g++ autotools compiler-flags


    【解决方案1】:

    我没有找到答案,但到目前为止,我发现 LLVM 与一个包含自定义 automake 系统的项目模板捆绑在一起,它以正确的方式处理所有内容。

    如果您想访问该模板,您可以在 $LLVMSRC/projects/sample 文件夹中找到它。

    【讨论】:

      猜你喜欢
      • 2021-12-14
      • 1970-01-01
      • 1970-01-01
      • 2010-10-04
      • 2010-10-10
      • 2015-10-07
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多