Anyone have first hand experience building/testing a boost library/application with CMake? I've found the github project for boost/Cmake. Can anyone point me to more useful information? Robert Ramey
On 5/20/24 22:28, Robert Ramey via Boost wrote:
Anyone have first hand experience building/testing a boost library/application with CMake?
Boost.Atomic, Boost.Filesystem and Boost.Log build using CMake is being regularly tested in GHA CI. Boost.Scope tests are run using CMake in one of the jobs.
вт, 21 мая 2024 г. в 01:34, Andrey Semashev via Boost
Boost.Atomic, Boost.Filesystem and Boost.Log build using CMake is being regularly tested in GHA CI.
Boost.Scope tests are run using CMake in one of the jobs.
Boost.JSON builds using CMake in 3 usage variants (as part of the superproject, as a main project, and as a subdirectory). All tested in CI. If you have any specific questions, Robert, please ask.
Am 20.05.24 um 21:28 schrieb Robert Ramey via Boost:
Anyone have first hand experience building/testing a boost library/application with CMake? I've found the github project for boost/Cmake. Can anyone point me to more useful information?
There are many libraries ready for building & testing with CMake: Mentioned (Atomic, Filesystem, Log, JSON), Mine (Nowide, Locale) and likely all Peter is maintaining. Useful Information are in the Readme at https://github.com/boostorg/cmake Examples in each library CI configs and the templates of Boost.CI: https://github.com/boostorg/boost-ci/blob/master/.github/workflows/ci.yml To get you started: cd $BOOST_ROOT mkdir build_cmake && cd build_cmake variant=Debug # Or Relase, or RelWithDebInfo cmake -DCMAKE_BUILD_TYPE=$variant -DBOOST_INCLUDE_LIBRARIES='locale;atomic;log;time' -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. cmake --build . --target tests --config $variant -j 16 ctest --output-on-failure --no-tests=error -C $variant -j 16 - BUILD_SHARED_LIBS can be ON or OFF for shared or static libraries - On Linux $variant typically only needs to be in the first `cmake` invocation, but it doesn't hurt in the others - Convenience targets "tests" and "check" exists (build command) to build all tests (& dependencies) and run them ("check" target) Alex
Hans Dembinski wrote:
On 21. May 2024, at 09:24, Alexander Grund via Boost
wrote: There are many libraries ready for building & testing with CMake: Mentioned (Atomic, Filesystem, Log, JSON), Mine (Nowide, Locale) and likely all Peter is maintaining.
Histogram, too.
All libraries build under CMake. To see what of them have CMake tests, you can look at this CI run: https://github.com/boostorg/boost/actions/runs/9171879935/job/25217197221 This excludes Geometry because its tests take an (additional) hour. :-) Developer documentation (not yet quite finished) is here: https://github.com/boostorg/cmake/blob/develop/developer.md but it doesn't yet cover testing. (It's on my to-do list.) There are several ways to implement testing, for each one there's probably an existing library that can be used as a template. The easiest one is to use boost_test_jamfile, which takes an existing Jamfile in test/ and (simple-mindedly) interprets it to create CMake tests. Endian is an example of using this testing strategy: https://github.com/boostorg/endian/blob/develop/test/CMakeLists.txt https://github.com/boostorg/endian/blob/develop/test/Jamfile.v2
Thanks to all for the useful information. I've been studying all this. My interest is to remove b2 from the mix and still provide all the facility that I now enjoy. I have CMake testing implemented but it's not really integrated in the way that I want. I want to generate my Library_Status table for my libraries. I would also like to implement support for CDash. I've complained about the current system for years. It's just gotten to the point where I can't continue without fixing it up to my taste. We'll see how it goes. Robert Ramey
On Tue, May 21, 2024 at 10:42 AM Robert Ramey via Boost
My interest is to remove b2 from the mix and still provide all the facility that I now enjoy.
You can't. It's required for the general testing and release management.
I have CMake testing implemented but it's not really integrated in the way that I want. I want to generate my Library_Status table for my libraries. I would also like to implement support for CDash.
That's all great. As long as it's in addition to the B2 support.
I've complained about the current system for years. It's just gotten to the point where I can't continue without fixing it up to my taste.
Has there been a point where I didn't address, or try to address, your concerns with B2? Or are the problems outside of B2? -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supone Nada -- Robot Dreams - http://robot-dreams.net
In article
On Tue, May 21, 2024 at 10:42 AM Robert Ramey via Boost
wrote: My interest is to remove b2 from the mix and still provide all the facility that I now enjoy.
You can't. It's required for the general testing and release management.
Well, that's a shame. If I'm writing a new library for inclusion in boost, the *last* thing I want to do is write b2 scripts. If I'm understanding you correctly, I'd consider requiring legacy b2 scripts a barrier to entry for new libraries. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Terminals Wiki http://terminals-wiki.org The Computer Graphics Museum http://computergraphicsmuseum.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
On Tue, May 21, 2024 at 2:50 PM Richard via Boost
Well, that's a shame. If I'm writing a new library for inclusion in boost, the *last* thing I want to do is write b2 scripts.
Are you volunteering to: 1. Write new release scripts which use cmake instead of b2, 2. Implement the building of all documentation using cmake 3. Submit pull requests to all libs to update their build scripts for cmake (docs included)? Thanks
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
Are you volunteering to: 1. Write new release scripts which use cmake instead of b2,
Maybe we should start considering it, given that we're already running into discrepancies like so: On Tue, May 21, 2024 at 11:05 AM Alain O' Miniussi via Boost <
boost@lists.boost.org> wrote:
I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
Fwiw, Unordered is actually kind of guilty of this as well. Unordered's Jamfile has more tests than its CMake files do. This certainly isn't ideal and shows the pain of maintaining two separate build systems. Rewriting the release script to do its testing and generation of the install tree via CMake shouldn't be a huge change in theory, I'd imagine. But I've never looked at the scripts. All I know is, building Boost via CMake is very doable and running the tests is similarly doable. Documentation can still be generated by b2 for now. 3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year! In general, I agree with Richard's sentiment. b2 is holding Boost back and nowadays, even packagers are moving on from it and are building Boost purely via CMake or are relying on Boost's CMake support. I'm thinking of vcpkg's modular Boost and CMake's FindBoost now dispatching to the official boost-config.cmake. - Christian
On 5/22/24 01:50, Christian Mazakas via Boost wrote:
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
Are you volunteering to: 1. Write new release scripts which use cmake instead of b2,
Maybe we should start considering it, given that we're already running into discrepancies like so:
Switching release scripts to CMake won't remove the need to maintain two build systems as long as we have to support them both for any reason. That is, dropping Boost.Build would require *everything* to work via CMake, not just the release scripts. Also, dropping Boost.Build would be a breaking change to those users who actually use Boost.Build. I'm not sure how many there are, but I suspect they do exist. I wonder if Boost.Build could be somehow improved to interface with CMake, so that Boost transition to CMake-only, if and when it happens, is more or less painless for the users.
Fwiw, Unordered is actually kind of guilty of this as well. Unordered's Jamfile has more tests than its CMake files do.
This certainly isn't ideal and shows the pain of maintaining two separate build systems.
One way to keep the build systems in sync is not having to sync at all. Just scan the filesystem and generate targets for tests based on what is found. This can be done more or less equivalently in both Boost.Build and CMake. For example: https://github.com/boostorg/scope/blob/eea343a918c586387b1b717c31c0a24bc612e... https://github.com/boostorg/scope/blob/eea343a918c586387b1b717c31c0a24bc612e... Of course, it isn't quite as easy for building the library, but for tests it's very doable.
Rewriting the release script to do its testing and generation of the install tree via CMake shouldn't be a huge change in theory, I'd imagine. But I've never looked at the scripts. All I know is, building Boost via CMake is very doable and running the tests is similarly doable.
One significant difference between the official releases on jfrog from CMake releases is the unified include tree. This tree is needed for building docs (at least, for some libraries), as well as some Boost users and packagers. If we are going to preserve our official releases backward compatible, CMake needs to be able to generate the unified header tree.
On Tue, May 21, 2024 at 5:50 PM Christian Mazakas via Boost
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
Are you volunteering to: 1. Write new release scripts which use cmake instead of b2,
Maybe we should start considering it, given that we're already running into discrepancies like so:
On Tue, May 21, 2024 at 11:05 AM Alain O' Miniussi via Boost <
boost@lists.boost.org> wrote:
I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
Fwiw, Unordered is actually kind of guilty of this as well. Unordered's Jamfile has more tests than its CMake files do.
You might consider using some file globbing, on both b2 and cmake, to make it less likely that happens.
This certainly isn't ideal and shows the pain of maintaining two separate build systems.
Rewriting the release script to do its testing and generation of the install tree via CMake shouldn't be a huge change in theory, I'd imagine. But I've never looked at the scripts. All I know is, building Boost via CMake is very doable and running the tests is similarly doable.
Documentation can still be generated by b2 for now.
3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year!
As a data point.. I submitted some "test the waters" PRs for b2 modular changes, in reality build and source fixes, for some libraries some time ago. One of them took 11 months for it to get merged. And it got merged by a Boost ORG owner instead of the library author/maintainer.
In general, I agree with Richard's sentiment. b2 is holding Boost back and
How is it doing that?
nowadays, even packagers are moving on from it and are building Boost purely via CMake or are relying on Boost's CMake support. I'm thinking of vcpkg's modular Boost and CMake's FindBoost now dispatching to the official boost-config.cmake.
AFAIK all package managers, except maybe build2, build Boost packages with B2. Some do use the config.cmake files that the B2 build generates. Others generate those themselves. -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supone Nada -- Robot Dreams - http://robot-dreams.net
Christian Mazakas wrote:
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
...
3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year!
We're already done because all of Boost builds (and installs) with CMake.
In general, I agree with Richard's sentiment. b2 is holding Boost back...
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects. There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
On 5/21/24 7:28 PM, Peter Dimov via Boost wrote:
Christian Mazakas wrote:
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
...
3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year!
We're already done because all of Boost builds (and installs) with CMake.
In general, I agree with Richard's sentiment. b2 is holding Boost back...
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects.
Hmmm ... Better in what way? They should produce the same result or close to it. My problem with B2 is that its complex, hard to understand, a lot of work to maintain and fragile. I also very much like that CMake can be used to create GUI projects in XCode, VS, etc. I actually use this facility. There are other issues besides, but I don't want to confuse the discussion here. I'm surprised that CMake is used by other developers to the extent that it is. I will look into this.
There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
вт, 21 мая 2024 г. в 18:42, Robert Ramey via Boost
I would also like to implement support for CDash.
You keep bringing up CDash. How is it in any way better than having a
proper CI system? It's basically CI, but manual, and with fewer
platforms.
вт, 21 мая 2024 г. в 21:05, Alain O' Miniussi via Boost
I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
This implies that MPI is not fully tested for release.
ср, 22 мая 2024 г. в 07:55, Robert Ramey via Boost
Hmmm ... Better in what way? They should produce the same result or close to it. My problem with B2 is that its complex, hard to understand, a lot of work to maintain and fragile.
I wondered what makes b2 so complex compared to CMake, so I opened two files from your project: one for b2 build, and another for CMake build https://github.com/boostorg/safe_numerics/blob/develop/test/Jamfile.v2 https://github.com/boostorg/safe_numerics/blob/develop/test/CMakeLists.txt Both look very simple and linear. The difference with the CMake file is that it sets properties used by IDE generators. Now, the CMake file uses such functions like test_run_pass, test_compile_pass, and test_compile_fail. These functions aren't a part of CMake itself, they are defined inside the project's root CML. For example, this is the definition of test_compile_fail: https://github.com/boostorg/safe_numerics/blob/develop/CMakeLists.txt#L129-L... So, the test is supposed to be run, fail, and the developer mentally (although, I guess physically, in a notebook, also works) checks it as succeeding. In a way it is in line with your appreciation for CDash, which is a sort of manual CI. Some people may think that surely, there should be a less backwards way to run compile-fail tests in CMake. There is! Peter Dimov has implemented it as part of his CMake support: https://github.com/boostorg/cmake/blob/develop/include/BoostTest.cmake#L187-.... The trick is to automate the "run and fail" part. The function launches _another_ instance of CMake that tries to build the target and fails. So, to be honest, I'm not a fan of abandoning b2 in favour of CMake. And I didn't even touch on multiconfig builds.
I also very much like that CMake can be used to create GUI projects in XCode, VS, etc. I actually use this facility.
I give you this, CMake does have good integration with IDEs. BTW, there have been several remarks about people having problems with b2 which couldn't be solved. But I don't see those on ML. Maybe I'm not subscribed to the correct list? I would be glad to help you with those issues, if I can.
Дмитрий Архипов wrote:
Some people may think that surely, there should be a less backwards way to run compile-fail tests in CMake. There is! Peter Dimov has implemented it as part of his CMake support: https://github.com/boostorg/cmake/blob/develop/include/BoostTest.cmake#L187-.... The trick is to automate the "run and fail" part. The function launches _another_ instance of CMake that tries to build the target and fails.
In fairness Robert's function does the same thing. The problem with this approach is that it doesn't work in parallel (ctest -j). Hence the RUN_SERIAL TRUE in https://github.com/boostorg/cmake/blob/6dcde32c82f7c1fef67b6e61db862f73e4809...
----- On May 22, 2024, at 9:55 AM, Дмитрий Архипов via Boost boost@lists.boost.org wrote:
вт, 21 мая 2024 г. в 18:42, Robert Ramey via Boost
: I would also like to implement support for CDash.
вт, 21 мая 2024 г. в 21:05, Alain O' Miniussi via Boost
: I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
This implies that MPI is not fully tested for release.
It's never been, at some point b2 did not support some versions of Intel MPI, so all these were dropped. I was answered that "this is an Intel problem", which was true, but not helpful. Some other MPI implementation had their own issues. Depending on the cluster configuration, I need to switch between mpirun, mpiexec, srun etc... I'm sure it can be done with b2, but I don't even know where to start. I can't even find where the b2 MPI test launcher is located. And it's not widespread to the point that people will be likely to address these problems.
ср, 22 мая 2024 г. в 07:55, Robert Ramey via Boost
: Hmmm ... Better in what way? They should produce the same result or close to it. My problem with B2 is that its complex, hard to understand, a lot of work to maintain and fragile.
I wondered what makes b2 so complex compared to CMake, so I opened two files from your project: one for b2 build, and another for CMake build https://github.com/boostorg/safe_numerics/blob/develop/test/Jamfile.v2 https://github.com/boostorg/safe_numerics/blob/develop/test/CMakeLists.txt
I find them difficult to write, not to read. - Alain
Alain O' Miniussi wrote:
I can't even find where the b2 MPI test launcher is located.
Should be here somewhere: https://github.com/bfgroup/b2/blob/main/src/tools/mpi.jam Seems documented, even https://github.com/bfgroup/b2/blob/cd7c1537f81d1fc408ea3124c997aa7ba539a606/...
----- On May 22, 2024, at 3:14 PM, Peter Dimov via Boost boost@lists.boost.org wrote:
Alain O' Miniussi wrote:
I can't even find where the b2 MPI test launcher is located.
Should be here somewhere:
https://github.com/bfgroup/b2/blob/main/src/tools/mpi.jam
Seems documented, even
https://github.com/bfgroup/b2/blob/cd7c1537f81d1fc408ea3124c997aa7ba539a606/...
Thanks, Actually, the part I should be looking for is more around line 588 (class mpi-test-generator). I guess I did at some point.
Am 22.05.2024 um 04:28 schrieb Peter Dimov via Boost:
Christian Mazakas wrote:
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
...
3. Submit pull requests to all libs to update their build scripts for cmake This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year! We're already done because all of Boost builds (and installs) with CMake.
In general, I agree with Richard's sentiment. b2 is holding Boost back... It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects. Correct. There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
You speak truth.
Peter Dimov via Boost
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects.
That may be true, but if you took a vote among all the Boost users asking them which build system Boost should drop, I think it's pretty clear what the large majority's answer would be.
There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
A less obvious benefit of dropping one of the two build systems is that it frees you up to potentially adopt a forward-looking build system (or rather build system + package manager toolchain). While supporting two build systems has its overheads, supporting three would be untenable. I guess another way of putting it, what substantial benefit does b2 provide to Boost that is not provided by CMake or could not be provided by another build system (that would also provide other substantial benefits)?
Boris Kolpackov wrote:
Peter Dimov via Boost
writes: It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects.
That may be true, but if you took a vote among all the Boost users asking them which build system Boost should drop, I think it's pretty clear what the large majority's answer would be.
If we supported build2 and CMake and we took that same vote, I'm fairly sure what the answer would be, too.
A less obvious benefit of dropping one of the two build systems is that it frees you up to potentially adopt a forward-looking build system (or rather build system + package manager toolchain). While supporting two build systems has its overheads, supporting three would be untenable.
I guess another way of putting it, what substantial benefit does b2 provide to Boost that is not provided by CMake ...
From my point of view, some examples are
b2 toolset=msvc-14.3,gcc warnings=extra warnings-as-errors=on or b2 toolset=msvc-14.0,msvc-14.1,msvc-14.2,msvc-14.3 cxxstd=14,latest variant=debug,release or b2 toolset=gcc,clang undefined-sanitizer=norecover or b2 libs/something/test where that last line doesn't need a separate run with -DBUILD_TESTING=ON, or -DBOOST_INCLUDE_LIBRARIES=something, or a separate ctest run, all test types are supported equally well, and everything is automatically parallelized. Some of these are easy to add to CMake, others not. (But then again, they have still not been.)
Peter Dimov
Boris Kolpackov wrote:
That may be true, but if you took a vote among all the Boost users asking them which build system Boost should drop, I think it's pretty clear what the large majority's answer would be.
If we supported build2 and CMake and we took that same vote, I'm fairly sure what the answer would be, too.
Yes, at this stage the answer to "CMake vs X" is clear for any X. But in case of build2 I believe you would at least be able give some tangible reasons as to why you are supporting both.
From my point of view, some examples are
b2 toolset=msvc-14.3,gcc warnings=extra warnings-as-errors=on
or
b2 toolset=msvc-14.0,msvc-14.1,msvc-14.2,msvc-14.3 cxxstd=14,latest variant=debug,release
or
b2 toolset=gcc,clang undefined-sanitizer=norecover
or
b2 libs/something/test
where that last line doesn't need a separate run with -DBUILD_TESTING=ON, or -DBOOST_INCLUDE_LIBRARIES=something, or a separate ctest run, all test types are supported equally well, and everything is automatically parallelized.
The common theme for these examples is the fundamental limitations of meta-build systems compared to native build systems: - Meta-build systems are limited by the underlying build systems (make, ninja, msbuild, etc) that they must delegate to. - Meta-build systems partition the build graph into two disjoint (or poorly joint) sub-graphs: configuration/project generation and build proper (in a sense, this is the same problem as "recursive make considered harmful"). So maybe the insights here are: 1. It's unfortunate that the C++ community has largely settled on a meta-build system. 2. In a complex project like Boost there will always be a need for a native build system to accommodate more advanced use-cases. And, FWIW, all of the examples you have shown can be done with build2. The mental model is a bit different and some things are a bit more verbose at the moment, but the fundamentals like the ability to build with multiple compilers in the same build system invocation or automatically pull what's necessary is there. BTW, can b2 do something like this: b2 host-toolset=gcc host-variant=release toolset=aarch64-linux-gnu-gcc variant=debug And then build tools used during the build (like Qt moc) with (host) GCC while the rest with (target) GCC cross-compiler?
Boris Kolpackov wrote:
But in case of build2 I believe you would at least be able give some tangible reasons as to why you are supporting both.
Honestly...
The common theme for these examples is the fundamental limitations of meta- build systems compared to native build systems:
- Meta-build systems are limited by the underlying build systems (make, ninja, msbuild, etc) that they must delegate to.
- Meta-build systems partition the build graph into two disjoint (or poorly joint) sub-graphs: configuration/project generation and build proper (in a sense, this is the same problem as "recursive make considered harmful").
That's part of it, but not all. Abstracting toolset-specific compile options, or rather lack of it, is not caused by any of the above. E.g. exception-handling=off, rtti=off, warnings-as-errors=on. There's nothing in CMake's architecture that precludes it, it's just not done. For the user audience who needs to build something with a specific toolset, using specific options, that's not an issue - you just hardcode the CMAKE_CXX_FLAGS. But for the audience of me who needs to write his test/CMakeLists.txt such that test_no_exceptions.cpp is compiled without exceptions, regardless of the user generator or compiler, this won't do at all. That's one reason why CMake isn't better _for me_, the developer who needs to write the build script. (There are of course reasons why CMake _is_ better for me.) Then there's the separate "run ctest" phase, which you didn't list. In b2, running tests is done by the build phase, each test has its own build node, is handled uniformly, participates in the parallel build, etc. You can tell b2 "build and run this specific test", and it will build the test and whatever it depends on, then run it.
Peter Dimov
For the user audience who needs to build something with a specific toolset, using specific options, that's not an issue - you just hardcode the CMAKE_CXX_FLAGS. But for the audience of me who needs to write his test/CMakeLists.txt such that test_no_exceptions.cpp is compiled without exceptions, regardless of the user generator or compiler, this won't do at all.
Hm, in my experience it's the other way around: end-users find it too tedious to remember the sequence of options to enable the right set of warnings for each compiler, etc. On the other hand, how often do you write a test that needs to be built with exceptions disables and how hard is it to specify the actual options for essentially two classes of C++ compilers: MSVC and everything else?
Then there's the separate "run ctest" phase, which you didn't list.
I am not certain why they did it this way but I strongly suspect one of the main reasons is the limitation of the underlying build systems they have to support (point 1 in my list).
Boris Kolpackov wrote:
Hm, in my experience it's the other way around: end-users find it too tedious to remember the sequence of options to enable the right set of warnings for each compiler, etc. On the other hand, how often do you write a test that needs to be built with exceptions disables...
Maybe not very often, but each time a user reports "your library doesn't compile/work with exceptions disabled." That's perhaps not as frequent as "your library doesn't compile with -Werror" but it does happen.
... and how hard is it to specify the actual options for essentially two classes of C++ compilers: MSVC and everything else?
boost_test already solves this, as it's smart enough to translate some compile options to msvc-ese https://github.com/boostorg/cmake/blob/6dcde32c82f7c1fef67b6e61db862f73e4809... but that's not quite the same as having built-in support. b2, for instance, allows me to do this run my_test.cpp : : : <target-os>darwin,<undefined-sanitizer>norecover:<build>no ; which isn't as convenient with a flag soup. Expressing something like this, for example https://github.com/boostorg/throw_exception/blob/7c8ec2114bc1f9ab2a8afbd629b... with CMake is much more verbose and not as general.
ср, 22 мая 2024 г. в 12:27, Boris Kolpackov via Boost
BTW, can b2 do something like this:
b2 host-toolset=gcc host-variant=release toolset=aarch64-linux-gnu-gcc variant=debug
The quick answer is "not exactly, and not out of the box". The long answer follows. As b2 is not a package manager, it doesn't have a special understanding of build and target platforms. In b2 every target has _some_ target platform implicitly defined by the sum of its properties, and some of those properties also implicitly define the build platform. So, there's no notion of build and target for the entire target graph. But you can create a dedicated feature that sets the properties of the build platform. To be clear, it's fairly non-trivial to do, but see this: https://gist.github.com/grisumbras/040b3b5ffc3572e395cbb3a8c9c11c09 If built with b2 host-platform=x86_64-linux-gnu-release variant=debug target-os=windows toolset=gcc the preprocessor program (moxtool) is built for the host (Linux), and the library is built for Windows.
Дмитрий Архипов via Boost
The long answer follows.
Thanks, interesting.
As b2 is not a package manager, it doesn't have a special understanding of build and target platforms.
Hm, I don't see why this understanding can only be achieved in the package manager. It is true that the specification of dependencies between packages is where traditionally the built- time vs run-time distinction is made. But this knowledge is only necessary to automatically sort the packages into correct configurations. Provided that things are manually configured to build for host/target, nothing should prevent a build system from handling the rest. At least that's how it works in build2 (where the package manager sits on top of the build system rather than them being fused together).
On 22/05/2024 08:58, Peter Dimov via Boost wrote:
I guess another way of putting it, what substantial benefit does b2 provide to Boost that is not provided by CMake ...
From my point of view, some examples are
b2 toolset=msvc-14.3,gcc warnings=extra warnings-as-errors=on
or
b2 toolset=msvc-14.0,msvc-14.1,msvc-14.2,msvc-14.3 cxxstd=14,latest variant=debug,release
or
b2 toolset=gcc,clang undefined-sanitizer=norecover
or
b2 libs/something/test
where that last line doesn't need a separate run with -DBUILD_TESTING=ON, or -DBOOST_INCLUDE_LIBRARIES=something, or a separate ctest run, all test types are supported equally well, and everything is automatically parallelized.
I thought somebody else might reply to this specific set of why b2 has advantages over cmake, but they didn't, so I suppose I will. Build variants are provided by toolchain files in cmake. You can provide a directory of canned toolchain files named by what they do (e.g. gcc-12-asan.cmake), this is what most do, but there is another option: cmake script files which generate toolchain files on the fly. cmake has a perfectly good scripting functionality such that one could write a b2.cmake whereby: ``` cmake -P b2.cmake -- toolset=msvc-14.0,msvc-14.1,msvc-14.2,msvc-14.3 cxxstd=14,latest variant=debug,release ``` if you don't want to run the test suite, or: ``` ctest -S b2.cmake -- toolset=msvc-14.0,msvc-14.1,msvc-14.2,msvc-14.3 cxxstd=14,latest variant=debug,release ``` if you do want to run the test suite. The cmake script file writes out the toolchain files for each toolset, and invokes cmake/ctest to do each of the builds per toolchain file. If one so chose, the b2.bat/b2 shell script could then invoke cmake -P b2.cmake/ctest -S b2.cmake as appropriate in a way that existing b2 based build systems would mostly "just works". You thus migrate to a 100% cmake based build fully portable to everywhere cmake works, but `b2` works just as now. Now as to whether this is worth doing or not ... for me personally, b2 gets the job of building Boost done, for that it "just works". Where I have been very keen on cmake build support is for when I wish to directly include a part of Boost into my existing code not as an external project, or imported targets, but **directly** because of large advantages to seeing Boost internals in debuggers, or for particularly bespoke or custom build settings. And Boost's cmake support now does all that, so for me I'm satiated and happy as an end user. For Boost library devs and the release maintainers it's a very different set of trade offs, but they're a tiny minority of the userbase, so TBH whatever suits them best they can choose. If they want to maintain two build systems, rock on. My only skin in the game is a header only library, so I really don't mind what is chosen so long as the userbase still gets full fat Boost cmake build support. Niall
----- On May 22, 2024, at 4:28 AM, Peter Dimov via Boost boost@lists.boost.org wrote:
Christian Mazakas wrote:
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
...
3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year!
We're already done because all of Boost builds (and installs) with CMake.
In general, I agree with Richard's sentiment. b2 is holding Boost back...
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake,
Which, after so many years, could be an interesting information by itself... Plus the fact that it failed to replace CMake out there. Maybe it's better, but either it's not better enough, either there is something preventing it to to take over. But in both cases, as the philosopher once said, "This not my war".
and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects.
I have to use CMake in other project, know where to find the doc, and anything I learn fixing CMake related problem will be useful to me in other context. I'll probably forget whatever I learn about b2.
There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
Assuming they both suck equally (they're build system, they all suck), it's same to assume one is better known than the other. PS: my contributions to boost are limited enough (b2 being just one small reason) that my opinion can be safely disregarded.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On Tue, May 21, 2024 at 7:28 PM Peter Dimov via Boost
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects.
There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted.
For what it's worth, I'm not proposing anything concrete or actionable. But I was, ironically, musing the other day if b2 was holding Boost back from receiving more outside contributions. If we want Boost to survive and thrive, we need contributors. Potential contributors don't know b2, they know CMake. We can argue that yes, libraries support CMake and contributors can use that as their primary tooling but b2 will eventually worm its way into the equation. Whether or not b2 is a better build system is irrelevant because no one knows it and no one seems keen on learning it. It's relegated solely to Boost and its developers. All that being said, this was just something I was musing. I have no idea in all actuality if completely dropping b2 will bring contributors back to Boost. But I kind of agree with Richard in that, I think it is a turn off. The usage of "warranted" stood out to me, btw. We should regularly evaluate our tools and consider technical costs and potential directions we might want to steer the project. Where will Boost be and what state will it be in five years from now? What state do we want it to be in? - Christian
Christian Mazakas wrote:
For what it's worth, I'm not proposing anything concrete or actionable. But I was, ironically, musing the other day if b2 was holding Boost back from receiving more outside contributions.
The only part of Boost suffering from lack of outside contributions is b2 itself, which problem is not going to be solved by dropping b2.
On Wed, May 22, 2024 at 9:38 AM Peter Dimov via Boost
The only part of Boost suffering from lack of outside contributions is b2 itself, which problem is not going to be solved by dropping b2.
Yup. This is the alternative path. With some elbow grease, we could make b2 a lot better. Maybe it'd be good if we enumerate our gripes with it so we at least have an outline here. One of my biggest gripes with it is how permissive it can be in many cases. It'd be nice if there were strict modes where you can require something like zlib and b2 fails if it's not found. Maybe this is already supported but who knows. I think it's also a function of documentation and working examples as well. Error message output also isn't the best with b2 either. I'm thinking about the time I forgot to add a: using asciidoctor ; to my user-config.jam. b2's output was absolutely unintelligible to me and it was even to the people walking me through the steps. - Christian
ср, 22 мая 2024 г. в 19:59, Christian Mazakas via Boost
Yup. This is the alternative path. With some elbow grease, we could make b2 a lot better.
Maybe it'd be good if we enumerate our gripes with it so we at least have an outline here.
One of my biggest gripes with it is how permissive it can be in many cases. It'd be nice if there were strict modes where you can require something like zlib and b2 fails if it's not found. Maybe this is already supported but who knows.
If I understand correctly what you are talking about it is in fact Boost's jam scripts make these errors so silent. Essentially, a lot of tests and libraries are defined so that if you do e.g. `b2 cxxstd=03` everything that can't be built with C++ 03 just silently removes itself from the list of targets to build. This is not actually something b2 does. Historically it seemed like a good idea, but as you have noticed, if things don't work as expected, you sometimes miss that. For this reason I added a warning to Boost.JSON for whe `b2 --with-json` is run, but boost_json is skipped. https://github.com/boostorg/json/blob/develop/build/Jamfile#L18-L55
I think it's also a function of documentation and working examples as well.
Error message output also isn't the best with b2 either. I'm thinking about the time I forgot to add a: using asciidoctor ;
to my user-config.jam. b2's output was absolutely unintelligible to me and
I looked it up and "check if you have using asciidoctor anywhere" was literally my first suggestion. To be fair to your point, "unable to construct compat.html, considered these as possible generators:" is not something you would automatically associate with "asciidoctor module was not properly set up", unless you have some experience with b2. Maybe the warning should list the sources, not just the generators it tried.
From: Boost
On Tue, May 21, 2024 at 2:55 PM Vinnie Falco via Boost < boost@lists.boost.org> wrote:
...
3. Submit pull requests to all libs to update their build scripts for cmake
This will definitely be the most time-consuming part but if we did a library a day every day, we'd be done in like a year!
We're already done because all of Boost builds (and installs) with CMake.
In general, I agree with Richard's sentiment. b2 is holding Boost back...
It's interesting that nobody considers the possibility that b2 is in fact a better build system than CMake, and consequently, that switching from b2 to CMake will actually make things _worse_ in some, if not many, respects. There's this axiomatic assumption that dropping b2 will automatically improve things, somehow, and I don't think it's true or warranted. B2 seems perfectly capable, and it’s use in boost releases mostly proves that – I’m not arguing that CMake has a better feature set, has a more active development community, or is easier to understand. I would argue that CMake is just as good as B2, and it’s advantage is that almost every project in the open source community is using it successfully. Switching is a costly prospect – but the fact that many boost library developers are already paying that price for the advantages they thing CMake gives them means that it has obvious value. My own experience is that using b2 has always been a struggle simply because boost is the only thing I have ever encountered that used it. I also recall that CMake 2.x was no panacea, when I first looked into it I was unimpressed, but in 2024 CMake has no rivals and my team uses it for at least 80 different projects, many of which are legacy systems where the main body of work we’ve done is create the CMake build.
On Wed, May 22, 2024 at 7:13 PM Rob Boehne via Boost
Switching is a costly prospect
There's something that keeps needing to be repeated. How Boost operates is by having volunteers do the work before, during, and after for any change in everything. That's the cost people suggesting a change need to keep in mind. For B2 I've been donating much of that cost for 2 decades. A good chunk of that cost was donated by Vladimir Prus. And others add their value from time to time, like Nikita Kniazev and Dmitry Arkhipov (see B2 changelog for more). For Cmake though so far I'm only aware of Peter Dimov donating the Cmake cost. I.e. people who are thinking about this.. Be prepared to volunteer decades of your time. -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supone Nada -- Robot Dreams - http://robot-dreams.net
----- On May 22, 2024, at 12:50 AM, Christian Mazakas via Boost boost@lists.boost.org wrote:
In general, I agree with Richard's sentiment. b2 is holding Boost back and nowadays, even packagers are moving on from it and are building Boost purely via CMake or are relying on Boost's CMake support.
Maybe I missed something, but I was unable to build with b2 with a clang based Cray compiler. I can understand why since it's not publicly available (it's a PITA with most tools actually) but CMake was able to do the job. Maybe that's a corner case, it's difficult to know how many unknown compilers are out there. -- Alain
On Tue, May 21, 2024 at 4:50 PM Richard via Boost
In article
you write: On Tue, May 21, 2024 at 10:42 AM Robert Ramey via Boost
wrote: My interest is to remove b2 from the mix and still provide all the facility that I now enjoy.
You can't. It's required for the general testing and release management.
Well, that's a shame. If I'm writing a new library for inclusion in boost, the *last* thing I want to do is write b2 scripts.
You don't have to write B2 scripts to propose or get a library accepted. But you do need to do so to get it on a release. Also, why is it the last thing you want to do?
legacy b2 scripts
What makes you think it's legacy? What would make it not legacy in your opinion? -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supone Nada -- Robot Dreams - http://robot-dreams.net
----- On May 20, 2024, at 9:28 PM, Robert Ramey via Boost boost@lists.boost.org wrote:
Anyone have first hand experience building/testing a boost library/application with CMake? I've found the github project for boost/Cmake. Can anyone point me to more useful information?
I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
Robert Ramey
Boost would be better if it used CMake for building releases – that is really where it’s most important, where the average user comes into contact with the build. I’m sure bjam/b2/boost build is functional and on-par in terms of feature set, but at this point in history CMake is ubiquitous, and so is CMake knowledge.
If we were to poll Boost users it is likely the overwhelming majority would prefer to build releases with CMake.
From: Boost
Anyone have first hand experience building/testing a boost library/application with CMake? I've found the github project for boost/Cmake. Can anyone point me to more useful information?
I use CMake for building and testing Boost.MPI. Not sure I added the last tests to the b2 framework.
Robert Ramey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Rob Boehne wrote:
Boost would be better if it used CMake for building releases – that is really where it’s most important, where the average user comes into contact with the build.
We don't build our releases - they are source code. (Well, except for Windows, but those take advantage of b2's ability to build more than one configuration at once. That's not impossible to achieve with CMake but it's not clear what exactly we'll gain.)
participants (15)
-
Alain O' Miniussi
-
Alexander Grund
-
Andrey Semashev
-
Boris Kolpackov
-
Christian Mazakas
-
Daniela Engert
-
Hans Dembinski
-
Niall Douglas
-
Peter Dimov
-
René Ferdinand Rivera Morell
-
Richard
-
Rob Boehne
-
Robert Ramey
-
Vinnie Falco
-
Дмитрий Архипов