svn commit: r403247 - in head/devel/libxs: . files
Don Lewis
truckman at FreeBSD.org
Tue Dec 8 01:42:12 UTC 2015
Author: truckman
Date: Tue Dec 8 01:42:10 2015
New Revision: 403247
URL: https://svnweb.freebsd.org/changeset/ports/403247
Log:
Remove USE_GCC=yes from devel/libxs and always build with the base
compiler.
There is a defect in the libc++ header files bundled with clang < 3.6
that broke the libxs build. Because of this breakage, USE_GCC=yes
was added to the port Makefile in r330486.
Unfortunately that breaks dns/dnstable in two different ways.
Dnstable itself is pure-C code, but it links to two different
libraries that contain C++ code, libxs and archivers/snappy, the
latter of which is built with the base c++ compiler.
* On FreeBSD 9, snappy is generally built with g++ 4.2 from base
and linked to libstdc++ in base, whereas libxs is built with g++
from ports and linked to libstdc++ from ports. When building
dnstable, the linker seems to load libsnappy first, which brings
in libstdc++ from base. This seems to work fine with ports gcc
4.8 or older, but when the default ports version is upgraded
to 4.9, the linker fails with the error:
"/usr/local/lib/libxs.so.2: undefined reference to
`std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'"
* On FreeBSD >= 10 where clang is the base compiler and snappy
is linked to libc++, the build succeeds but the resulting
executables will fail at runtime because they link to both libc++
from base and libstdc++ from ports.
When building libxs on FreeBSD 10 with clang 3.4, the build error is:
CXX libxs_la-io_thread.lo
--- libxs_la-encoder.lo ---
In file included from encoder.cpp:23:
In file included from ./encoder.hpp:28:
In file included from /usr/include/c++/v1/algorithm:626:
/usr/include/c++/v1/utility:254:9: error: field has incomplete type 'xs::io_thread_t::timer_info_t'
_T2 second;
^
Patching the code to work around the build failure does not look
possible, so instead, fix the problem in a rather hackish way when
compiling with clang < 3.6 and using its bundled c++ headers:
* Make a local copy of the two defective header files.
* Apply the upstream change to those files from
<http://llvm.org/viewvc/llvm-project?view=revision&revision=231119>
"Allow declaration of map and multimap iterator with incomplete
mapped type. Patch from eugenis"
* Add the directory containing the updated header files to the
CPPFLAGS.
This fix is not needed when building with base clang on FreeBSD 9
because it uses the stdc++ headers.
PR: 204461
PR: 204400
PR: 196712
Approved by: vg (maintainer)
MFH: 2015Q4
Sponsored by: Farsight Security, Inc.
Added:
head/devel/libxs/files/
head/devel/libxs/files/extra-patch-map (contents, props changed)
Modified:
head/devel/libxs/Makefile
Modified: head/devel/libxs/Makefile
==============================================================================
--- head/devel/libxs/Makefile Tue Dec 8 01:39:27 2015 (r403246)
+++ head/devel/libxs/Makefile Tue Dec 8 01:42:10 2015 (r403247)
@@ -3,7 +3,7 @@
PORTNAME= libxs
PORTVERSION= 1.2.0
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= devel
MASTER_SITES= http://download.crossroads.io/
@@ -13,9 +13,8 @@ COMMENT= Open source lightweight messagi
LICENSE= GPLv3
GNU_CONFIGURE= yes
-USES= pathfix pkgconfig libtool
+USES= compiler:features pathfix pkgconfig libtool
USE_LDCONFIG= yes
-USE_GCC= yes
OPTIONS_DEFINE= DEBUG DOCS PLUGINS ZMQ
EXTERNAL_DESC= PGM extension from ports
@@ -26,7 +25,21 @@ OPTIONS_RADIO= PGM
OPTIONS_RADIO_PGM= INTERNAL EXTERNAL
OPTIONS_DEFAULT=PLUGINS
-.include <bsd.port.options.mk>
+.include <bsd.port.pre.mk>
+
+.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} < 36 && \
+ !${COMPILER_FEATURES:Mlibstdc++}
+# Allow declaration of map and multimap iterator with incomplete mapped type
+# by applying upstream change r231119 to a copy of our local c++ headers.
+# This fix is not needed for clang 3.4 on 9.3 which uses libstdc++.
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-map
+CPPFLAGS+= -I${WRKSRC}/map-fix
+
+post-extract:
+ ${MKDIR} ${WRKSRC}/map-fix
+ ${CP} /usr/include/c++/v1/__tree /usr/include/c++/v1/map \
+ ${WRKSRC}/map-fix/.
+.endif
.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+= --enable-debug
@@ -75,4 +88,4 @@ pre-configure:
${WRKSRC}/configure
.endif
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Added: head/devel/libxs/files/extra-patch-map
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/devel/libxs/files/extra-patch-map Tue Dec 8 01:42:10 2015 (r403247)
@@ -0,0 +1,165 @@
+--- map-fix/__tree.orig 2015-11-10 21:58:57.802092405 -0800
++++ map-fix/__tree 2015-11-10 21:59:00.724090284 -0800
+@@ -622,8 +622,6 @@
+ {
+ typedef _NodePtr __node_pointer;
+ typedef typename pointer_traits<__node_pointer>::element_type __node;
+- typedef typename __node::base __node_base;
+- typedef typename __node_base::pointer __node_base_pointer;
+
+ __node_pointer __ptr_;
+
+@@ -652,17 +650,21 @@
+ {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+ _LIBCPP_INLINE_VISIBILITY
+- __tree_iterator& operator++()
+- {__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
+- return *this;}
++ __tree_iterator& operator++() {
++ __ptr_ = static_cast<__node_pointer>(
++ __tree_next(static_cast<typename __node::base::pointer>(__ptr_)));
++ return *this;
++ }
+ _LIBCPP_INLINE_VISIBILITY
+ __tree_iterator operator++(int)
+ {__tree_iterator __t(*this); ++(*this); return __t;}
+
+ _LIBCPP_INLINE_VISIBILITY
+- __tree_iterator& operator--()
+- {__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
+- return *this;}
++ __tree_iterator& operator--() {
++ __ptr_ = static_cast<__node_pointer>(
++ __tree_prev(static_cast<typename __node::base::pointer>(__ptr_)));
++ return *this;
++ }
+ _LIBCPP_INLINE_VISIBILITY
+ __tree_iterator operator--(int)
+ {__tree_iterator __t(*this); --(*this); return __t;}
+@@ -691,14 +693,6 @@
+ {
+ typedef _ConstNodePtr __node_pointer;
+ typedef typename pointer_traits<__node_pointer>::element_type __node;
+- typedef typename __node::base __node_base;
+- typedef typename pointer_traits<__node_pointer>::template
+-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+- rebind<__node_base>
+-#else
+- rebind<__node_base>::other
+-#endif
+- __node_base_pointer;
+
+ __node_pointer __ptr_;
+
+@@ -743,17 +737,39 @@
+ {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+ _LIBCPP_INLINE_VISIBILITY
+- __tree_const_iterator& operator++()
+- {__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
+- return *this;}
++ __tree_const_iterator& operator++() {
++ typedef typename pointer_traits<__node_pointer>::template
++#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
++ rebind<typename __node::base>
++#else
++ rebind<typename __node::base>::other
++#endif
++ __node_base_pointer;
++
++ __ptr_ = static_cast<__node_pointer>(
++ __tree_next(static_cast<__node_base_pointer>(__ptr_)));
++ return *this;
++ }
++
+ _LIBCPP_INLINE_VISIBILITY
+ __tree_const_iterator operator++(int)
+ {__tree_const_iterator __t(*this); ++(*this); return __t;}
+
+ _LIBCPP_INLINE_VISIBILITY
+- __tree_const_iterator& operator--()
+- {__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
+- return *this;}
++ __tree_const_iterator& operator--() {
++ typedef typename pointer_traits<__node_pointer>::template
++#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
++ rebind<typename __node::base>
++#else
++ rebind<typename __node::base>::other
++#endif
++ __node_base_pointer;
++
++ __ptr_ = static_cast<__node_pointer>(
++ __tree_prev(static_cast<__node_base_pointer>(__ptr_)));
++ return *this;
++ }
++
+ _LIBCPP_INLINE_VISIBILITY
+ __tree_const_iterator operator--(int)
+ {__tree_const_iterator __t(*this); --(*this); return __t;}
+--- map-fix/map.orig 2015-11-10 21:24:49.362267208 -0800
++++ map-fix/map 2015-11-10 21:25:09.501230487 -0800
+@@ -644,14 +644,25 @@
+
+ #endif
+
++template <class _Tp>
++struct __extract_key_value_types;
++
++template <class _Key, class _Tp>
++struct __extract_key_value_types<__value_type<_Key, _Tp> >
++{
++ typedef _Key const __key_type;
++ typedef _Tp __mapped_type;
++};
++
+ template <class _TreeIterator>
+ class _LIBCPP_TYPE_VIS_ONLY __map_iterator
+ {
+ _TreeIterator __i_;
+
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+- typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
+- typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
++ typedef typename _TreeIterator::value_type __value_type;
++ typedef typename __extract_key_value_types<__value_type>::__key_type __key_type;
++ typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
+ public:
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef pair<__key_type, __mapped_type> value_type;
+@@ -715,8 +726,9 @@
+ _TreeIterator __i_;
+
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+- typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
+- typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
++ typedef typename _TreeIterator::value_type __value_type;
++ typedef typename __extract_key_value_types<__value_type>::__key_type __key_type;
++ typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
+ public:
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef pair<__key_type, __mapped_type> value_type;
+@@ -736,10 +748,9 @@
+ _LIBCPP_INLINE_VISIBILITY
+ __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_INLINE_VISIBILITY
+- __map_const_iterator(
+- __map_iterator<typename _TreeIterator::__non_const_iterator> __i)
+- _NOEXCEPT
+- : __i_(__i.__i_) {}
++ __map_const_iterator(__map_iterator<
++ typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
++ : __i_(__i.__i_) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ reference operator*() const {return __i_->__cc;}
+@@ -829,7 +840,7 @@
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+- typedef __map_iterator<typename __base::iterator> iterator;
++ typedef __map_iterator<typename __base::iterator> iterator;
+ typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+ typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
+ typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
More information about the svn-ports-head
mailing list