Skip to content

Error in adding std.cppm repeatedly #6399

@MeccBai

Description

@MeccBai

Xmake 版本

v3.0.0+master.2774ecbc0

操作系统版本和架构

Widows 11 24H2

描述问题

An error occurs when using LLVM-MINGW in conjunction with the C++ standard module,
std.cppm" being added redundantly.

期待的结果

I tried several different methods, Just like add files("src/*.cppm"). Is this a bug or I can't use shared runtime and modules? When I remove set_runtimes("c++_shared") from xmake.lua, an error occurs indicating that std.cppm cannot be found. So I want to know whether this is a bug or a problem with how I wrote my xmake.lua.

工程配置

add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate", { outputdir = "./build" })

set_languages("c++23")

set_plat("mingw")
set_toolchains("llvm")
set_runtimes("c++_shared")

set_policy("build.warning", true)

target("XmakeC")
set_kind("binary")
add_files("src/main.cpp")
set_policy("build.c++.modules", true)
add_includedirs("F:\Develop\C++\LLVM-MinGW\share\libc++\v1\")

附加信息和错误日志

checking for cl.exe ... F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.43.34810
checkinfo: cannot runv(nim.exe --version), No such file or directory
checking for nim ... no
checkinfo: cannot runv(nim.exe --version), No such file or directory
checking for nim ... no
checking for mingw directory ... F:\Develop\Python\Anaconda3\Library\mingw-w64
checking for llvm-ar ... F:\Develop\C++\LLVM-MinGW\bin\llvm-ar
checking for clang ... F:\Develop\C++\LLVM-MinGW\bin\clang
checking for the c++ compiler (cxx) ... clang
checking for F:\Develop\C++\LLVM-MinGW\bin\clang ... ok
checking for flags (clang_modules) ... ok

clang "-fmodules" "-Qunused-arguments" "-m64"
checking for flags (clang_modules_ts) ... no
clang "-fmodules-ts" "-Qunused-arguments" "-m64"
checkinfo: @programdir\core\sandbox\modules\os.lua:273: clang-20: error: unknown argument: '-fmodules-ts'

stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:1075]:
[@programdir\core\sandbox\modules\os.lua:273]: in function 'runv'
[@programdir\modules\core\tools\gcc\has_flags.lua:42]:
checking for F:\Develop\C++\LLVM-MinGW\bin\clang ... ok
checking for clang++ ... F:\Develop\C++\LLVM-MinGW\bin\clang++
checking for the linker (ld) ... clang++
checking for clang++ ... F:\Develop\C++\LLVM-MinGW\bin\clang++
checking for the shared library linker (sh) ... clang++
checking for flags (clang_print_library_module_manifest_path) ... ok

clang "-print-library-module-manifest-path" "-Qunused-arguments" "-m64"
checking for flags (-fvisibility-inlines-hidden) ... ok
clang "-fvisibility-inlines-hidden" "-Qunused-arguments" "-m64"
checking for flags (-O0) ... ok
clang "-O0" "-Qunused-arguments" "-m64"
checking for flags (-std=c++23) ... ok
clang "-std=c++23" "-Qunused-arguments" "-m64"
[ 25%]: compiling.module.debug std
checking for flags (clang_module_output) ... ok
clang "-fmodule-output=" "-Qunused-arguments" "-m64"
F:\Develop\C++\LLVM-MinGW\bin\clang -c -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystemF:\Develop\C++\LLVM-MinGW\include\c++\v1 -g -O0 -std=c++23 -IF:\Develop\C++\LLVM-MinGW\share\libc++\v1 -x c++-module -fmodule-output=build.gens\XmakeC\mingw\x64\debug\rules\bmi\cache\modules\7cddb3ac\std.pcm -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier -o build.objs\XmakeC\mingw\x64\debug\ef31e39924334ad79a4a70d585696b8a\std.cppm.obj F:\Develop\C++\LLVM-MinGW\bin..\x86_64-w64-mingw32\lib....\share\libc++\v1\std.cppm
checking for flags (-fdiagnostics-color=always) ... ok
clang "-fdiagnostics-color=always" "-Qunused-arguments" "-m64"
checking for flags (-fansi-escape-codes) ... ok
clang "-fansi-escape-codes" "-Qunused-arguments" "-m64"
checking for flags (clang_module_file) ... ok
clang "-fmodule-file=C:\Users\ADMINI1\AppData\Local\Temp.xmake\250507_3CC5F36482014F6087F241A6CD0D8C90.pcm" "-Qunused-arguments" "-m64"
[ 43%]: compiling.debug src\main.cpp
F:\Develop\C++\LLVM-MinGW\bin\clang -c -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystemF:\Develop\C++\LLVM-MinGW\include\c++\v1 -g -O0 -std=c++23 -IF:\Develop\C++\LLVM-MinGW\share\libc++\v1 -fmodule-file=std=build.gens\XmakeC\mingw\x64\debug\rules\bmi\cache\modules\7cddb3ac\std.pcm -o build.objs\XmakeC\mingw\x64\debug\src\main.cpp.obj src\main.cpp
checking for flags (-MMD -MF) ... ok
clang "-MMD" "-MF" "C:\Users\ADMINI
1\AppData\Local\Temp.xmake\250507_79C8642FB8B34F708A19E4ED96A236A0" "-Qunused-arguments" "-m64"
[ 60%]: linking.debug XmakeC.exe
F:\Develop\C++\LLVM-MinGW\bin\clang++ -o build\mingw\x64\debug\XmakeC.exe build.objs\XmakeC\mingw\x64\debug\src\main.cpp.obj build.objs\XmakeC\mingw\x64\debug\ef31e39924334ad79a4a70d585696b8a\std.cppm.obj -m64 -stdlib=libc++ -LF:\Develop\C++\LLVM-MinGW\lib

build cache stats:
cache directory: build.build_cache
cache hit rate: 0%
cache hit: 0
cache hit total time: 0.000s
cache miss: 0
cache miss total time: 0.000s
new cached files: 0
remote cache hit: 0
remote new cached files: 0
preprocess failed: 0
compile fallback count: 0
compile total time: 0.000s

error: @programdir\core\main.lua:329: @programdir\core\sandbox\modules\import\core\base\task.lua:65: @programdir\modules\async\jobgraph.lua:93: job(XmakeC/generate_module_dependencies/F:\Develop\C++\LLVM-MinGW\bin..\x86_64-w64-mingw32\lib....\share\libc++\v1\std.cppm): has already been added!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions