ClausKlein
(Claus Klein)
December 28, 2024, 5:02pm
1
I am trying to use an exported CXX_MODULE
builded and tested according https://www.kitware.com/import-std-in-cmake-3-30/
[9/10] Install the project...
-- Install configuration: "Debug"
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/libfmtD.a
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/fmtTargets.cmake
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/fmtTargets-debug.cmake
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/./cxx-modules-fmtTargets.cmake
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/./cxx-modules-fmtTargets-Debug.cmake
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/./target-fmt-Debug.cmake
Executing workflow step 3 of 4: test preset "dev"
Test project /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev
Start 1: find-package-test
Start 2: header-only-test
Start 3: module_header-only-test
1/3 Test #3: module_header-only-test .......... Passed 0.00 sec
2/3 Test #2: header-only-test ................. Passed 0.30 sec
3/3 Test #1: find-package-test ................***Failed 4.05 sec
Internal cmake changing into directory: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev/tests/find-package-test
======== CMake output ======
CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=/usr/local/Cellar/llvm/19.1.6/include/c++/v1;/usr/local/Cellar/llvm/19.1.6/lib/clang/19/include;/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include
FMT_ROOT is: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir
Module tests to be built: header-only-test
Configuring done (0.0s)
CMake Warning (dev) in CMakeLists.txt:
CMake's support for `import std;` in C++23 and newer is experimental. It
is meant only for experimentation and feedback to CMake developers.
This warning is for project developers. Use -Wno-dev to suppress it.
Generating done (0.0s)
Build files have been written to: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev/tests/find-package-test
======== End CMake output ======
Change Dir: '/Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev/tests/find-package-test'
Run Clean Command: /usr/local/bin/ninja clean
[1/1] Cleaning all built files...
Cleaning... 26 files.
Run Build Command(s): /usr/local/bin/ninja
[1/14] Scanning /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc for CXX dependencies
[2/14] Scanning /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm for CXX dependencies
[3/14] Scanning /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/module/fmt.cppm for CXX dependencies
[4/14] Scanning /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm for CXX dependencies
[5/14] Generating CXX dyndep file CMakeFiles/__cmake_cxx23.dir/CXX.dd
[6/14] Generating CXX dyndep file CMakeFiles/fmt_module.dir/CXX.dd
[7/14] Generating CXX dyndep file CMakeFiles/module_header-only-test.dir/CXX.dd
[8/14] Building CXX object CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o
[9/14] Building CXX object CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o
[10/14] Linking CXX static library lib__cmake_cxx23.a
[11/14] Building CXX object CMakeFiles/fmt_module.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/module/fmt.cppm.o
In file included from /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/module/fmt.cppm:121:
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/include/fmt/os.h:33:14: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
33 | # include <fcntl.h> // for O_RDONLY
| ^
1 warning generated.
[12/14] Linking CXX static library libfmt_module.a
[13/14] Building CXX object CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o
FAILED: CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o
/usr/local/Cellar/llvm/19.1.6/bin/clang++ -DFMT_MODULE -DHAS_STDLIB_MODULES -DUSE_MODULES -g -std=gnu++23 -fexperimental-library -stdlib=libc++ -MD -MT CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o -MF CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o.d @CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o.modmap -o CMakeFiles/module_header-only-test.dir/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc.o -c /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc
error: enable unstable and experimental library features was disabled in PCH file but is currently enabled
error: module file CMakeFiles/__cmake_cxx23.dir/std.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch]
2 errors generated.
ninja: build stopped: subcommand failed.
67% tests passed, 1 tests failed out of 3
Total Test time (real) = 4.05 sec
The following tests FAILED:
1 - find-package-test (Failed)
Errors while running CTest
make: *** [all] Error 8
bash-5.2$
This is my test program:
// Header-only configuration test
#ifdef FMT_MODULE
#ifdef HAS_STDLIB_MODULES
import std;
import std.compat;
#else
# include <string_view>
#endif
import fmt;
#else
# include "fmt/base.h"
# include "fmt/ostream.h"
#endif
auto main() -> int
{
constexpr std::string_view text{"constexpr"};
fmt::print(text);
}
ClausKlein
(Claus Klein)
December 28, 2024, 9:57pm
2
If I compile the std modules manually, it works:
# Build the stdlib module
function(add_stdlib_module NAME)
add_library(${NAME})
# cmake-format: off
target_sources(${NAME} PUBLIC
FILE_SET CXX_MODULES
BASE_DIRS ${LLVM_LIBC_SOURCE}
FILES
${LLVM_LIBC_SOURCE}/std.cppm
${LLVM_LIBC_SOURCE}/std.compat.cppm
)
# cmake-format: on
target_compile_features(${NAME} PUBLIC cxx_std_23)
target_compile_definitions(${NAME} PUBLIC _LIBCPP_HAS_NO_LOCALIZATION)
target_compile_options(${NAME} PRIVATE -Wno-reserved-module-identifier)
endfunction()
if(FMT_USE_MODULES)
# Build the stdlib modules if possible
# /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm
# /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm
if(NOT CMAKE_CXX_COMPILER_IMPORT_STD AND ADD_STDLIB_MODULES)
message(STATUS "ADD_STDLIB_MODULES=${ADD_STDLIB_MODULES}")
add_stdlib_module(${ADD_STDLIB_MODULES})
endif()
target_link_libraries(header-only-test ${ADD_STDLIB_MODULES} fmt::fmt)
else()
target_link_libraries(header-only-test fmt::fmt-header-only)
endif()
ben.boeckel
(Ben Boeckel (Kitware))
December 31, 2024, 2:39pm
3
Known issue: https://gitlab.kitware.com/cmake/cmake/-/issues/25916
CMake needs to figure out flag compatibility properly rather than just assuming everything is compatible. It’s on the roadmap.
ClausKlein
(Claus Klein)
December 31, 2024, 3:01pm
4
Is this a cmake error message or a clang linker error?
All files are fresh compiled within this test, all with the same flags, or not?
bash-5.2$ ninja -v
[1/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c
-o tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19"
-MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi -MD -MF
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.d >
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp && mv
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi
[2/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-I/usr/local/Cellar/llvm/19.1.6/lib/clang/19/../../c++/../../share/libc++/v1 -O3 -DNDEBUG -std=gnu++23
-Wno-reserved-module-identifier -x c++ /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm -c -o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.ddi -MD -MF
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.ddi.d >
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.ddi.tmp && mv
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.ddi.tmp
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.ddi
[3/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_HEADER_ONLY -I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG
-std=gnu++23 -fexperimental-library -stdlib=libc++ -x c++
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi -MD -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.d >
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp && mv
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi
[4/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/module/fmt.cppm -c -o
CMakeFiles/fmt.dir/module/fmt.cppm.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi -MD -MF CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.d >
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp && mv CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi
[5/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-I/usr/local/Cellar/llvm/19.1.6/lib/clang/19/../../c++/../../share/libc++/v1 -O3 -DNDEBUG -std=gnu++23
-Wno-reserved-module-identifier -x c++ /usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm -c -o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.ddi -MD -MF
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.ddi.d >
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.ddi.tmp && mv
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.ddi.tmp
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.ddi
[6/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/__cmake_cxx23.dir/CXXDependInfo.json --lang=CXX
--modmapfmt=clang --dd=CMakeFiles/__cmake_cxx23.dir/CXX.dd @CMakeFiles/__cmake_cxx23.dir/CXX.dd.rsp
[7/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/fmt.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang
--dd=CMakeFiles/fmt.dir/CXX.dd @CMakeFiles/fmt.dir/CXX.dd.rsp
[8/18] /usr/local/bin/cmake -E cmake_ninja_dyndep
--tdi=module/tests/CMakeFiles/module_header-only-test.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang
--dd=module/tests/CMakeFiles/module_header-only-test.dir/CXX.dd
@module/tests/CMakeFiles/module_header-only-test.dir/CXX.dd.rsp
[9/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=tests/CMakeFiles/header-only-test.dir/CXXDependInfo.json --lang=CXX
--modmapfmt=clang --dd=tests/CMakeFiles/header-only-test.dir/CXX.dd @tests/CMakeFiles/header-only-test.dir/CXX.dd.rsp
[10/18] /usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++ -DFMT_HEADER_ONLY
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -MD -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.d
@module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.modmap -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -c
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc
[11/18] /usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++
-I/usr/local/Cellar/llvm/19.1.6/lib/clang/19/../../c++/../../share/libc++/v1 -O3 -DNDEBUG -std=gnu++23
-Wno-reserved-module-identifier -MD -MT
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o -MF
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.d
@CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o.modmap -o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o -c
/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm
[12/18] /usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++
-I/usr/local/Cellar/llvm/19.1.6/lib/clang/19/../../c++/../../share/libc++/v1 -O3 -DNDEBUG -std=gnu++23
-Wno-reserved-module-identifier -MD -MT
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o -MF
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.d
@CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o.modmap -o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o -c
/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm
[13/18] : && /usr/local/bin/cmake -E rm -f lib__cmake_cxx23.a && /usr/bin/ar qc lib__cmake_cxx23.a
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o &&
/usr/local/Cellar/llvm/19.1.6/bin/llvm-ranlib lib__cmake_cxx23.a && /usr/local/bin/cmake -E touch lib__cmake_cxx23.a && :
[14/18] : && /usr/local/Cellar/llvm/19.1.6/bin/clang++ -O3 -DNDEBUG -Wl,-search_paths_first
-Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib/c++ -L/usr/local/Cellar/llvm/19.1.6/lib/c++ -lc++experimental
-stdlib=libc++ module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -o
module/tests/module_header-only-test lib__cmake_cxx23.a && :
[15/18] /usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++ -DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -MD -MT CMakeFiles/fmt.dir/module/fmt.cppm.o -MF
CMakeFiles/fmt.dir/module/fmt.cppm.o.d @CMakeFiles/fmt.dir/module/fmt.cppm.o.modmap -o CMakeFiles/fmt.dir/module/fmt.cppm.o
-c /Users/clausklein/Workspace/cpp/cxx20/fmt-module/module/fmt.cppm
[16/18] : && /usr/local/bin/cmake -E rm -f libfmt.a && /usr/bin/ar qc libfmt.a
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.cppm.o
CMakeFiles/__cmake_cxx23.dir/usr/local/Cellar/llvm/19.1.6/share/libc++/v1/std.compat.cppm.o
CMakeFiles/fmt.dir/module/fmt.cppm.o && /usr/local/Cellar/llvm/19.1.6/bin/llvm-ranlib libfmt.a && /usr/local/bin/cmake -E
touch libfmt.a && :
[17/18] /usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++ -DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -MD -MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -MF
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.d
@tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.modmap -o
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -c
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc
FAILED: tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o
/usr/local/bin/ccache /usr/local/Cellar/llvm/19.1.6/bin/clang++ -DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -MD -MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -MF
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.d
@tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.modmap -o
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -c
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc
error: enable unstable and experimental library features was disabled in PCH file but is currently enabled
error: module file CMakeFiles/__cmake_cxx23.dir/std.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch]
2 errors generated.
ninja: build stopped: subcommand failed.
bash-5.2$
ben.boeckel
(Ben Boeckel (Kitware))
January 2, 2025, 1:20pm
5
clang
prints the error because CMake isn’t doing everything 100% correctly (it should see the -std=
flag in the consumer and make a new BMI for it; currently we assume all flags are compatible). In the meantime, disable extensions everywhere.
ClausKlein
(Claus Klein)
January 2, 2025, 3:33pm
6
@ben.boeckel It seem to me it is a cmake problem!
If I use a CXX_MODULE and CXX_MODULE_STD there are 2 call to clang-scan-deps with different compiler flags:
Preset CMake variables:
CMAKE_BUILD_TYPE="Release"
CMAKE_CXX_EXTENSIONS:BOOL="TRUE"
CMAKE_CXX_FLAGS_DEBUG="-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Wno-float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast"
CMAKE_CXX_STANDARD="23"
CMAKE_CXX_STANDARD_REQUIRED:BOOL="TRUE"
CMAKE_INSTALL_PREFIX:PATH="/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir"
CMAKE_PREFIX_PATH:STRING="/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir"
FMT_DEVELOPER_MODE:BOOL="TRUE"
-- use ccache
-- The CXX compiler identification is Clang 19.1.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/Cellar/llvm/19.1.6/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
'brew' '--prefix' 'llvm@19'
-- LLVM_PREFIX=/usr/local/opt/llvm
-- LLVM_ROOT=/usr/local/Cellar/llvm/19.1.6
-- LLVM_LIBC_SOURCE=/usr/local/opt/llvm/share/libc++/v1
-- CMAKE_CXX_COMPILER_IMPORT_STD=
-- CPPdefinitions=FMT_USE_FCNTL=0;FMT_MODULE;HAS_STDLIB_MODULES
-- Found Git: /usr/local/bin/git (found version "2.47.1")
-- CPM: Adding package fmt@11.1.1 (11.1.1 at /Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5)
CMake Warning at tests/CMakeLists.txt:50 (message):
ADD_STDLIB_MODULES=stdlib
-- Module tests to be built: header-only-test
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build
[1/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/module/fmt.cppm -c -o
CMakeFiles/fmt.dir/module/fmt.cppm.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi -MD -MF CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.d >
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp && mv CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi
[2/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++
-Wno-reserved-module-identifier -x c++ /usr/local/opt/llvm/share/libc++/v1/std.cppm -c -o
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi -MD -MF
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.d >
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.tmp && mv
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.tmp
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi
[3/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++
-Wno-reserved-module-identifier -x c++ /usr/local/opt/llvm/share/libc++/v1/std.compat.cppm -c -o
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi -MD -MF
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.d >
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.tmp && mv
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.tmp
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi
[4/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/fmt.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang
--dd=CMakeFiles/fmt.dir/CXX.dd @CMakeFiles/fmt.dir/CXX.dd.rsp
[5/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES -D_LIBCPP_HAS_NO_LOCALIZATION
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c
-o tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19"
-MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi -MD -MF
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.d >
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp && mv
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi
[6/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=tests/CMakeFiles/stdlib.dir/CXXDependInfo.json --lang=CXX
--modmapfmt=clang --dd=tests/CMakeFiles/stdlib.dir/CXX.dd @tests/CMakeFiles/stdlib.dir/CXX.dd.rsp
[7/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++ -x c++
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi -MD -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.d >
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp && mv
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi
FAILED: module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi
"/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++ -x c++
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi -MD -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.d >
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp && mv
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi
Error while scanning dependencies for /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:16:12: fatal error: 'fmt/base.h' file not found
ninja: build stopped: subcommand failed.
make: *** [test] Error 1
ben.boeckel
(Ben Boeckel (Kitware))
January 3, 2025, 8:50am
7
Could you please pull out the differences here?
In any case, there is a known unimplemented gap when flags do not agree. Either make flags agree or wait for this class to do some real work.