Skip to content

Feature/module#5

Open
ClausKlein wants to merge 57 commits intodevelopfrom
feature/module
Open

Feature/module#5
ClausKlein wants to merge 57 commits intodevelopfrom
feature/module

Conversation

@ClausKlein
Copy link
Owner

@ClausKlein ClausKlein commented Mar 1, 2026

e049443 Feat: Modernise CMakeLists.txt to build and install CXX_MODULE asio the Daniela's way

  • Use import std; where toolchain supports it
  • Change Windows CI Workflow to use import std; too
  • CI workflow with gcc-15, gcc-16
  • CI workflow with clang-21, clang-22
  • CI workflow with MSVC 2025
  • Add more examples
  • Add tests
  • round trip test on CI, but for linux only Debug build! (CK)
  • fix use of depreciated interfaces (CO)
  • check disabled unit tests
  • unit tests with module
  • rebase with asio v1.38?

DanielaE and others added 26 commits December 6, 2025 11:26
Changes:
- Change 'static const' to 'inline const' for ssl_category and stream_category
- Add optional SSL support via ASIO_ENABLE_SSL CMake option (default: OFF)
- Resolves 'cannot export symbol with internal linkage' compilation error

The inline specifier ensures external linkage while maintaining semantics.
- Fix typo in asio-gmf.h: 'openssl / conf.h' -> 'openssl/conf.h'
- Add SYSTEM keyword for OpenSSL include directories
- Change ASIO_ENABLE_SSL default to ON
- Add detailed logging for OpenSSL paths
@ClausKlein ClausKlein self-assigned this Mar 1, 2026
Be more verbose on CI workflow cmake --preset
@ClausKlein ClausKlein requested review from DanielaE, camio and ednolan and removed request for DanielaE March 12, 2026 20:56
@ClausKlein
Copy link
Owner Author

ClausKlein commented Mar 12, 2026

hey @ClausKlein, I pushed a few updates to the PR. when you have a chance, could you take a look and let me know what you think? happy to iterate further if needed.

@ecoezen I like the CMakeWorkflowPreset, but some of the Warnings are too much at the moment!
see https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-180

After adding more examples and unit tests, I found a lot of deprecated interfaces used there!

Too the round trip test does not work on CI, I will try to fix it next week.

The windows preset flags are to pedantic yet.
@ecoezen
Copy link
Collaborator

ecoezen commented Mar 12, 2026

hey @ClausKlein, I pushed a few updates to the PR. when you have a chance, could you take a look and let me know what you think? happy to iterate further if needed.

@ecoezen I like the CMakeWorkflowPreset, but some of the Warnings are too much at the moment!

After adding more examples and unit tests, I found a lot of deprecated interfaces used there!

Too the round trip test does not work on CI, I will try to fix it next week.

hey. i'll also look at this again tomorrow and this weekend.

are we porting tests to modules as well @ClausKlein ? i mean we should imo as its the only way to see modules are actually working, but curious how much detail implementations leaked to the tests... (I'll try it anyway)

please update checklist in the head comment if there is any other additional requirements to be covered. i'll spare some time for this.

@DanielaE
Copy link

@ClausKlein Maybe you have noticed my rebasement of feature branch 'module' to current Asio 1.38, plus a new branch 'module-next' living on top of Asio 'trunk'

Only for Windows and APPLE now

Make some timer test faster, but not too fast
@ClausKlein
Copy link
Owner Author

ClausKlein commented Mar 16, 2026

@ClausKlein Maybe you have noticed my rebasement of feature branch 'module' to current Asio 1.38, plus a new branch 'module-next' living on top of Asio 'trunk'

Is it conform to the current concept C++20 modules in Boost ?

It seems not?

bash-5.3$ CXX=g++ ~/.local/bin/cmake -S . -B build --fresh -D CMAKE_CXX_STANDARD=23
-- The CXX compiler identification is GNU 15.2.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (1.2s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/asio/build
bash-5.3$ ninja -C build libasio.a -v -j 1
ninja: Entering directory `build'
[1/4] /usr/local/bin/g++  -I/Users/clausklein/Workspace/cpp/asio/include -std=c++23 -E -x c++ /Users/clausklein/Workspace/cpp/asio/module/asio.ixx -MT CMakeFiles/asio.dir/module/asio.ixx.o.ddi -MD -MF CMakeFiles/asio.dir/module/asio.ixx.o.ddi.d -fmodules-ts -fdeps-file=CMakeFiles/asio.dir/module/asio.ixx.o.ddi -fdeps-target=CMakeFiles/asio.dir/module/asio.ixx.o -fdeps-format=p1689r5 -o CMakeFiles/asio.dir/module/asio.ixx.o.ddi.i
[2/4] /Users/clausklein/.local/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/asio.dir/CXXDependInfo.json --lang=CXX --modmapfmt=gcc --dd=CMakeFiles/asio.dir/CXX.dd @CMakeFiles/asio.dir/CXX.dd.rsp
[3/4] ccache /usr/local/bin/g++  -I/Users/clausklein/Workspace/cpp/asio/include -std=c++23 -MD -MT CMakeFiles/asio.dir/module/asio.ixx.o -MF CMakeFiles/asio.dir/module/asio.ixx.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/asio.dir/module/asio.ixx.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/asio.dir/module/asio.ixx.o -c /Users/clausklein/Workspace/cpp/asio/module/asio.ixx
FAILED: [code=1] CMakeFiles/asio.dir/module/asio.ixx.o CMakeFiles/asio.dir/asio.gcm 
ccache /usr/local/bin/g++  -I/Users/clausklein/Workspace/cpp/asio/include -std=c++23 -MD -MT CMakeFiles/asio.dir/module/asio.ixx.o -MF CMakeFiles/asio.dir/module/asio.ixx.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/asio.dir/module/asio.ixx.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/asio.dir/module/asio.ixx.o -c /Users/clausklein/Workspace/cpp/asio/module/asio.ixx
In file included from /Users/clausklein/Workspace/cpp/asio/module/asio-gmf.h:23,
                 from /Users/clausklein/Workspace/cpp/asio/module/asio.ixx:6:
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/config.hpp:1658:36: error: conflicting declaration of 'void* asio::detail::asio_detail_posix_thread_function(void*)' in module 'asio'
 1658 | # define ASIO_VERSIONED_NAME(name) asio_ ## name
      |                                    ^~~~~
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/posix_thread.hpp:93:16: note: in expansion of macro 'ASIO_VERSIONED_NAME'
   93 |   friend void* ASIO_VERSIONED_NAME(detail_posix_thread_function)(
      |                ^~~~~~~~~~~~~~~~~~~
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/config.hpp:1658:36: note: previously declared in global module
 1658 | # define ASIO_VERSIONED_NAME(name) asio_ ## name
      |                                    ^~~~~
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/posix_thread.hpp:34:19: note: in expansion of macro 'ASIO_VERSIONED_NAME'
   34 |   ASIO_DECL void* ASIO_VERSIONED_NAME(detail_posix_thread_function)(
      |                   ^~~~~~~~~~~~~~~~~~~
/Users/clausklein/Workspace/cpp/asio/module/asio.ixx:56:1: sorry, unimplemented: private module fragment
   56 | module :private;
      | ^~~~~~
In file included from /Users/clausklein/Workspace/cpp/asio/include/asio/impl/src.hpp:53,
                 from /Users/clausklein/Workspace/cpp/asio/module/asio.ixx:58:
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/impl/posix_thread.ipp: In function 'void* asio::detail::asio_detail_posix_thread_function(void*)':
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/impl/posix_thread.ipp:74:29: error: 'class asio::detail::posix_thread::func_base' is private within this context
   74 |   static_cast<posix_thread::func_base*>(arg)->run();
      |                             ^~~~~~~~~
In file included from /Users/clausklein/Workspace/cpp/asio/include/asio/detail/thread.hpp:23,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio/detail/scheduler.hpp:28,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio/io_context.hpp:41,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio/detail/io_object_impl.hpp:23,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio/basic_socket.hpp:23,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio/basic_datagram_socket.hpp:20,
                 from /Users/clausklein/Workspace/cpp/asio/include/asio.hpp:30,
                 from /Users/clausklein/Workspace/cpp/asio/module/asio.ixx:23:
/Users/clausklein/Workspace/cpp/asio/include/asio/detail/posix_thread.hpp:96:9: note: declared private here
   96 |   class func_base
      |         ^~~~~~~~~
ninja: build stopped: subcommand failed.
bash-5.3$ git status
On branch feature/module-next
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   CMakeLists.txt

no changes added to commit (use "git add" and/or "git commit -a")
bash-5.3$ 

@ClausKlein ClausKlein requested a review from DanielaE March 16, 2026 10:08
@ClausKlein
Copy link
Owner Author

@ecoezen I struggle with Linux-ggc-Release docker builds:

/root/.local/bin/cmake  --preset linux-gcc -D CMAKE_CXX_STANDARD=26 \
	-D ASIO_IMPORT_STD=ON \
	-D ASIO_ENABLE_SSL=OFF \
	--fresh --log-level=VERBOSE -Wdev
# -D CMAKE_CXX_STDLIB_MODULES_JSON= \
/root/.local/bin/cmake  --workflow --preset linux-gcc-release
root@b40851a7588d:/home/builder/workdir# 

root@b40851a7588d:/home/builder/workdir/build/linux-gcc# ~/.local/bin/ctest --rerun-failed --verbose -C Release
UpdateCTestConfiguration  from :/home/builder/workdir/build/linux-gcc/DartConfiguration.tcl
Test project /home/builder/workdir/build/linux-gcc
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 96
    Start 96: find-package-test

96: Test command: /root/.local/share/pipx/venvs/cmake/lib/python3.12/site-packages/cmake/data/bin/ctest "--output-on-failure" "-C" "Release" "--build-and-test" "/home/builder/workdir/src/examples" "/home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test" "--build-generator" "Ninja Multi-Config" "--build-makeprogram" "/usr/bin/ninja" "--build-options" "-D ASIO_IMPORT_STD=TRUE" "-D CMAKE_BUILD_TYPE=Release" "-D CMAKE_BUILD_RPATH=/opt/gcc-16/lib64" "-D CMAKE_CXX_COMPILER=/usr/bin/g++" "-D CMAKE_CXX_EXTENSIONS=TRUE" "-D CMAKE_CXX_SCAN_FOR_MODULES=TRUE" "-D CMAKE_CXX_STANDARD=23" "-D CMAKE_CXX_STANDARD_REQUIRED=TRUE" "-D CMAKE_CXX_STDLIB_MODULES_JSON=/opt/gcc-16/lib64/libstdc++.modules.json" "-D CMAKE_PREFIX_PATH=/home/builder/workdir/build/linux-gcc/stagedir"
96: Working Directory: /home/builder/workdir/build/linux-gcc/src/tests/unit
96: Test timeout computed to be: 10000000
96: Internal cmake changing into directory: /home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test
96: ======== CMake output     ======
96: CMAKE_CXX_STDLIB_MODULES_JSON: /opt/gcc-16/lib64/libstdc++.modules.json
96: Build asio with target PROPERTY CXX_MODULE_STD ON
96: Configuring done (0.0s)
96: CMake Warning (dev) in CMakeLists.txt:
96:   CMake's support for `import std;` in C++23 and newer is experimental.  It
96:   is meant only for experimentation and feedback to CMake developers.
96: This warning is for project developers.  Use -Wno-dev to suppress it.
96: 
96: Generating done (0.1s)
96: Build files have been written to: /home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test
96: ======== End CMake output ======
96: Change Dir: '/home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test'
96: 
96: Run Clean Command: /usr/bin/ninja -f build-Release.ninja clean
96: [1/1] Cleaning all built files...
96: Cleaning... 42 files.
96: 
96: Run Build Command(s): /usr/bin/ninja -f build-Release.ninja
96: [1/23] Scanning /home/builder/workdir/src/examples/interface_part.cppm for CXX dependencies
96: [2/23] Scanning /home/builder/workdir/src/examples/User.cpp for CXX dependencies
96: [3/23] Scanning /home/builder/workdir/src/examples/M.cppm for CXX dependencies
96: [4/23] Scanning /opt/gcc-16/include/c++/16.0.1/bits/std.compat.cc for CXX dependencies
96: [5/23] Scanning /home/builder/workdir/src/examples/impl_part.cpp for CXX dependencies
96: [6/23] Scanning /home/builder/workdir/src/examples/Impl.cpp for CXX dependencies
96: [7/23] Generating CXX dyndep file CMakeFiles/M.dir/Release/CXX.dd
96: [8/23] Generating CXX dyndep file CMakeFiles/example.User.dir/Release/CXX.dd
96: [9/23] Building CXX object CMakeFiles/M.dir/Release/interface_part.cppm.o
96: [10/23] Building CXX object CMakeFiles/M.dir/Release/M.cppm.o
96: [11/23] Building CXX object CMakeFiles/example.User.dir/Release/User.cpp.o
96: [12/23] Scanning /opt/gcc-16/include/c++/16.0.1/bits/std.cc for CXX dependencies
96: [13/23] Generating CXX dyndep file 'CMakeFiles/__CMAKE__CXX23@synth_f96929115e2d.dir/Release/CXX.dd'
96: [14/23] Building CXX object CMakeFiles/M.dir/Release/impl_part.cpp.o
96: [15/23] Building CXX object CMakeFiles/M.dir/Release/Impl.cpp.o
96: [16/23] Linking CXX static library Release/libM.a
96: [17/23] Linking CXX executable Release/example.User
96: [18/23] Scanning /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx for CXX dependencies
96: [19/23] Generating CXX dyndep file 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/CXX.dd'
96: [20/23] Scanning /home/builder/workdir/src/examples/cpp20/invocation/completion_executor.cpp for CXX dependencies
96: [21/23] Generating CXX dyndep file CMakeFiles/example.completion_executor.dir/Release/CXX.dd
96: [22/25] Building CXX object 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi'
96: FAILED: CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi 
96: /usr/bin/g++ -DASIO_DISABLE_BOOST_CONTEXT_FIBER -DASIO_HAS_IMPORT_STD -DASIO_STANDALONE -DCMAKE_INTDIR=\"Release\" -isystem /home/builder/workdir/build/linux-gcc/stagedir/include/asio-1.36.0 -O3 -DNDEBUG -std=gnu++23 -fmodule-only -MD -MT 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi' -MF CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi.d -fmodules-ts -fmodule-mapper=CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi.modmap -MD -fdeps-format=p1689r5 -x c++ -o 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi' -c /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx
96: /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx:11:1: fatal error: unknown compiled module interface: no such module
96:    11 | import std;
96:       | ^~~~~~
96: compilation terminated.
96: [23/25] Building CXX object 'CMakeFiles/__CMAKE__CXX23@synth_f96929115e2d.dir/Release/7a02772df09c.bmi'
96: ninja: build stopped: subcommand failed.
96: 
1/1 Test #96: find-package-test ................***Failed    6.45 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   6.46 sec

The following tests FAILED:
	 96 - find-package-test (Failed)
Errors while running CTest
Output from these tests are in: /home/builder/workdir/build/linux-gcc/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
root@b40851a7588d:/home/builder/workdir/build/linux-gcc# 

This tests if the targets are usable from the install directory

NOTE: should be work with Debug and Release builds! CK
Round trip test works only yet in Debug on Linux?

Use clang-format with ColumnLimit: 99
@ecoezen
Copy link
Collaborator

ecoezen commented Mar 17, 2026

@ecoezen I struggle with Linux-ggc-Release docker builds:

/root/.local/bin/cmake  --preset linux-gcc -D CMAKE_CXX_STANDARD=26 \
	-D ASIO_IMPORT_STD=ON \
	-D ASIO_ENABLE_SSL=OFF \
	--fresh --log-level=VERBOSE -Wdev
# -D CMAKE_CXX_STDLIB_MODULES_JSON= \
/root/.local/bin/cmake  --workflow --preset linux-gcc-release
root@b40851a7588d:/home/builder/workdir# 

root@b40851a7588d:/home/builder/workdir/build/linux-gcc# ~/.local/bin/ctest --rerun-failed --verbose -C Release
UpdateCTestConfiguration  from :/home/builder/workdir/build/linux-gcc/DartConfiguration.tcl
Test project /home/builder/workdir/build/linux-gcc
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 96
    Start 96: find-package-test

96: Test command: /root/.local/share/pipx/venvs/cmake/lib/python3.12/site-packages/cmake/data/bin/ctest "--output-on-failure" "-C" "Release" "--build-and-test" "/home/builder/workdir/src/examples" "/home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test" "--build-generator" "Ninja Multi-Config" "--build-makeprogram" "/usr/bin/ninja" "--build-options" "-D ASIO_IMPORT_STD=TRUE" "-D CMAKE_BUILD_TYPE=Release" "-D CMAKE_BUILD_RPATH=/opt/gcc-16/lib64" "-D CMAKE_CXX_COMPILER=/usr/bin/g++" "-D CMAKE_CXX_EXTENSIONS=TRUE" "-D CMAKE_CXX_SCAN_FOR_MODULES=TRUE" "-D CMAKE_CXX_STANDARD=23" "-D CMAKE_CXX_STANDARD_REQUIRED=TRUE" "-D CMAKE_CXX_STDLIB_MODULES_JSON=/opt/gcc-16/lib64/libstdc++.modules.json" "-D CMAKE_PREFIX_PATH=/home/builder/workdir/build/linux-gcc/stagedir"
96: Working Directory: /home/builder/workdir/build/linux-gcc/src/tests/unit
96: Test timeout computed to be: 10000000
96: Internal cmake changing into directory: /home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test
96: ======== CMake output     ======
96: CMAKE_CXX_STDLIB_MODULES_JSON: /opt/gcc-16/lib64/libstdc++.modules.json
96: Build asio with target PROPERTY CXX_MODULE_STD ON
96: Configuring done (0.0s)
96: CMake Warning (dev) in CMakeLists.txt:
96:   CMake's support for `import std;` in C++23 and newer is experimental.  It
96:   is meant only for experimentation and feedback to CMake developers.
96: This warning is for project developers.  Use -Wno-dev to suppress it.
96: 
96: Generating done (0.1s)
96: Build files have been written to: /home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test
96: ======== End CMake output ======
96: Change Dir: '/home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test'
96: 
96: Run Clean Command: /usr/bin/ninja -f build-Release.ninja clean
96: [1/1] Cleaning all built files...
96: Cleaning... 42 files.
96: 
96: Run Build Command(s): /usr/bin/ninja -f build-Release.ninja
96: [1/23] Scanning /home/builder/workdir/src/examples/interface_part.cppm for CXX dependencies
96: [2/23] Scanning /home/builder/workdir/src/examples/User.cpp for CXX dependencies
96: [3/23] Scanning /home/builder/workdir/src/examples/M.cppm for CXX dependencies
96: [4/23] Scanning /opt/gcc-16/include/c++/16.0.1/bits/std.compat.cc for CXX dependencies
96: [5/23] Scanning /home/builder/workdir/src/examples/impl_part.cpp for CXX dependencies
96: [6/23] Scanning /home/builder/workdir/src/examples/Impl.cpp for CXX dependencies
96: [7/23] Generating CXX dyndep file CMakeFiles/M.dir/Release/CXX.dd
96: [8/23] Generating CXX dyndep file CMakeFiles/example.User.dir/Release/CXX.dd
96: [9/23] Building CXX object CMakeFiles/M.dir/Release/interface_part.cppm.o
96: [10/23] Building CXX object CMakeFiles/M.dir/Release/M.cppm.o
96: [11/23] Building CXX object CMakeFiles/example.User.dir/Release/User.cpp.o
96: [12/23] Scanning /opt/gcc-16/include/c++/16.0.1/bits/std.cc for CXX dependencies
96: [13/23] Generating CXX dyndep file 'CMakeFiles/__CMAKE__CXX23@synth_f96929115e2d.dir/Release/CXX.dd'
96: [14/23] Building CXX object CMakeFiles/M.dir/Release/impl_part.cpp.o
96: [15/23] Building CXX object CMakeFiles/M.dir/Release/Impl.cpp.o
96: [16/23] Linking CXX static library Release/libM.a
96: [17/23] Linking CXX executable Release/example.User
96: [18/23] Scanning /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx for CXX dependencies
96: [19/23] Generating CXX dyndep file 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/CXX.dd'
96: [20/23] Scanning /home/builder/workdir/src/examples/cpp20/invocation/completion_executor.cpp for CXX dependencies
96: [21/23] Generating CXX dyndep file CMakeFiles/example.completion_executor.dir/Release/CXX.dd
96: [22/25] Building CXX object 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi'
96: FAILED: CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi 
96: /usr/bin/g++ -DASIO_DISABLE_BOOST_CONTEXT_FIBER -DASIO_HAS_IMPORT_STD -DASIO_STANDALONE -DCMAKE_INTDIR=\"Release\" -isystem /home/builder/workdir/build/linux-gcc/stagedir/include/asio-1.36.0 -O3 -DNDEBUG -std=gnu++23 -fmodule-only -MD -MT 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi' -MF CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi.d -fmodules-ts -fmodule-mapper=CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi.modmap -MD -fdeps-format=p1689r5 -x c++ -o 'CMakeFiles/asio__asio@synth_f96929115e2d.dir/Release/7bf0e0f07b9c.bmi' -c /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx
96: /home/builder/workdir/build/linux-gcc/stagedir/lib/cmake/asio-1.36.0/modules/asio.ixx:11:1: fatal error: unknown compiled module interface: no such module
96:    11 | import std;
96:       | ^~~~~~
96: compilation terminated.
96: [23/25] Building CXX object 'CMakeFiles/__CMAKE__CXX23@synth_f96929115e2d.dir/Release/7a02772df09c.bmi'
96: ninja: build stopped: subcommand failed.
96: 
1/1 Test #96: find-package-test ................***Failed    6.45 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   6.46 sec

The following tests FAILED:
	 96 - find-package-test (Failed)
Errors while running CTest
Output from these tests are in: /home/builder/workdir/build/linux-gcc/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
root@b40851a7588d:/home/builder/workdir/build/linux-gcc# 

hey @ClausKlein, it seems there is a race condition due to a missing dependency link between the .bmi compilations:

  • [13/23] generates the CXX.dd dyndep graph for the std target.
  • [22/25] tries to actually build the asio .bmi and fails (fatal error: unknown module: no such module import std;).
  • [23/25] is the step that actually builds the std .bmi that is required for asio.bmi compilation in step 22.

it seems something is broken with modules over find_package boundaries on cmake ? which cmake version you have on your docker @ClausKlein ?

also, it is weird to see -D CMAKE_CXX_COMPILER=/usr/bin/g++ is being mixed with
-D CMAKE_CXX_STDLIB_MODULES_JSON=/opt/gcc-16/.../libstdc++.modules.json. it uses system g++ (if not symlinked to gcc 16) but not system std lib modules.

@ClausKlein
Copy link
Owner Author

ClausKlein commented Mar 17, 2026

it is the same docker image used on CI. And the Debug build works!

https://discourse.cmake.org/t/import-std-with-ninja-multi-config-generator-does-not-work-in-release/15561

root@b40851a7588d:/home/builder/workdir# g++ --version
g++ (GCC) 16.0.1 20260316 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@b40851a7588d:/home/builder/workdir# uname -a
Linux b40851a7588d 6.12.72-linuxkit #1 SMP PREEMPT_DYNAMIC Wed Feb 25 13:22:15 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
root@b40851a7588d:/home/builder/workdir# ~/.local/bin/cmake  --version
cmake version 4.2.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@b40851a7588d:/home/builder/workdir# ninja --version
1.11.1
root@b40851a7588d:/home/builder/workdir# ~/.local/bin/ninja --version
bash: /root/.local/bin/ninja: No such file or directory
root@b40851a7588d:/home/builder/workdir# which ninja
/usr/bin/ninja
root@b40851a7588d:/home/builder/workdir# pipx install ninja
⚠️  Note: ninja was already on your PATH at /usr/bin/ninja
  installed package ninja 1.13.0, installed using Python 3.12.3
  These apps are now globally available
    - ninja
done! ✨ 🌟 ✨
root@b40851a7588d:/home/builder/workdir# ~/.local/bin/ninja --version
1.13.0.git.kitware.jobserver-pipe-1
root@b40851a7588d:/home/builder/workdir# g++-1
g++-13  g++-14  g++-15  g++-16  
root@b40851a7588d:/home/builder/workdir# which g++-16
/usr/bin/g++-16
root@b40851a7588d:/home/builder/workdir# ll /usr/bin/g++-16 
lrwxrwxrwx 1 root root 24 Mar 16 17:00 /usr/bin/g++-16 -> /etc/alternatives/g++-16*
root@b40851a7588d:/home/builder/workdir# ll /opt/  
cmake-latest/ gcc-15/       gcc-16/       
root@b40851a7588d:/home/builder/workdir# ll /opt/
total 20
drwxr-xr-x  1 root root 4096 Mar 16 17:00 ./
drwxr-xr-x  1 root root 4096 Mar 16 17:56 ../
drwxr-xr-x  4 root root 4096 Feb  1 03:47 cmake-latest/
drwxr-xr-x  9 root root 4096 Mar 16 05:02 gcc-15/
drwxr-xr-x 10 root root 4096 Mar 16 17:00 gcc-16/
root@b40851a7588d:/home/builder/workdir# ll /opt/*
/opt/cmake-latest:
total 16
drwxr-xr-x  4 root root 4096 Feb  1 03:47 ./
drwxr-xr-x  1 root root 4096 Mar 16 17:00 ../
drwxr-xr-x  2 root root 4096 Jan 27 16:17 bin/
drwxr-xr-x 10 root root 4096 Jan 27 16:17 share/

/opt/gcc-15:
total 36
drwxr-xr-x 9 root root 4096 Mar 16 05:02 ./
drwxr-xr-x 1 root root 4096 Mar 16 17:00 ../
drwxr-xr-x 2 root root 4096 Mar 16 05:02 bin/
drwxr-xr-x 3 root root 4096 Mar 16 05:02 include/
drwxr-xr-x 3 root root 4096 Mar 16 05:02 lib/
drwxr-xr-x 2 root root 4096 Mar 16 05:02 lib32/
drwxr-xr-x 2 root root 4096 Mar 16 05:02 lib64/
drwxr-xr-x 3 root root 4096 Mar 16 05:02 libexec/
drwxr-xr-x 6 root root 4096 Mar 16 05:02 share/

/opt/gcc-16:
total 40
drwxr-xr-x 10 root root 4096 Mar 16 17:00 ./
drwxr-xr-x  1 root root 4096 Mar 16 17:00 ../
drwxr-xr-x  2 root root 4096 Mar 16 17:00 bin/
drwxr-xr-x  3 root root 4096 Mar 16 17:00 include/
drwxr-xr-x  4 root root 4096 Mar 16 17:00 lib/
drwxr-xr-x  2 root root 4096 Mar 16 17:00 lib32/
drwxr-xr-x  2 root root 4096 Mar 16 17:00 lib64/
drwxr-xr-x  3 root root 4096 Mar 16 17:00 libexec/
drwxr-xr-x  6 root root 4096 Mar 16 17:00 share/
drwxr-xr-x  4 root root 4096 Mar 16 17:00 x86_64-pc-linux-gnu/
root@b40851a7588d:/home/builder/workdir# /opt/cmake-latest/bin/cmake --version
cmake version 4.2.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@b40851a7588d:/home/builder/workdir# 

@ecoezen
Copy link
Collaborator

ecoezen commented Mar 19, 2026

it is the same docker image used on CI. And the Debug build works!

https://discourse.cmake.org/t/import-std-with-ninja-multi-config-generator-does-not-work-in-release/15561

well, well, well... i've never though it was about ninja multi config gen, but thanks for reporting. ironically, your findings about ninja issue solve problems with one of my project's CI.

unrelated but, this whole human->cmake->generator->compiler makes the life harder for most non-corpo/non-academic projects imo. i'll eventually adopt some build tool(e.g. xmake, build2) that basicaly reduce this complexity after CPS(common package specification) finalized and implemented by build tool vendors so we can enjoy freedom with enhanced interopability...

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.

5 participants