From cfbd80b49d33213d0f1459744784f92d038aab49 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Wed, 12 Nov 2014 19:36:48 +0100 Subject: [PATCH 1/3] Fix boost::shared_ptr::operator[] for non-array T's --- boost-1.54.0-smart_ptr-shared_ptr_at.patch | 88 ++++++++++++++++++++++ boost.spec | 10 ++- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 boost-1.54.0-smart_ptr-shared_ptr_at.patch diff --git a/boost-1.54.0-smart_ptr-shared_ptr_at.patch b/boost-1.54.0-smart_ptr-shared_ptr_at.patch new file mode 100644 index 0000000..675e13d --- /dev/null +++ b/boost-1.54.0-smart_ptr-shared_ptr_at.patch @@ -0,0 +1,88 @@ +From f65c57d9d2a4f535e36c96b7f563574634e46b02 Mon Sep 17 00:00:00 2001 +From: Peter Dimov +Date: Wed, 12 Nov 2014 19:04:29 +0200 +Subject: [PATCH] Fix explicit instantiation regression + +--- + include/boost/smart_ptr/shared_ptr.hpp | 2 +- + test/Jamfile.v2 | 2 ++ + test/array_fail_array_access.cpp | 6 +++++- + test/sp_explicit_inst_test.cpp | 23 +++++++++++++++++++++++ + 4 files changed, 31 insertions(+), 2 deletions(-) + create mode 100644 test/sp_explicit_inst_test.cpp + +diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp +index 82ece8b..8be92ab 100644 +--- a/boost/smart_ptr/shared_ptr.hpp ++++ b/boost/smart_ptr/shared_ptr.hpp +@@ -655,7 +655,7 @@ public: + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); + +- return px[ i ]; ++ return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); + } + + element_type * get() const BOOST_NOEXCEPT +diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 +index 027367c..0b51eee 100644 +--- a/libs/smart_ptr/test/Jamfile.v2 ++++ b/libs/smart_ptr/test/Jamfile.v2 +@@ -153,5 +153,7 @@ import testing ; + [ run allocate_shared_array_throws_test.cpp ] + [ run allocate_shared_array_esft_test.cpp ] + [ run allocate_shared_array_args_test.cpp ] ++ ++ [ compile sp_explicit_inst_test.cpp ] + ; + } +diff --git a/test/array_fail_array_access.cpp b/test/array_fail_array_access.cpp +index abfacbe..4f4e3f8 100644 +--- a/libs/smart_ptr/test/array_fail_array_access.cpp ++++ b/libs/smart_ptr/test/array_fail_array_access.cpp +@@ -12,8 +12,12 @@ struct X + { + }; + ++template void f( T & /*t*/ ) ++{ ++} ++ + int main() + { + boost::shared_ptr px( new X ); +- px[ 0 ]; ++ f( px[ 0 ] ); + } +diff --git a/test/sp_explicit_inst_test.cpp b/test/sp_explicit_inst_test.cpp +new file mode 100644 +index 0000000..d8de782 +--- /dev/null ++++ b/libs/smart_ptr/test/sp_explicit_inst_test.cpp +@@ -0,0 +1,23 @@ ++// ++// Explicit instantiations are reported to exist in user code ++// ++// Copyright (c) 2014 Peter Dimov ++// ++// Distributed under the Boost Software License, Version 1.0. ++// See accompanying file LICENSE_1_0.txt or copy at ++// http://www.boost.org/LICENSE_1_0.txt ++// ++ ++#include ++ ++template class boost::shared_ptr< int >; ++ ++struct X ++{ ++}; ++ ++template class boost::shared_ptr< X >; ++ ++int main() ++{ ++} +-- +2.1.0 + diff --git a/boost.spec b/boost.spec index a9c628c..46e5698 100644 --- a/boost.spec +++ b/boost.spec @@ -36,7 +36,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.55.0 %define version_enc 1_55_0 -Release: 3%{?dist} +Release: 4%{?dist} License: Boost and MIT and Python %define toplev_dirname %{name}_%{version_enc} @@ -157,6 +157,9 @@ Patch56: boost-1.55.0-xpressive-unused_typedefs.patch # Fixed upstream on Aug 20 05:11:14 2013. Patch57: boost-1.55.0-spirit-unused_typedefs.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1159960 +Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch + %bcond_with tests %bcond_with docs_generated @@ -643,6 +646,7 @@ a number of significant features and is now developed independently %patch55 -p1 %patch56 -p1 %patch57 -p1 +%patch58 -p1 # At least python2_version needs to be a macro so that it's visible in # %%install as well. @@ -1245,6 +1249,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/bjam.1* %changelog +* Wed Nov 12 2014 Petr Machata - 1.55.0-4 +- Fix boost::shared_ptr::operator[], which was ill-formed for + non-array T's. (boost-1.54.0-smart_ptr-shared_ptr_at.patch) + * Fri Aug 15 2014 Fedora Release Engineering - 1.55.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild From 6c7e1e8c6e64a19cb6fe858b47241c384937ecfc Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Fri, 2 Jan 2015 14:12:06 +0100 Subject: [PATCH 2/3] Boost.Atomic: Fixed incorrect initialization of 128-bit values --- boost-1.55.0-atomic-int128_1.patch | 48 +++++++++++++++++++++ boost-1.55.0-atomic-int128_2.patch | 68 ++++++++++++++++++++++++++++++ boost.spec | 15 ++++++- 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 boost-1.55.0-atomic-int128_1.patch create mode 100644 boost-1.55.0-atomic-int128_2.patch diff --git a/boost-1.55.0-atomic-int128_1.patch b/boost-1.55.0-atomic-int128_1.patch new file mode 100644 index 0000000..eafd53e --- /dev/null +++ b/boost-1.55.0-atomic-int128_1.patch @@ -0,0 +1,48 @@ +From 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9 Mon Sep 17 00:00:00 2001 +From: Andrey Semashev +Date: Sun, 26 Jan 2014 13:58:48 +0400 +Subject: [PATCH] Fixed incorrect initialization of 128-bit values, when no + native support for 128-bit integers is available. + +--- + include/boost/atomic/detail/cas128strong.hpp | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/include/boost/atomic/detail/cas128strong.hpp b/include/boost/atomic/detail/cas128strong.hpp +index 906c13e..dcb4d7d 100644 +--- a/include/boost/atomic/detail/cas128strong.hpp ++++ b/include/boost/atomic/detail/cas128strong.hpp +@@ -196,15 +196,17 @@ protected: + + public: + BOOST_DEFAULTED_FUNCTION(base_atomic(void), {}) +- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) ++ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT + { ++ memset(&v_, 0, sizeof(v_)); + memcpy(&v_, &v, sizeof(value_type)); + } + + void + store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type value_s = 0; ++ storage_type value_s; ++ memset(&value_s, 0, sizeof(value_s)); + memcpy(&value_s, &value, sizeof(value_type)); + platform_fence_before_store(order); + platform_store128(value_s, &v_); +@@ -247,7 +249,9 @@ public: + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + +-- +2.1.0 + diff --git a/boost-1.55.0-atomic-int128_2.patch b/boost-1.55.0-atomic-int128_2.patch new file mode 100644 index 0000000..212a67e --- /dev/null +++ b/boost-1.55.0-atomic-int128_2.patch @@ -0,0 +1,68 @@ +From e4bde20f2eec0a51be14533871d2123bd2ab9cf3 Mon Sep 17 00:00:00 2001 +From: Andrey Semashev +Date: Fri, 28 Feb 2014 12:43:11 +0400 +Subject: [PATCH] More compilation fixes for the case when 128-bit integers are + not supported. + +--- + include/boost/atomic/detail/gcc-atomic.hpp | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/include/boost/atomic/detail/gcc-atomic.hpp b/include/boost/atomic/detail/gcc-atomic.hpp +index a130590..4af99a1 100644 +--- a/include/boost/atomic/detail/gcc-atomic.hpp ++++ b/include/boost/atomic/detail/gcc-atomic.hpp +@@ -958,14 +958,16 @@ protected: + + public: + BOOST_DEFAULTED_FUNCTION(base_atomic(void), {}) +- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) ++ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT + { ++ memset(&v_, 0, sizeof(v_)); + memcpy(&v_, &v, sizeof(value_type)); + } + + void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type tmp = 0; ++ storage_type tmp; ++ memset(&tmp, 0, sizeof(tmp)); + memcpy(&tmp, &v, sizeof(value_type)); + __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order)); + } +@@ -980,7 +982,8 @@ public: + + value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type tmp = 0; ++ storage_type tmp; ++ memset(&tmp, 0, sizeof(tmp)); + memcpy(&tmp, &v, sizeof(value_type)); + tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order)); + value_type res; +@@ -994,7 +997,9 @@ public: + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false, +@@ -1010,7 +1015,9 @@ public: + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true, +-- +2.1.0 + diff --git a/boost.spec b/boost.spec index 46e5698..1796330 100644 --- a/boost.spec +++ b/boost.spec @@ -36,7 +36,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.55.0 %define version_enc 1_55_0 -Release: 4%{?dist} +Release: 6%{?dist} License: Boost and MIT and Python %define toplev_dirname %{name}_%{version_enc} @@ -99,6 +99,7 @@ Patch5: boost-1.48.0-add-bjam-man-page.patch # https://bugzilla.redhat.com/show_bug.cgi?id=828856 # https://bugzilla.redhat.com/show_bug.cgi?id=828857 +# https://svn.boost.org/trac/boost/ticket/6701 Patch15: boost-1.50.0-pool.patch # https://svn.boost.org/trac/boost/ticket/8844 @@ -160,6 +161,10 @@ Patch57: boost-1.55.0-spirit-unused_typedefs.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1159960 Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1177066 +Patch59: boost-1.55.0-atomic-int128_1.patch +Patch60: boost-1.55.0-atomic-int128_2.patch + %bcond_with tests %bcond_with docs_generated @@ -647,6 +652,8 @@ a number of significant features and is now developed independently %patch56 -p1 %patch57 -p1 %patch58 -p1 +%patch59 -p2 +%patch60 -p2 # At least python2_version needs to be a macro so that it's visible in # %%install as well. @@ -1249,6 +1256,12 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/bjam.1* %changelog +* Fri Jan 2 2015 Petr Machata - 1.55.0-6 +- Boost.Atomic: Fixed incorrect initialization of 128-bit values, when + no native support for 128-bit integers is available. + (boost-1.55.0-atomic-int128_1.patch, + boost-1.55.0-atomic-int128_2.patch) + * Wed Nov 12 2014 Petr Machata - 1.55.0-4 - Fix boost::shared_ptr::operator[], which was ill-formed for non-array T's. (boost-1.54.0-smart_ptr-shared_ptr_at.patch) From 48eaa83d7c78ef15af6c797fe6a4ea93c78e6b77 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Tue, 13 Jan 2015 22:17:20 +0100 Subject: [PATCH 3/3] libboost_python{,3} should depend on libpython --- boost-1.55.0-python-abi_letters.patch | 62 ++++++++++++ boost-1.55.0-python-libpython_dep.patch | 13 +++ ...0-python-test-PyImport_AppendInittab.patch | 98 +++++++++++++++++++ boost.spec | 23 ++++- 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 boost-1.55.0-python-abi_letters.patch create mode 100644 boost-1.55.0-python-libpython_dep.patch create mode 100644 boost-1.55.0-python-test-PyImport_AppendInittab.patch diff --git a/boost-1.55.0-python-abi_letters.patch b/boost-1.55.0-python-abi_letters.patch new file mode 100644 index 0000000..71fa9bd --- /dev/null +++ b/boost-1.55.0-python-abi_letters.patch @@ -0,0 +1,62 @@ +--- boost_1_55_0/tools/build/v2/tools/python.jam 2013-05-21 06:14:18.000000000 +0200 ++++ boost_1_55_0/tools/build/v2/tools/python.jam 2014-05-29 19:09:12.115413877 +0200 +@@ -94,7 +94,7 @@ feature.feature pythonpath : : free opti + # using python : 2.3 : /usr/local/bin/python ; + # + rule init ( version ? : cmd-or-prefix ? : includes * : libraries ? +- : condition * : extension-suffix ? ) ++ : condition * : extension-suffix ? : abi-letters ? ) + { + project.push-current $(.project) ; + +@@ -107,7 +107,7 @@ rule init ( version ? : cmd-or-prefix ? + } + } + +- configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) ; ++ configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) : $(abi-letters) ; + + project.pop-current ; + } +@@ -653,7 +653,7 @@ local rule system-library-dependencies ( + + # Declare a target to represent Python's library. + # +-local rule declare-libpython-target ( version ? : requirements * ) ++local rule declare-libpython-target ( version ? : requirements * : abi-letters ? ) + { + # Compute the representation of Python version in the name of Python's + # library file. +@@ -677,13 +677,13 @@ local rule declare-libpython-target ( ve + } + + # Declare it. +- lib python.lib : : python$(lib-version) $(requirements) ; ++ lib python.lib : : python$(lib-version)$(abi-letters) $(requirements) ; + } + + + # Implementation of init. + local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : +- condition * : extension-suffix ? ) ++ condition * : extension-suffix ? : abi-letters ? ) + { + local prefix ; + local exec-prefix ; +@@ -699,6 +699,7 @@ local rule configure ( version ? : cmd-o + extension-suffix ?= _d ; + } + extension-suffix ?= "" ; ++ abi-letters ?= "" ; + + # Normalize and dissect any version number. + local major-minor ; +@@ -922,7 +923,7 @@ local rule configure ( version ? : cmd-o + } + else + { +- declare-libpython-target $(version) : $(target-requirements) ; ++ declare-libpython-target $(version) : $(target-requirements) : $(abi-letters) ; + + # This is an evil hack. On, Windows, when Python is embedded, nothing + # seems to set up sys.path to include Python's standard library diff --git a/boost-1.55.0-python-libpython_dep.patch b/boost-1.55.0-python-libpython_dep.patch new file mode 100644 index 0000000..202f4ec --- /dev/null +++ b/boost-1.55.0-python-libpython_dep.patch @@ -0,0 +1,13 @@ +Index: boost/tools/build/v2/tools/python.jam +=================================================================== +--- boost/tools/build/v2/tools/python.jam (revision 50406) ++++ boost/tools/build/v2/tools/python.jam (working copy) +@@ -994,7 +994,7 @@ + else + { + alias python_for_extensions +- : ++ : python + : $(target-requirements) + : + : $(usage-requirements) diff --git a/boost-1.55.0-python-test-PyImport_AppendInittab.patch b/boost-1.55.0-python-test-PyImport_AppendInittab.patch new file mode 100644 index 0000000..1d2ee5c --- /dev/null +++ b/boost-1.55.0-python-test-PyImport_AppendInittab.patch @@ -0,0 +1,98 @@ +diff -up boost_1_55_0/libs/python/test/exec.cpp\~ boost_1_55_0/libs/python/test/exec.cpp +--- boost_1_55_0/libs/python/test/exec.cpp~ 2010-07-05 00:38:38.000000000 +0200 ++++ boost_1_55_0/libs/python/test/exec.cpp 2015-01-09 21:31:12.903218280 +0100 +@@ -56,6 +56,20 @@ void eval_test() + BOOST_TEST(value == "ABCDEFG"); + } + ++struct PyCtx ++{ ++ PyCtx() { ++ Py_Initialize(); ++ } ++ ++ ~PyCtx() { ++ // N.B. certain problems may arise when Py_Finalize is called when ++ // using Boost.Python. However in this test suite it all seems to ++ // work fine. ++ Py_Finalize(); ++ } ++}; ++ + void exec_test() + { + // Register the module with the interpreter +@@ -68,6 +82,8 @@ void exec_test() + ) == -1) + throw std::runtime_error("Failed to add embedded_hello to the interpreter's " + "builtin modules"); ++ ++ PyCtx ctx; + // Retrieve the main module + python::object main = python::import("__main__"); + +@@ -148,41 +164,43 @@ void check_pyerr(bool pyerr_expected=fal + } + } + ++template ++bool ++run_and_handle_exception(Cb cb, bool pyerr_expected = false) ++{ ++ PyCtx ctx; ++ if (python::handle_exception(cb)) { ++ check_pyerr(pyerr_expected); ++ return true; ++ } else { ++ return false; ++ } ++} ++ + int main(int argc, char **argv) + { + BOOST_TEST(argc == 2 || argc == 3); + std::string script = argv[1]; +- // Initialize the interpreter +- Py_Initialize(); + +- if (python::handle_exception(eval_test)) { +- check_pyerr(); +- } +- else if(python::handle_exception(exec_test)) { +- check_pyerr(); +- } +- else if (python::handle_exception(boost::bind(exec_file_test, script))) { ++ // N.B. exec_test mustn't be called through run_and_handle_exception ++ // as it needs to handles the python context by itself. ++ if (run_and_handle_exception(eval_test) ++ || python::handle_exception(exec_test)) + check_pyerr(); +- } +- +- if (python::handle_exception(exec_test_error)) +- { +- check_pyerr(/*pyerr_expected*/ true); +- } + else +- { ++ run_and_handle_exception(boost::bind(exec_file_test, script)); ++ ++ if (!run_and_handle_exception(exec_test_error, true)) + BOOST_ERROR("Python exception expected, but not seen."); +- } + + if (argc > 2) { ++ PyCtx ctx; + // The main purpose is to test compilation. Since this test generates + // a file and I (rwgk) am uncertain about the side-effects, run it only + // if explicitly requested. + exercise_embedding_html(); + } + +- // Boost.Python doesn't support Py_Finalize yet. +- // Py_Finalize(); + return boost::report_errors(); + } + + +Diff finished. Fri Jan 9 21:31:13 2015 diff --git a/boost.spec b/boost.spec index 1796330..5472ba8 100644 --- a/boost.spec +++ b/boost.spec @@ -36,7 +36,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.55.0 %define version_enc 1_55_0 -Release: 6%{?dist} +Release: 8%{?dist} License: Boost and MIT and Python %define toplev_dirname %{name}_%{version_enc} @@ -165,6 +165,11 @@ Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch Patch59: boost-1.55.0-atomic-int128_1.patch Patch60: boost-1.55.0-atomic-int128_2.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1102667 +Patch61: boost-1.55.0-python-libpython_dep.patch +Patch62: boost-1.55.0-python-abi_letters.patch +Patch63: boost-1.55.0-python-test-PyImport_AppendInittab.patch + %bcond_with tests %bcond_with docs_generated @@ -654,6 +659,9 @@ a number of significant features and is now developed independently %patch58 -p1 %patch59 -p2 %patch60 -p2 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 # At least python2_version needs to be a macro so that it's visible in # %%install as well. @@ -674,11 +682,13 @@ cat >> ./tools/build/v2/user-config.jam << EOF # There are many strict aliasing warnings, and it's not feasible to go # through them all at this time. using gcc : : : -fno-strict-aliasing ; +%if %{with openmpi} || %{with mpich} using mpi ; +%endif %if %{with python3} # This _adds_ extra python version. It doesn't replace whatever # python 2.X is default on the system. -using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} ; +using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} : : : : %{python3_abiflags} ; %endif EOF @@ -1256,6 +1266,15 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/bjam.1* %changelog +* Fri Jan 9 2015 Petr Machata - 1.55.0-8 +- Build libboost_python and libboost_python3 such that they depend on + their respective libpython's. + (boost-1.55.0-python-libpython_dep.patch, + boost-1.55.0-python-abi_letters.patch) +- Fix Boost.Python test suite so that PyImport_AppendInittab is called + before PyInitialize, which broke the test suite with Python 3. + (boost-1.55.0-python-test-PyImport_AppendInittab.patch) + * Fri Jan 2 2015 Petr Machata - 1.55.0-6 - Boost.Atomic: Fixed incorrect initialization of 128-bit values, when no native support for 128-bit integers is available.