Opened 15 years ago
Closed 15 years ago
#22112 closed defect (fixed)
Link error when linking with boost program options in the debug variant
Reported by: | raphael@… | Owned by: | nox@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.8.1 |
Keywords: | Cc: | ||
Port: | boost |
Description
The current approach of supporting debugging iterators in the +debug
variant of boost (see #20478) has a drawback: You get a linker error if you try to link some program that was compiled without -D_GLIBCXX_DEBUG
(i. e. without debugging iterators) with the boost program options library compiled with the +debug
variant. This is the case for both the normal library libboost_program_options-mt.dylib
and the debugging library libboost_program_options-mt-d.dylib
.
I propose to add a new variant for debugging iterators and remove define=_GLIBCXX_DEBUG
from the +debug
variant.
Change History (3)
comment:1 Changed 15 years ago by mf2k (Frank Schima)
Cc: | nox@… removed |
---|---|
Owner: | changed from macports-tickets@… to nox@… |
comment:2 Changed 15 years ago by arsptr@…
comment:3 Changed 15 years ago by nox@…
Resolution: | → fixed |
---|---|
Status: | new → closed |
_GLIBCXX_DEBUG
symbol removed in r60830
Note: See
TracTickets for help on using
tickets.
I'm seeing a similar problem which seems to have the same underlying cause.
It's pretty easy to describe. With boost built with the debug option, you can get get malloc errors simply by linking against one of the boost libraries, even if your code doesn't call boost at all. Consider:
Compiles, links and runs just fine:
Now if we link against a boost library it all goes pear-shaped:
The problem is that the boost library is compiled with _GLIBCXX_DEBUG defined, and this REQUIRES that programs that link against it also define the same symbol. If we do, it all works again:
I have spent an embarassing amount of time chasing this down, but basically the problem seems to come down to the Portfile, which defines _GLIBCXX_DEBUG. As noted in the documentation, this flag breaks binary compatibility.
(I am not an expert in BJam build rules, but isn't this defining _GLIBCXX_DEBUG for release variants as well as debug? Substituting the non-debug libraries in the above test cases yields the same behaviour)
Anyway enabling the _GLIBCXX_DEBUG symbol here is probably the wrong thing to do, at least not without big flashing warnings so that users can also enable it in their code. Just for safety I'd prefer to back it out entirely.