开发者

Force ignore duplicate symbols?

I am building some legacy code from projects that uses static libraries. Now, I get lots of errors like this:

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

Is there a way to force through the build. From what I can see the "duplicate" functions are identical, it's just the build process thats gone haywire. The project is really large (and a mess of legacy c and c++ code) and I really want to avoid spending hours investigating the build process. Is there a "quick开发者_运维知识库 fix"? I really only need to run this program once, so I can live with (some) stability issues.


From the GNU ld man-page:

       --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.


A search in man ld (for "duplicate"), on my system, brought this up:

   --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.

Try it. Maybe it solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜