xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
686 stars 396 forks source link

使用abseil在编译程序时在编译参数中出现两个-std #4543

Open cangfengzhs opened 4 months ago

cangfengzhs commented 4 months ago

Xmake 版本

2.9.3

操作系统版本和架构

ubuntu2004

描述问题

指定了c++20,但是编译时还是出现了c++11,导致编译失败

期待的结果

正常编译

工程配置

set_languages("c++20") add_requires("cmake",{system=false}) add_requires("folly",{system=false}) add_requires("glog",{system=false}) add_requires("rocksdb",{system=false}) add_requires("protobuf-cpp",{system=false}) add_requires("grpc",{system=false}) add_rules("mode.release", "mode.debug")

add_includedirs("src") includes("src")

附加信息和错误日志

[ 57%]: compiling.proto.release build/.gens/service/linux/x86_64/release/rules/protobuf/src/server/service.pb.cc
/usr/local/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++20 -Isrc -DCARES_STATICLIB -isystem /home/hs.zhang/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/include -isystem /home/hs.zhang/.xmake/packages/c/c-ares/1.31.0/be48f65bbe0e4b938690caefd528c9f4/include -isystem /home/hs.zhang/.xmake/packages/p/protobuf-cpp/27.0/3a6ae090d364400a86d45d58d50c750c/include -isystem /home/hs.zhang/.xmake/packages/a/abseil/20240116.2/6c303faaea804797b8674f1e2feed274/include -std=c++11 -pthread -DNDEBUG -Ibuild/.gens/service/linux/x86_64/release/rules/protobuf/src -o build/.objs/service/linux/x86_64/release/gens/rules/protobuf/src/server/service.pb.cc.o build/.gens/service/linux/x86_64/release/rules/protobuf/src/server/service.pb.cc
In file included from /home/hs.zhang/.xmake/packages/a/abseil/20240116.2/6c303faaea804797b8674f1e2feed274/include/absl/base/config.h:92,
                 from /home/hs.zhang/.xmake/packages/a/abseil/20240116.2/6c303faaea804797b8674f1e2feed274/include/absl/base/attributes.h:37,
                 from /home/hs.zhang/.xmake/packages/a/abseil/20240116.2/6c303faaea804797b8674f1e2feed274/include/absl/strings/string_view.h:39,
                 from /home/hs.zhang/.xmake/packages/p/protobuf-cpp/27.0/3a6ae090d364400a86d45d58d50c750c/include/google/protobuf/stubs/common.h:21,
                 from /home/hs.zhang/.xmake/packages/p/protobuf-cpp/27.0/3a6ae090d364400a86d45d58d50c750c/include/google/protobuf/io/coded_stream.h:108,
                 from build/.gens/service/linux/x86_64/release/rules/protobuf/src/server/service.pb.h:20,
                 from build/.gens/service/linux/x86_64/release/rules/protobuf/src/server/service.pb.cc:6:
/home/hs.zhang/.xmake/packages/a/abseil/20240116.2/6c303faaea804797b8674f1e2feed274/include/absl/base/policy_checks.h:79:2: error: #error "C++ versions less than C++14 are not supported."
   79 | #error "C++ versions less than C++14 are not supported."
      |  ^~~~~
Issues-translate-bot commented 4 months ago

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


Title: When using abseil to compile the program, two -std appear in the compilation parameters.

star-hengxing commented 4 months ago

执行一下,定位多余的 flags 哪里来的

$ xmake show -t <target>
Issues-translate-bot commented 4 months ago

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


Execute it and locate where the redundant flags come from.

$ xmake show -t <target>
cangfengzhs commented 4 months ago

应该是从grpc过来的。 通过add_requires("grpc",{system=false,configs={language="c++20"}}) 指定了language解决了这个问题

Issues-translate-bot commented 4 months ago

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


It should come from grpc. By add_requires("grpc",{system=false,configs={language="c++20"}}) Specifying language solved this problem