Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile failure in bernoulli_details.hpp when BOOST_MATH_NO_ATOMIC_INT #673

Closed
heinemml opened this issue Aug 17, 2021 · 6 comments
Closed

Comments

@heinemml
Copy link

I'm currently integrating boost 1.77 into buildroot.

The boost-math build is now failing for the NIOSII Platform.
The Platform does not support atomic ints. So BOOST_MATH_NO_ATOMIC_INT is defined in tools/atomic.hpp.

Since 1.77 this yields the following build error:

In file included from ./boost/math/special_functions/bernoulli.hpp:16,
                 from ./boost/math/special_functions/gamma.hpp:35,
                 from ./boost/math/special_functions/detail/bessel_jy.hpp:14,
                 from ./boost/math/special_functions/bessel.hpp:20,
                 from ./boost/math/special_functions/airy.hpp:12,
                 from ./boost/math/special_functions.hpp:15,
                 from libs/math/build/../src/tr1/pch.hpp:9:
./boost/math/special_functions/detail/bernoulli_details.hpp:560:4: error: 'atomic_counter_type' does not name a type
  560 |    atomic_counter_type m_counter, m_current_precision;
      |    ^~~~~~~~~~~~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp: In constructor 'boost::math::detail::bernoulli_numbers_cache<T, Policy>::bernoulli_numbers_cache()':
./boost/math/special_functions/detail/bernoulli_details.hpp:212:9: error: class 'boost::math::detail::bernoulli_numbers_cache<T, Policy>' does not have any field named 'm_counter'
  212 |       , m_counter(0)
      |         ^~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp:213:9: error: class 'boost::math::detail::bernoulli_numbers_cache<T, Policy>' does not have any field named 'm_current_precision'
  213 |       , m_current_precision(boost::math::tools::digits<T>())
      |         ^~~~~~~~~~~~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp: In member function 'OutputIterator boost::math::detail::bernoulli_numbers_cache<T, Policy>::copy_bernoulli_numbers(OutputIterator, std::size_t, std::size_t, const Policy&)':
./boost/math/special_functions/detail/bernoulli_details.hpp:392:36: error: 'm_counter' was not declared in this scope
  392 |       if((static_cast<std::size_t>(m_counter.load(std::memory_order_consume)) < start + n)
      |                                    ^~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp:393:31: error: 'm_current_precision' was not declared in this scope; did you mean 'double_precision'?
  393 |          || (static_cast<int>(m_current_precision.load(std::memory_order_consume)) < boost::math::tools::digits<T>()))
      |                               ^~~~~~~~~~~~~~~~~~~
      |                               double_precision
./boost/math/special_functions/detail/bernoulli_details.hpp:413:41: error: 'atomic_integer_type' does not name a type
  413 |             m_counter.store(static_cast<atomic_integer_type>(bn.size()), std::memory_order_release);
      |                                         ^~~~~~~~~~~~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp: In member function 'OutputIterator boost::math::detail::bernoulli_numbers_cache<T, Policy>::copy_tangent_numbers(OutputIterator, std::size_t, std::size_t, const Policy&)':
./boost/math/special_functions/detail/bernoulli_details.hpp:504:36: error: 'm_counter' was not declared in this scope
  504 |       if((static_cast<std::size_t>(m_counter.load(std::memory_order_consume)) < start + n)
      |                                    ^~~~~~~~~
./boost/math/special_functions/detail/bernoulli_details.hpp:505:31: error: 'm_current_precision' was not declared in this scope; did you mean 'double_precision'?
  505 |          || (static_cast<int>(m_current_precision.load(std::memory_order_consume)) < boost::math::tools::digits<T>()))
      |                               ^~~~~~~~~~~~~~~~~~~
      |                               double_precision
./boost/math/special_functions/detail/bernoulli_details.hpp:525:41: error: 'atomic_integer_type' does not name a type
  525 |             m_counter.store(static_cast<atomic_integer_type>(bn.size()), std::memory_order_release);
      |                                         ^~~~~~~~~~~~~~~~~~~

Since 1.77 special_functions/detail/bernoulli_details.hpp has no special handling for BOOST_MATH_NO_ATOMIC_INT anymore. Is this intentional or an oversight?

For now I would disable the math build for NIOSII Platform.

@mborland
Copy link
Member

Does the NIOSII platform offer any of the other threading headers (e.g. <mutex>, <thread>, etc.), or is this strictly limited to no hardware implementation of atomics?

@heinemml
Copy link
Author

Dislaimer: I'm not really involved into the nios2 toolchain. I just check the packages against the different buildroot support platforms when updating.

The nios2 toolchain currently used by buildroot is this one: https://toolchains.bootlin.com/downloads/releases/toolchains/nios2/tarballs/nios2--glibc--stable-2020.08-1.tar.bz2
The threading headers are all there.

I think the issue is similar to one we had with boost-atomic (boostorg/atomic#42) since 1.74.

buildroot-auto-update pushed a commit to buildroot/buildroot that referenced this issue Aug 26, 2021
* drop 0001-fenv.patch, issue [0] was marked fixed since boost 1.64 (commit [1])
* drop upstreamed patch 0002
* filesystem now depends on boost-atomic
* math broke the build without always lockfree atomic ints, disable for now. reported at [2].

[0] https://svn.boost.org/trac/boost/ticket/11756
[1] boostorg/test@cb2a1c2
[2] boostorg/math#673

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
[Arnout: improve propagation of reverse dependencies:
 - also update comment of cc-tool;
 - add boost-filesystem to reason of gnuradio, libcpprestsdk, uhd;
 - move dependency to arch-deps of mongodb]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
@jzmaddock
Copy link
Collaborator

Confirmed as an issue.

This will continue to be unsupported, but we should fail much more gracefully so that only the small number of use cases that are unsupported cause issues. I have a few thoughts about that.

@jzmaddock
Copy link
Collaborator

I wonder if I can I get you to verify that #684 fixes this your end?

@heinemml
Copy link
Author

heinemml commented Sep 4, 2021

With this patchset applied I can compile boost-math for niosII again.

So the Bernoulli code is now not available anymore since 1.77.0 on platforms with no atomic ints right?

@jzmaddock
Copy link
Collaborator

It is available for float/double/long double, or without thread safety for user-defined (multiprecision) types.

buildroot-auto-update pushed a commit to buildroot/buildroot that referenced this issue Sep 12, 2021
Boost 1.77.0 broke the build of the math component on architectures
without lockfree atomics. This was reported in [0].

This patch adds the relevant patches from the upstream patchset[1] which fix the build
and removes the dependency on BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS

[0] boostorg/math#673
[1] boostorg/math#684

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
kraj added a commit to YoeDistro/openembedded-core that referenced this issue Dec 2, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

Signed-off-by: Khem Raj <raj.khem@gmail.com>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Dec 2, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Dec 2, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

(From OE-Core rev: 7fd35b4ddf5224167d5b2b343faa3eea0183cf86)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Dec 3, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
seambot pushed a commit to seamapi/poky that referenced this issue Dec 4, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

(From OE-Core rev: 57dc797712abcf83b63694b21d2b3a3f09b1c9bc)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Dec 13, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 57dc797)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
kraj added a commit to YoeDistro/poky-old that referenced this issue Dec 13, 2021
1.77 is broken on architectures which dont have lockfree atomics e.g.
armv5 [1], backport relevant fixes from upstream to unbreak the build

[1] boostorg/math#673

(From OE-Core rev: aaaf763acfca236654e299d3be6a9484355e3be9)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 57dc797712abcf83b63694b21d2b3a3f09b1c9bc)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants