Skip to content
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

增加module之后报错 #3420

Open
ethanvc opened this issue Feb 24, 2023 · 6 comments
Open

增加module之后报错 #3420

ethanvc opened this issue Feb 24, 2023 · 6 comments

Comments

@ethanvc
Copy link

ethanvc commented Feb 24, 2023

Xmake 版本

2.7.7

操作系统版本和架构

mac m1 13.2 (22D49)

描述问题

https://github.com/ethanvc/pincpp/blob/main/xmake.lua
当去除注释之后,代码编译不过。错误信息为:

$ xmake b -v protowalker_test
checking for Xcode directory ... %s
checking for Codesign Identity of Xcode ... no
checking for zig ... no
checking for zig ... no
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /usr/bin/gzip
checking for tar ... /usr/bin/tar
/usr/bin/git rev-parse HEAD
checking for cmake ... /opt/homebrew/bin/cmake
checking for cmake ... /opt/homebrew/bin/cmake
checking for xmake::protobuf-cpp ... protobuf-cpp 3.19.4
checking for xcrun -sdk macosx clang ... /usr/bin/xcrun -sdk macosx clang
checking for the c++ compiler (cxx) ... xcrun -sdk macosx clang
checking for /usr/bin/xcrun -sdk macosx clang ... ok
checking for flags (-fPIC) ... ok
checking for flags (clang_modules) ... ok
checking for flags (clang_modules_ts) ... ok
[  0%]: generating.module.deps src/pin/protowalker/test/main.cpp
checking for /usr/bin/xcrun -sdk macosx clang-scan-deps ... no
checking for /usr/bin/xcrun -sdk macosx clang-scan-deps ... no
checking for /usr/bin/xcrun -sdk macosx clang-scan-deps ... no
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-std=c++20) ... ok
checking for flags (-fmodules-ts) ... ok
/usr/bin/xcrun -sdk macosx clang -Qunused-arguments -Isrc -DUSE_MODULES -isystem /Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include -E -x c++ src/pin/protowalker/test/main.cpp -o build/.gens/protowalker_test/macosx/arm64/release/rules/modules/cache/ddec0d22/main.cpp.i
In file included from src/pin/protowalker/test/main.cpp:2:
In file included from /Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include/google/protobuf/message.h:118:
In file included from /Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include/google/protobuf/stubs/casts.h:34:
In file included from /Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include/google/protobuf/stubs/common.h:48:
/Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include/google/protobuf/stubs/port.h:123:2: error: "Protobuf requires at least C++11."
#error "Protobuf requires at least C++11."
 ^
1 error generated.
error: execv(/usr/bin/xcrun -sdk macosx clang -Qunused-arguments -Isrc -DUSE_MODULES -isystem /Users/.xmake/packages/p/protobuf-cpp/3.19.4/ca58cb917128420887238d241be0bef2/include -E -x c++ src/pin/protowalker/test/main.cpp -o build/.gens/protowalker_test/macosx/arm64/release/rules/modules/cache/ddec0d22/main.cpp.i) failed(1)
warning: ./xmake.lua:9: cannot match add_files("src/pin/protowalker/*.cpp") in target(pincpp)
warning: ./xmake.lua:15: cannot match add_files("src/pin/protowalker/test/*.ixx") in target(protowalker_test)

看起来像是依赖了模块之后,编译选项中丢失了-std=c++20.

期待的结果

可以构建通过。

工程配置

No response

附加信息和错误日志

No response

@ethanvc ethanvc added the bug label Feb 24, 2023
@waruqi
Copy link
Member

waruqi commented Feb 24, 2023

目前还不支持 modules 和 protobuf 混用,这是因为 modules 的源码依赖扫描时间点过早,早于 protobuf rule 执行编译

这个目前还在想解决办法,短期内用不了。

#3384

@waruqi waruqi added this to the v2.7.8 milestone Feb 24, 2023
@ethanvc
Copy link
Author

ethanvc commented Feb 24, 2023

ok, thanks. 看来模块的构建还不完善,先不用这个特性了。

@waruqi
Copy link
Member

waruqi commented Feb 27, 2023

@trunkszi

For different issues, please open a separate issue. and please format your logs with markdown code block.

@waruqi waruqi modified the milestones: v2.7.8, v2.7.9 Apr 5, 2023
@waruqi waruqi removed this from the v2.7.9 milestone May 15, 2023
@24bit-xjkp
Copy link
Contributor

我有一个相关的issue #3873,虽然我没有使用protobuf,但generating的时候依然没有加上-std选项。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I have a related issue #3873, although I don't use protobuf, I still don't add the -std option when generating.

@hsoul
Copy link

hsoul commented Jul 19, 2024

╰─$ rm -rf build && xmake clean && xmake f --runtimes=c++_static --toolchain=llvm --sdk=/usr/lib/llvm-19/ && xmake -rv 255 ↵
checking for clang ... /usr/bin/clang
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
checking for flags (clang_modules) ... ok
checking for flags (clang_modules_ts) ... no
checking for /usr/lib/llvm-19/bin/clang ... ok
checking for flags (clang_print_library_module_manifest_path) ... ok
[ 0%]: generating.module.deps test.cpp
[ 0%]: generating.module.deps /usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std.cppm
[ 0%]: generating.module.deps /usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std.compat.cppm
checking for /usr/lib/llvm-19/bin/clang-scan-deps ... no
checking for flags (clang_keep_system_includes) ... ok
checking for flags (-std=c++26) ... ok
/usr/lib/llvm-19/bin/clang -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -fkeep-system-includes -E -x c++ test.cpp -o build/.gens/test1/linux/x86_64/release/rules/bmi/cache/modules/3bbb4f22/test.cpp.i
/usr/lib/llvm-19/bin/clang -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -fkeep-system-includes -E -x c++ /usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std.cppm -o build/.gens/test1/linux/x86_64/release/rules/bmi/cache/modules/daadce5a/std.cppm.i
/usr/lib/llvm-19/bin/clang -Qunused-arguments -m64 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -fkeep-system-includes -E -x c++ /usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std.compat.cppm -o build/.gens/test1/linux/x86_64/release/rules/bmi/cache/modules/daadce5a/std.compat.cppm.i
In file included from /usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std.cppm:222:
/usr/lib/llvm-19/bin/../lib/../share/libc++/v1/std/array.inc:16:22: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
16 | using std::operator<=>;

I encountered a similar issue where the compilation of module-related files failed due to not specifying the -std=xxx flag during compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants