Skip to content

g++-16 fails to build magic_enum with import std; on macos #461

Description

@ClausKlein
cmake version 4.3.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
cmake -S . -B build -G Ninja \
	 -D MAGIC_ENUM_USE_MODULES=YES \
	 -D MAGIC_ENUM_OPT_BUILD_TESTS=YES \
	 -D CMAKE_CXX_MODULE_STD=YES \
	 -D CMAKE_CXX_STDLIB_MODULES_JSON=/opt/homebrew/Cellar/gcc/16.1.0/lib/gcc/current/libstdc++.modules.json \
	 -D CMAKE_BUILD_TYPE=Release \
	 -D CMAKE_CXX_STANDARD=23 -D CMAKE_CXX_EXTENSIONS=NO -D CMAKE_CXX_STANDARD_REQUIRED=YES \
	 -D CMAKE_INSTALL_MESSAGE=LAZY \
	 -D CMAKE_SKIP_INSTALL_RULES=NO \
	 --log-level=VERBOSE --fresh \
	 # -D CMAKE_CXX_FLAGS='-fno-inline --coverage' \
	 # --trace-expand --trace-source=use-fetch-content.cmake \
	 # --debug-find-pkg=GTest
-- The CXX compiler identification is GNU 16.1.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: /opt/homebrew/bin/g++-16 - skipped
-- Detecting CXX compile features
CMake Warning (dev) at /opt/homebrew/share/cmake/Modules/Compiler/CMakeCommonCompilerMacros.cmake:226 (cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental.  It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
  /opt/homebrew/share/cmake/Modules/CMakeDetermineCompilerSupport.cmake:110 (cmake_cxx_find_modules_json)
  /opt/homebrew/share/cmake/Modules/CMakeTestCXXCompiler.cmake:83 (CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:14 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
magic_enum: using import std
-- Performing Test HAS_CPP20_FLAG
-- Performing Test HAS_CPP20_FLAG - Success
-- Performing Test HAS_CPP23_FLAG
-- Performing Test HAS_CPP23_FLAG - Success
magic_enum_module_test-cpp23: using import std
magic_enum_module_test_aliases-cpp23: using import std
magic_enum_module_test_wchar_t-cpp23: using import std
-- Configuring done (1.9s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/runner/work/magic_enum/magic_enum/build
ln -sf build/compile_commands.json .
ninja -C build
ninja: Entering directory `build'
[1/78] Scanning /opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.compat.cc for CXX dependencies
[2/78] Scanning /opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.cc for CXX dependencies
[3/78] Generating CXX dyndep file CMakeFiles/__cmake_cxx_std_23.dir/CXX.dd
FAILED: [code=1] CMakeFiles/__cmake_cxx_std_23.dir/CXX.dd CMakeFiles/__cmake_cxx_std_23.dir/CXXModules.json CMakeFiles/__cmake_cxx_std_23.dir/opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.cc.o.modmap CMakeFiles/__cmake_cxx_std_23.dir/opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.compat.cc.o.modmap 
/opt/homebrew/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/__cmake_cxx_std_23.dir/CXXDependInfo.json --lang=CXX --modmapfmt=gcc --dd=CMakeFiles/__cmake_cxx_std_23.dir/CXX.dd @CMakeFiles/__cmake_cxx_std_23.dir/CXX.dd.rsp
CMake Error: Output CMakeFiles/__cmake_cxx_std_23.dir/opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.cc.o is of type `CXX_MODULES` but does not provide a module interface unit or partition
CMake Error: Output CMakeFiles/__cmake_cxx_std_23.dir/opt/homebrew/Cellar/gcc/16.1.0/include/c++/16/bits/std.compat.cc.o is of type `CXX_MODULES` but does not provide a module interface unit or partition
[4/78] Scanning /Users/runner/work/magic_enum/magic_enum/module/magic_enum.cppm for CXX dependencies
[5/78] Scanning /Users/runner/work/magic_enum/magic_enum/module/magic_enum.cppm for CXX dependencies
[6/78] Scanning /Users/runner/work/magic_enum/magic_enum/module/magic_enum.cppm for CXX dependencies
[7/78] Scanning /Users/runner/work/magic_enum/magic_enum/module/magic_enum.cppm for CXX dependencies
ninja: build stopped: subcommand failed.
make: *** [all] Error 1
Error: Process completed with exit code 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions