Opened 12 years ago
Closed 8 years ago
#4763 closed Bugs (fixed)
boost/units/detail/utility.hpp uses gcc demangle API which is not available on clang
Reported by: | Owned by: | Jürgen Hunold | |
---|---|---|---|
Milestone: | Boost 1.57.0 | Component: | units |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The check in the header looks like this:
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
However, clang++ also defines (at least one of) these macros but doesn't offer the gcc demangle API, so anything that uses this header will fail to compile on clang (like boost/exception/detail/type_info.hpp - The fact that this header includes a detail header from another library is, in my opinion, a bug in itself that should be fixed).
I "fixed" this by changing the line into:
#if !defined(__clang__) && (defined(__GLIBCXX__) || defined(__GLIBCPP__))
I think this isn't a real fix. boost should use something like configure checks to see if abi::__cxa_demangle
is actually usable.
Attachments (2)
Change History (10)
follow-up: 4 comment:1 by , 12 years ago
by , 11 years ago
Attachment: | units_detail_utility.patch added |
---|
A patch for boost/units/detail/utility.hpp (against trunk r73307).
follow-up: 3 comment:2 by , 11 years ago
Owner: | changed from | to
---|
Attached a patch that enables to use abi::__cxa_demangle
in libc++
(though I don't fully understand the OP's problem).
comment:3 by , 11 years ago
Attached a patch that enables to use
abi::__cxa_demangle
in libc++
This is a wrong patch.
libc++ does not provide __cxa_demangle
(and cxxabi.h
);
it's libc++abi that provides them.
I withdraw the patch.
In Mac OS X, to build libc++, libc++abi is needed (libc++abi is dynamically linked to libc++ and its symbols are re-exported). So using libc++ in Mac OS X implies that the functionality of libc++abi is also available.
#if defined(__GLIBCXX__) || defined(__GLIBCPP__) || (defined(_LIBCPP_VERSION) && defined(__APPLE__))
can detect this environment (and I locally use this code).
Sorry for the noise.
by , 11 years ago
Attachment: | units_detail_utility.2.patch added |
---|
A new patch for boost/units/detail/utility.hpp
. This patch enables to detect <cxxabi.h> header file when compiling with clang.
comment:4 by , 11 years ago
__cxa_demangle
is defined in the header file cxxabi.h. Perhaps at build-time, bjam should check for the existence of this header file.
I made a new patch along this line (but the check is done at the compile-time,
not at the build-time).
Clang has __has_include
macro that can detect a specified header file.
So this check can be done at the compile-time when compiling with clang.
I tested the patch on gcc 4.3-4.6 and clang TOT (with libstdc++ and libc++)
in both C++03 and C++0x modes. boost::units::detail::demangle
works fine on them.
comment:5 by , 11 years ago
I created a new ticket #6773 (with a cleaned up patch), since my patch does not try to resolve OP's request.
comment:7 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 8 years ago
Milestone: | To Be Determined → Boost 1.57.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
I just tried to compile
boost/units/detail/utility.hpp
with clang (trunk from monday) and no errors. I think the issue is not clang itself, but the C++ standard library used with it: I am using libstdc++ that came with gcc 4.2.But using another standard library does not mean that
abi::__cxa_demangle
(the function used by utility.hpp) does not exist, as that function is not gcc-specific, but part of the C++ ABI: http://www.codesourcery.com/public/cxx-abi/abi.html#demangler__cxa_demangle
is defined in the header file cxxabi.h. Perhaps at build-time, bjam should check for the existence of this header file.