-
-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无法找到std模块 #5615
Comments
Title: clang toolchain cannot be configured |
set_toolset 删了,然后试下: xmake f --toolchain=clang-19 --runtimes=c++_shared -cvD
xmake -rvD 不行就给下完整 logs |
stack traceback: |
建议你还是直接自己下载 llvm 包,切到 llvm toolchain 去试下,linux 安装的 Clang 不一定带 std module 的 ,也没有 clang-scan-deps 如果用系统的,libc++, libc++-abi 包也得自己装好 |
It is recommended that you download the llvm package directly yourself and switch to the llvm toolchain to try it. Clang installed on Linux may not come with std module. |
我现在使用了llvm
stack traceback: |
Your configuration is wrong. Pure cpp has no module files. Please refer to this configuration. |
现在我的xmake是这样配置的 然后我使用xmake f --toolchain=llvm --runtimes=c++_shared -cvD,输出: checking for platform ... linux
checking for architecture ... x86_64
checking for clang ... /usr/lib/llvm-19/bin/clang
checking for the c++ compiler (cxx) ... clang
checking for /usr/lib/llvm-19/bin/clang ... ok
checking for flags (-fPIC) ... ok
> clang "-fPIC" "-Qunused-arguments" "-m64"
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: error: unknown argument: '-fmodules-ts'
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]:
[@programdir/core/sandbox/modules/os.lua:273]: in function 'runv'
[@programdir/modules/detect/tools/gcc/has_flags.lua:42]:
checking for /usr/lib/llvm-19/bin/clang ... ok
configure
{
host = linux
arch = x86_64
ccache = true
ndk_stdcxx = true
clean = true
plat = linux
kind = static
runtimes = c++_shared
buildir = build
toolchain = llvm
mode = release
} 然后我使用xmake -rvD,输出 checking for flags (clang_print_library_module_manifest_path) ... ok
> clang "-print-library-module-manifest-path" "-Qunused-arguments" "-m64"
[ 0%]: <test> generating.module.deps test.cpp
checkinfo: cannot runv(/usr/lib/llvm-19/bin/clang-scan-deps --version), No such file or directory
checking for /usr/lib/llvm-19/bin/clang-scan-deps ... no
checking for flags (clang_keep_system_includes) ... ok
> clang "-E" "-fkeep-system-includes" "-Qunused-arguments" "-m64"
checking for flags (-std=c++23) ... ok
> clang "-std=c++23" "-Qunused-arguments" "-m64"
/usr/lib/llvm-19/bin/clang -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -stdlib=libc++ -fkeep-system-includes -E -x c++ test.cpp -o build/.gens/test/linux/x86_64/release/rules/bmi/cache/modules/574a3743/test.cpp.i
checking for flags (clang_module_file) ... ok
> clang "-fmodule-file=/tmp/.xmake1002/240921/_6C054ABC1BBD4130878FDB290C5CB260.pcm" "-Qunused-arguments" "-m64"
error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: ...mdir/rules/c++/modules/modules_support/clang/builder.lua:132: module dependency std required for test.cpp not found
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]: in function 'raiselevel'
[@programdir/core/sandbox/modules/utils.lua:143]: in function 'assert'
[...mdir/rules/c++/modules/modules_support/clang/builder.lua:132]: in function '_get_requiresflags'
[...mdir/rules/c++/modules/modules_support/clang/builder.lua:157]: in function '_append_requires_flags'
[...mdir/rules/c++/modules/modules_support/clang/builder.lua:226]: in function 'jobfunc'
[@programdir/modules/async/runjobs.lua:241]:
stack traceback:
[C]: in function 'error'
@programdir/core/base/os.lua:973: in function 'os.raiselevel'
(...tail calls...)
@programdir/core/main.lua:329: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
warning: std and std.compat modules not found ! disabling them for the build, maybe try to add --sdk=<PATH/TO/LLVM>
warning: No clang-scan-deps found ! using fallback scanner 然后我按照提示使用xmake f --sdk=/usr/lib/llvm-19 然后我再次 checking for flags (gcc_deps_format) ... no
> gcc "-fdeps-format=p1689r5"
checkinfo: @programdir/core/sandbox/modules/os.lua:273: gcc: error: unrecognized command-line option ‘-fdeps-format=p1689r5’
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]:
[@programdir/core/sandbox/modules/os.lua:273]: in function 'runv'
[@programdir/modules/detect/tools/gcc/has_flags.lua:42]:
checking for flags (gcc_deps_file) ... no
> gcc "-fdeps-file=/tmp/.xmake1002/240921/_8A23B84F031B472081FC5E08C4151350"
checkinfo: @programdir/core/sandbox/modules/os.lua:273: gcc: error: unrecognized command-line option ‘-fdeps-file=/tmp/.xmake1002/240921/_8A23B84F031B472081FC5E08C4151350’
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]:
[@programdir/core/sandbox/modules/os.lua:273]: in function 'runv'
[@programdir/modules/detect/tools/gcc/has_flags.lua:42]:
checking for flags (gcc_deps_output) ... no
> gcc "-fdeps-target=/tmp/.xmake1002/240921/_5CD4517BFEC149308E10D66F1F646550.o"
checkinfo: @programdir/core/sandbox/modules/os.lua:273: gcc: error: unrecognized command-line option ‘-fdeps-target=/tmp/.xmake1002/240921/_5CD4517BFEC149308E10D66F1F646550.o’
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]:
[@programdir/core/sandbox/modules/os.lua:273]: in function 'runv'
[@programdir/modules/detect/tools/gcc/has_flags.lua:42]:
[ 0%]: <test> generating.module.deps test.cpp
checking for flags (-std=c++23) ... ok
> gcc "-std=c++23"
checking for flags (-D_GLIBCXX_USE_CXX11_ABI=0) ... ok
> gcc "-D_GLIBCXX_USE_CXX11_ABI=0"
/usr/bin/gcc -E -x c++ -std=c++23 -D_GLIBCXX_USE_CXX11_ABI=0 test.cpp -o build/.gens/test/linux/x86_64/release/rules/bmi/cache/modules/574a3743/test.cpp.i
checking for flags (gcc_module_mapper) ... ok
> gcc "-fmodule-mapper=/tmp/.xmake1002/240921/_F8980B4F565F4220861261BCF1D21730"
error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: ...ramdir/rules/c++/modules/modules_support/gcc/builder.lua:102: module dependency std required for test.cpp not found
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]: in function 'raiselevel'
[@programdir/core/sandbox/modules/utils.lua:143]: in function 'assert'
[...ramdir/rules/c++/modules/modules_support/gcc/builder.lua:102]: in function '_get_maplines'
[...ramdir/rules/c++/modules/modules_support/gcc/builder.lua:137]: in function '_generate_modulemapper_file'
[...ramdir/rules/c++/modules/modules_support/gcc/builder.lua:196]: in function 'jobfunc'
[@programdir/modules/async/runjobs.lua:241]:
stack traceback:
[C]: in function 'error'
@programdir/core/base/os.lua:973: in function 'base/os.raiselevel'
(...tail calls...)
@programdir/core/main.lua:329: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
warning: GCC doesn't support module scanning ! using fallback scanner 我不知道是哪里出了问题:( |
你装的不完整,不要用 apt 系统安装 llvm ,直接从 llvm 官网,下载安装包,然后指定 sdk 使用。 |
你又切回 gcc 了。没指定 llvm toolchain |
https://github.com/mstorsjo/llvm-mingw/releases 我在windows下用这个(19.1.1)也不行,报的错和你的一样 @Perdixky |
我使用 linuxbrew 安装的 llvm 也没有办法找到 std 模块。 linuxbrew 安装的 llvm 确实带有 std 模块,但是 xmake 无法找到 |
I installed llvm using linuxbrew and there is no way to find the std module. The llvm installed by linuxbrew does come with the std module, but xmake cannot find it |
这边可以 ruki-2:stdmodules_cpp_only ruki$ xmake f --toolchain=llvm -c
checking for platform ... macosx
checking for architecture ... x86_64
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 14.0
ruki-2:stdmodules_cpp_only ruki$ xmake -rv
checking for flags (clang_print_library_module_manifest_path) ... no
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O3) ... ok
checking for flags (-std=c++26) ... ok
checking for flags (-DNDEBUG) ... ok
[ 0%]: <stdmodules_cpp_only> generating.module.deps src/main.cpp
checking for /usr/local/Cellar/llvm/18.1.5/bin/clang-scan-deps ... ok
/usr/local/Cellar/llvm/18.1.5/bin/clang-scan-deps --format=p1689 -- /usr/local/Cellar/llvm/18.1
.5/bin/clang -x c++ -c src/main.cpp -o build/.objs/stdmodules_cpp_only/macosx/x86_64/release/sr
c/main.cpp.o -Qunused-arguments -m64 -isysroot /Applications/Xcode.app/Contents/Developer/Platf
orms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -fvisibility=hidden -fvisibility-inlines-hid
den -O3 -std=c++26 -DNDEBUG
[ 0%]: <stdmodules_cpp_only> generating.module.deps /usr/local/Cellar/llvm/18.1.5/bin/../lib/c
++/../../share/libc++/v1/std.cppm
/usr/local/Cellar/llvm/18.1.5/bin/clang-scan-deps --format=p1689 -- /usr/local/Cellar/llvm/18.1
.5/bin/clang -x c++ -c /usr/local/Cellar/llvm/18.1.5/bin/../lib/c++/../../share/libc++/v1/std.c
ppm -o build/.objs/stdmodules_cpp_only/macosx/x86_64/release/usr/local/Cellar/llvm/18.1.5/bin/_
_/lib/c++/__/__/share/libc++/v1/std.cppm.o -Qunused-arguments -m64 -isysroot /Applications/Xcod
e.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -fvisibility=h
idden -fvisibility-inlines-hidden -O3 -std=c++26 -DNDEBUG
[ 0%]: <stdmodules_cpp_only> generating.module.deps /usr/local/Cellar/llvm/18.1.5/bin/../lib/c
++/../../share/libc++/v1/std.compat.cppm
/usr/local/Cellar/llvm/18.1.5/bin/clang-scan-deps --format=p1689 -- /usr/local/Cellar/llvm/18.1
.5/bin/clang -x c++ -c /usr/local/Cellar/llvm/18.1.5/bin/../lib/c++/../../share/libc++/v1/std.c
ompat.cppm -o build/.objs/stdmodules_cpp_only/macosx/x86_64/release/usr/local/Cellar/llvm/18.1.
5/bin/__/lib/c++/__/__/share/libc++/v1/std.compat.cppm.o -Qunused-arguments -m64 -isysroot /App
lications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
-fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++26 -DNDEBUG
[ 42%]: <stdmodules_cpp_only> compiling.module.release std
checking for flags (clang_module_output) ... ok
/usr/local/Cellar/llvm/18.1.5/bin/clang -c -Qunused-arguments -m64 -isysroot /Applications/Xcod
e.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -fvisibility=h
idden -fvisibility-inlines-hidden -O3 -std=c++26 -DNDEBUG -x c++-module -fmodule-output=build/.
gens/stdmodules_cpp_only/macosx/x86_64/release/rules/bmi/cache/modules/194f2a7e/std.pcm -Wno-in
clude-angled-in-module-purview -Wno-reserved-module-identifier -o build/.objs/stdmodules_cpp_on
ly/macosx/x86_64/release/usr/local/Cellar/llvm/18.1.5/bin/__/lib/c++/__/__/share/libc++/v1/std.
cppm.o /usr/local/Cellar/llvm/18.1.5/bin/../lib/c++/../../share/libc++/v1/std.cppm
checking for flags (-fdiagnostics-color=always) ... ok
checking for flags (clang_module_file) ... ok
[ 71%]: compiling.release src/main.cpp
/usr/local/Cellar/llvm/18.1.5/bin/clang -c -Qunused-arguments -m64 -isysroot /Applications/Xcod
e.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -fvisibility=h
idden -fvisibility-inlines-hidden -O3 -std=c++26 -DNDEBUG -fmodule-file=std=build/.gens/stdmodu
les_cpp_only/macosx/x86_64/release/rules/bmi/cache/modules/194f2a7e/std.pcm -o build/.objs/stdm
odules_cpp_only/macosx/x86_64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
checking for clang++ ... /usr/local/Cellar/llvm/18.1.5/bin/clang++
checking for the linker (ld) ... clang++
checking for /usr/local/Cellar/llvm/18.1.5/bin/clang++ ... ok
checking for flags (-fPIC) ... ok
[ 85%]: linking.release stdmodules_cpp_only
/usr/local/Cellar/llvm/18.1.5/bin/clang++ -o build/macosx/x86_64/release/stdmodules_cpp_only bu
ild/.objs/stdmodules_cpp_only/macosx/x86_64/release/src/main.cpp.o build/.objs/stdmodules_cpp_o
nly/macosx/x86_64/release/usr/local/Cellar/llvm/18.1.5/bin/__/lib/c++/__/__/share/libc++/v1/std
.cppm.o -m64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Dev
eloper/SDKs/MacOSX14.0.sdk -Wl,-x -Wl,-dead_strip
[100%]: build ok, spent 6.369s |
Ubuntu 24.04 LLVM 19 xmake f --toolchain=llvm -cv ` configure ` xmake -rv ` 怎么设置? |
libc++ 装了么,然后切到 libc++ |
sudo apt install libc++-dev libc++abi-dev 安装 好后可以了,总算在linux上跑成功了 |
Xmake 版本
xmake v2.9.4+HEAD.e85b001
操作系统版本和架构
Linux Perdixky-PC 6.6.36.6-microsoft-standard-WSL2+ #1 SMP PREEMPT_DYNAMIC Fri Sep 6 16:36:32 CST 2024 x86_64 x86_64 x86_64 GNU/Linux
描述问题
我已经安装了clang-19
但是我使用xmake的时候
期待的结果
我希望可以解决这个问题
工程配置
附加信息和错误日志
The text was updated successfully, but these errors were encountered: