开发者

How to add an object file to every link

There is a bug in RHEL5's gcc-4.3.2 with which we are stuck. As a work-around we have extracted the missing ob开发者_如何学JAVAject and put it in an object file. Adding this object file to every link makes the problem go away.

While adding it directly to LDFLAGS seems like a good solution, this doesn't work since e.g. libtool cannot cope with non-la files in there.

A slightly more portable solution seems to be to directly patch the gcc spec to add this to every link. I came up with

*startfile:
+ %{shared-libgcc:%{O*:%{!O0:/PATH/TO/ostream-inst.o}}}

where ostream-inst.o is added to the list of startfiles used in the link when compiling a shared library with optimizations.

Trying to compile boost with this spec gives some errors though since its build directly sets some objects with ld's --startgroup/--endgroup.

How should I update that spec to cover that case as well, or even better, all cases?


Go through this URL Specifying subprocesses and the switches to pass to them and GCC Command Options

If this help you, thats great.


I know this is not the answer you want to hear (since you specified otherwise in your question), but you are running into trouble here and are likely to run into more since your compiler is buggy. You should find a way of replacing it, since you'll find yourself writing even more work-around code the next time some obscure build system comes along. There's not only bjam out there.

Sorry I can't help you more. You might try simply writing a .lo file by hand (it's a two-liner, after all) and insert it into your LDFLAGS.


If it is a bug of GCC 4.3, did you try to build (by compiling from sources) and use a newer GCC. GCC 4.6.2 is coming right now. Did you consider using it?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜