Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#9610 closed Bugs (fixed)

boost fails to build with clang-3.4 and later

Reported by: anonymous Owned by: timblechmann
Milestone: To Be Determined Component: atomic
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc: Andrey.Semashev@…

Description

boost-1.55.0 fails to build with current versions of clang (3.4 and 3.5). It builds fine with clang-3.3. The error is here:

/opt/local/bin/clang++-mp-3.4  -ftemplate-depth-128 -Os -stdlib=libc++ -O3 -finline-functions -Wno-inline -Wall -pedantic -gdwarf-2 -fexceptions -arch i386 -arch x86_64 -Wextra -Wno-long-long -Wno-variadic-macros -Wunused-function -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG  -I"." -c -o "bin.v2/libs/thread/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/link-static/pch-off/threading-multi/pthread/once.o" "libs/thread/src/pthread/once.cpp"
In file included from libs/thread/src/pthread/once.cpp:8:
In file included from libs/thread/src/pthread/./once_atomic.cpp:9:
In file included from ./boost/thread/once.hpp:20:
In file included from ./boost/thread/pthread/once_atomic.hpp:20:
In file included from ./boost/atomic.hpp:12:
In file included from ./boost/atomic/atomic.hpp:17:
In file included from ./boost/atomic/detail/platform.hpp:22:
./boost/atomic/detail/gcc-atomic.hpp:961:64: error: no matching constructor for initialization of 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
                                                               ^  ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit default constructor) not viable:
      requires 0 arguments, but 1 was provided
./boost/atomic/detail/gcc-atomic.hpp:968:22: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type tmp = 0;
                     ^     ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:966:34: warning: unused parameter 'v' [-Wunused-parameter]
    void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
                                 ^
./boost/atomic/detail/gcc-atomic.hpp:966:50: warning: unused parameter 'order' [-Wunused-parameter]
    void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
                                                 ^
./boost/atomic/detail/gcc-atomic.hpp:983:22: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type tmp = 0;
                     ^     ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:981:43: warning: unused parameter 'v' [-Wunused-parameter]
    value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
                                          ^
./boost/atomic/detail/gcc-atomic.hpp:981:59: warning: unused parameter 'order' [-Wunused-parameter]
    value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
                                                          ^
./boost/atomic/detail/gcc-atomic.hpp:997:22: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type expected_s = 0, desired_s = 0;
                     ^            ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:997:38: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type expected_s = 0, desired_s = 0;
                                     ^           ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:993:27: warning: unused parameter 'desired' [-Wunused-parameter]
        value_type const& desired,
                          ^
./boost/atomic/detail/gcc-atomic.hpp:994:22: warning: unused parameter 'success_order' [-Wunused-parameter]
        memory_order success_order,
                     ^
./boost/atomic/detail/gcc-atomic.hpp:995:22: warning: unused parameter 'failure_order' [-Wunused-parameter]
        memory_order failure_order) volatile BOOST_NOEXCEPT
                     ^
./boost/atomic/detail/gcc-atomic.hpp:1013:22: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type expected_s = 0, desired_s = 0;
                     ^            ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:1013:38: error: no viable conversion from 'int' to 'storage_type' (aka
      'boost::atomics::detail::storage128_type')
        storage_type expected_s = 0, desired_s = 0;
                                     ^           ~
./boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known
      conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument
struct BOOST_ALIGNMENT(16) storage128_type
                           ^
./boost/atomic/detail/gcc-atomic.hpp:1009:27: warning: unused parameter 'desired' [-Wunused-parameter]
        value_type const& desired,
                          ^
./boost/atomic/detail/gcc-atomic.hpp:1010:22: warning: unused parameter 'success_order' [-Wunused-parameter]
        memory_order success_order,
                     ^
./boost/atomic/detail/gcc-atomic.hpp:1011:22: warning: unused parameter 'failure_order' [-Wunused-parameter]
        memory_order failure_order) volatile BOOST_NOEXCEPT
                     ^
10 warnings and 7 errors generated.

Change History (12)

comment:1 by Jeremy Sequoia <jeremyhu@…>, 9 years ago

comment:2 by viboes, 9 years ago

Component: Noneatomic
Owner: set to timblechmann

comment:3 by timblechmann, 9 years ago

seems to be already fixed: 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9

comment:4 by timblechmann, 9 years ago

Resolution: fixed
Status: newclosed

comment:5 by Jeremy Sequoia <jeremyhu@…>, 9 years ago

Resolution: fixed
Status: closedreopened

Nope. That doesn't address the issue in boost/atomic/detail/gcc-atomic.hpp. With that change applied, the build still fails in gcc-atomic.hpp as indicated above:

:info:build ./boost/atomic/detail/gcc-atomic.hpp:961:64: error: no matching constructor for initialization of 'storage_type' (aka 'boost::atomics::detail::storage128_type') :info:build explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) :info:build ~

comment:7 by Andrey Semashev, 9 years ago

Cc: Andrey.Semashev@… added

comment:8 by arto@…, 9 years ago

The Boost 1.55.0 build with Clang 3.4 successfully completed for me after manually applying the following two patches:

comment:9 by Andrey Semashev, 9 years ago

Resolution: fixed
Status: reopenedclosed

comment:10 by ruslan_baratov@…, 8 years ago

Possible workaround before fix release is add BOOST_HAS_INT128 definition

comment:11 by Andrey Semashev, 8 years ago

The compiler in topic does not support 128-bit integers, therefore the macro is not defined.

in reply to:  11 comment:12 by ruslan_baratov@…, 8 years ago

Replying to andysem:

The compiler in topic does not support 128-bit integers, therefore the macro is not defined.

Note that clang used to build universal library (x86_64 and i386). So result for me (Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn), Xcode 5.1.1):

  • clang++ -arch i386 (OK, without any changes)
  • clang++ -arch x86_64 -DBOOST_HAS_INT128=1 (OK)

To be honest adding BOOST_HAS_INT128 will break i386 compilation, so this workaround will not help for building universal library))

Related: boost.2283326.n4.nabble.com/config-clang-int128-support-td4653826.html

Note: See TracTickets for help on using tickets.