2011-04-14 62 views
5

我正在从使用静态库的项目构建一些遗留代码。现在,我得到了很多这样的错误:强制忽略重复的符号?

ld: warning: option -m is obsolete and being ignored 
ld: duplicate symbol <function name> 

有没有办法强制通过构建。从我所看到的“重复”功能是相同的,这只是构建过程已经过时了。这个项目真的很大(还有一堆传统的c和C++代码),我真的想避免花几个小时来调查构建过程。有没有“快速修复”?我真的只需要运行一次这个程序,所以我可以忍受(一些)稳定性问题。

回答

2

man ld一个搜索(对于 “重复”),我的系统上,提出这:

--traditional-format 
     For some targets, the output of ld is different in some ways from 
     the output of some existing linker. This switch requests ld to use 
     the traditional format instead. 

     For example, on SunOS, ld combines duplicate entries in the symbol 
     string table. This can reduce the size of an output file with full 
     debugging information by over 30 percent. Unfortunately, the SunOS 
     "dbx" program can not read the resulting program ("gdb" has no 
     trouble). The --traditional-format switch tells ld to not combine 
     duplicate entries. 

试试吧。也许它解决了你的问题。

+0

哪个平台适合?该选项在Mac OS X上不可用。但是,我在Ubuntu机器上尝试了它,但没有成功。听起来更像是与调试符号有关。 – Krumelur 2011-04-17 08:47:10

+0

这是我的Debian机器上的'man ld'的输出(ld v 2.21.0.20110327)。我没有测试它。对不起,它不适合你。 – pmg 2011-04-17 09:55:56