Closed onelxj closed 2 months ago
Fixed via adding build --action_env=BAZEL_CXXOPTS="-std=c++17"
to bazelrc
Thanks =)
Fixed via adding
build --action_env=BAZEL_CXXOPTS="-std=c++17"
to bazelrcThanks =)
--repo_env
should work better as it doesn't pollute the environment of every action.
Also, please keep in mind that what counts for the deps
of a cc_library
is what's in the CcInfo
of your custom rule, not in DefaultInfo
. If all you do is generate files, you may want to reference the custom rule from srcs
, not deps
.
Fixed via adding
build --action_env=BAZEL_CXXOPTS="-std=c++17"
to bazelrc Thanks =)
--repo_env
should work better as it doesn't pollute the environment of every action. Also, please keep in mind that what counts for thedeps
of acc_library
is what's in theCcInfo
of your custom rule, not inDefaultInfo
. If all you do is generate files, you may want to reference the custom rule fromsrcs
, notdeps
.
That my fault, generated stuff is :route-guide-eventuals-generated
, it is in srcs and hdrs already, thanks!
@fmeum Could you please explain, why defaul bazel:linux --cxxopt='-std=c++17' is not valid for this build? Other srcs in the repo that copliling also with cc_library work fine
@onelxj Do you have a complete example reproducing the issue you could share? In a local example I tried --cxxopt
did apply to generated files with e.g. .cpp
extensions.
@fmeum the thing there that target provided in :route-guide-eventuals-generated
is a folder (generated via declare_folder()), I'm not sure, but it can be the reason
That makes a big difference and is likely the reason. However, I'm not familiar enough with the C++ rules to say whether it can be fixed.
@onelxj Could you reopen the issue so that it can be proberly triaged to the C++ team?
That makes a big difference and is likely the reason. However, I'm not familiar enough with the C++ rules to say whether it can be fixed.
@onelxj Could you reopen the issue so that it can be probably triaged to the C++ team?
Thank you for your time!
Trying to force C++ dialect (std c++17) in subcommands on various platforms and using various bazel build arguments…
Project \ Platform | gLinux Linux github |
gMacOS (Intel/M1) | MacOS github (intel) | gWindows Windows github |
---|---|---|---|---|
Repo:bazel-cpp Branch: arg –cxxopt=”-std=c++17” |
APPEND | APPEND | APPEND | ADDED |
Repo:bazel-cpp Branch: env –action_env=BAZEL_CXXOPTS=”-std=c++17” |
REPLACE | REPLACE | IGNORED | IGNORED |
Repo:bazel-proto protobuf v21.12 –cxxopt=”-std=c++17” |
APPEND | APPEND | APPEND | ADDED |
Repo:bazel-proto protobuf v21.12 –action_env=BAZEL_CXXOPTS=”-std=c++17” |
REPLACE | REPLACE | IGNORED C++11 used -> absl build fail |
IGNORED |
Repo:bazel-proto Branch: arg protobuf v22.2 + Fix #12320 –cxxopt=”-std=c++17” |
IGNORED C++0x used absl build fail |
IGNORED C++0x used -> absl build fail |
APPEND | IGNORED |
Repo: bazel-proto Branch: env protobuf v22.2 + Fix #12320 –action_env=BAZEL_CXXOPTS=”-std=c++17” |
REPLACE | REPLACE bug #12306 |
IGNORED C++11 used -> absl build fail |
IGNORED |
Legend:
ADDED
: the c++17 flag is added to the subcommandAPPEND
: std=c++17 is appended in the subcommand (i.e. the default flag is still present)REPLACE
: the default flag is replaced by the one passed as argumentIGNORED
: the flags argument seems completely ignored/dropped and I can’t find it in any subcommand trace logdev note: use --subcommands=true
or -s
to get # SUBCOMMAND ...
trace log
repo: https://mizux.dev/bazel-cpp
repo: https://mizux.dev/bazel-proto
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage
in a comment here and we'll take a look. Thanks!
Description of the bug:
I have a rule that returns DefaultInfo(depset(...)) - folder that consists of c++ sources and headers, then I'm trying to compile it with
The sources require c++17, in bazelrc I have
but whenever I try to run - it uses C++11 instead of 17 if uncomment
copts
, that includes '-std=c++17' - it worksWhat's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
Linux Ubuntu 22.04
What is the output of
bazel info release
?release 5.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response