Skip to content

Add support for modular build structure. - #196

Merged
Becheler merged 1 commit into
boostorg:developfrom
grafikrobot:modular
Sep 10, 2026
Merged

Add support for modular build structure.#196
Becheler merged 1 commit into
boostorg:developfrom
grafikrobot:modular

Conversation

@grafikrobot

@grafikrobot grafikrobot commented Jul 20, 2024

Copy link
Copy Markdown
Member

This is part of the effort to make the Boost libraries "modular" for build and consumption. See https://lists.boost.org/Archives/boost/2024/01/255704.php and https://github.com/grafikrobot/boost-b2-modular/blob/b2-modular/README.adoc for more information.

This PR depends on the following other PRs being merged to both develop and master branches of the respective repos:

This PR will be changed to ready for review, i.e. not draft, when the above are merged. Do not merge this one until that time.

@grafikrobot
grafikrobot marked this pull request as ready for review August 18, 2024 15:13
@grafikrobot

Copy link
Copy Markdown
Member Author

Please review and merge this PR at your earliest convenience.

@grafikrobot

Copy link
Copy Markdown
Member Author

Regarding the CI failures..

  1. MacOS fails with: test/tensor/tensor/test_tensor_operator_arithmetic_binary.cpp:58: error: in "test_tensor_binary_arithmetic/test_tensor_dynamic<std____1__pair<float_ boost__numeric__ublas__basic_column_major>>": check r(i) == t2(i) / (t1(i)+three)*(t1(i)+one) - t2(i) has failed [-1.71428585 != -1.71428561] -- Which looks like a library issue, and nothing I can do about it.
  2. Clang Sanitizer fails building file_system lib with many errors of: undefined reference to `__ubsan_handle_type_mismatch_v1' -- I'll see if I can fix that, and add it to the various other CI fixes I've done.
  3. Linux fails with a bunch of constexpr compile errors. Nothing related to this PR.
  4. Windows fails with a variety of compile errors. The library probably needs to be looked at for msvc latest compatibility issues?

I'll investigate 2 further. But everything else someone else would need to deal with. And I suspect it's all existing issues unrelated to this PR.

@Becheler Becheler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope that helps a bit 😅

Comment thread .github/workflows/linux.yml Outdated

- name: Install Clang 10
if: matrix.config.cxx == 'clang++-10'
run: sudo apt-get update && sudo apt-get install -y clang-10

@Becheler Becheler Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../../../boost/numeric/ublas/tensor/extents/extents_static_size.hpp:74:5: note: non-constexpr function 'copy<const unsigned long *, unsigned long *>' cannot be used in a constant expression
    std::copy(li.begin(), li.end(), _base.begin());

Ubuntu 20.04 ships with libstdc++9, where std::copy is not constexpr:

run: sudo apt-get update && sudo apt-get install -y clang-10 libstdc++-10-dev

Comment thread .github/workflows/linux.yml Outdated

- name: Install Clang 11
if: matrix.config.cxx == 'clang++-11'
run: sudo apt-get update && sudo apt-get install -y clang-11

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run: sudo apt-get update && sudo apt-get install -y clang-11 libstdc++-10-dev
Ubuntu 20.04 ships with libstdc++9, where std::copy is not constexpr

Comment thread test/tensor/Jamfile Outdated
Comment on lines 19 to 20

@Becheler Becheler Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/tensor/tensor/test_tensor_operator_arithmetic_binary.cpp:58: error: in
"test_tensor_binary_arithmetic/test_tensor_dynamic<std____1__pair<float_ boost__numeric__ublas__basic_column_major<unsigned long_ long>>>":
check r(i) == t2(i) / (t1(i)+three)*(t1(i)+one) - t2(i) has failed [-1.71428585 != -1.71428561]

The tests execute for the first time in years, now on arm64 and much newer compilers so suddenly FMA contraction breaks the float equality check in test_tensor_operator_arithmetic_binary.cpp:58

Maybe use -ffp-contract=off ? :

      <toolset>gcc:<cxxflags>"-Wall -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-but-set-variable -ffp-contract=off"
      <toolset>clang:<cxxflags>"-Wall -Wno-unknown-pragmas -Wno-sign-compare -ffp-contract=off"

@Becheler

Becheler commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator
expression_evaluation.hpp(240): error C2678: binary '!=': no operator found which takes a
  left-hand operand of type 'const boost::numeric::ublas::extents_core<unsigned __int64>'
  (or there is no acceptable conversion)

One more possible fix:

using ::operator==;
if constexpr ( std::is_same<T,E>::value )
if(e != expr.e.extents())
return false;

develop pins windows-2019, the PR adds windows-2022 with msvc 14.3 resolving to 14.44. 14.44 no longer treats the block-scope using ::operator==; as a rewrite candidate for !=:

@grafikrobot

Copy link
Copy Markdown
Member Author

Another bit of investigation.. The UBsan errors for filesystem appear to be actual UB in that library.

@Becheler

Becheler commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@grafikrobot look at boostorg/filesystem@3e94c81

Remove sanitizer compiler flags when checking for -Wl,--no-undefined.
Clang has a bug (llvm/llvm-project#60578)
where it doesn't add sanitizer runtime libraries to linker flags, which
results in linking errors when -Wl,--no-undefined or equivalent is used.
We want to know if -Wl,--no-undefined is supported, so to avoid false
negatives remove any sanitizer flags for this check. Users will have to
explicitly specify sanitizer libraries in their linker flags to work
around the clang bug.

Do you think adding ldflags: -shared-libsan on the sanitizer job could work ?

@grafikrobot

Copy link
Copy Markdown
Member Author

Do you think adding ldflags: -shared-libsan on the sanitizer job could work ?

Did not help.. error while loading shared libraries: libclang_rt.ubsan_standalone-x86_64.so.

@Becheler Becheler mentioned this pull request Sep 9, 2026
@Becheler

Becheler commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@grafikrobot I tried those fixes over your PR : bd7392c

and it results in a green CI: #200

I don't know how you want to proceed, you can cherry pick the commit maybe ?

@Becheler
Becheler self-requested a review September 10, 2026 14:52

@Becheler Becheler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you all ! 🥳

@Becheler
Becheler merged commit 1203497 into boostorg:develop Sep 10, 2026
14 checks passed
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

Successfully merging this pull request may close these issues.

4 participants