我正在使用静态库的项目构建一些遗留代码。现在,我收到很多这样的错误:
ld: warning: option -m is obsolete and being ignored
ld: duplicate symbol <function name>
有没有办法强制通过构建。从我所看到的“重复”功能是相同的,它只是构建过程已经失控。该项目非常庞大(以及一系列遗留的c和c ++代码),我真的希望避免花费数小时来调查构建过程。有“快速修复”吗?我真的只需要运行一次这个程序,所以我可以忍受(某些)稳定性问题。
答案 0 :(得分:2)
在GNU ld
手册页中:
--allow-multiple-definition
-z muldefs
Normally when a symbol is defined multiple times, the linker will
report a fatal error. These options allow multiple definitions and
the first definition will be used.
答案 1 :(得分:1)
在我的系统上搜索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.
试试吧。也许它解决了你的问题。