-
Notifications
You must be signed in to change notification settings - Fork 21
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
Bazel build does not default to -std=c++14 (or later) #186
Comments
Great to hear from you again, Brian! This issue is surprising and concerning. It's definitely a goal of Au that any user should be able to simply clone the repo and build out of the box, with no setup required. That has been my and others' experience so far, but apparently it isn't universal. The issue might be mac related, but unfortunately, I don't have any way to test on a mac. First: what happens if you run Also, you say you're using bazelisk. Au includes bazelisk as well. Do you mean that you're using our bazelisk, or one you installed yourself? And what happens when you run Can you tell whether you're using the default Also, does it use C++14 when you do In terms of preferred fixes, I think the first would definitely be best. Right now, |
Thanks, Chip! Good to hear from you as well :-)
So, despite me specifying the config, cc-compiler-darwin_arm64 gets selected... This might also be telling:
|
Ah --- that's a telling result! I forgot to mention that the "just clone and run bazel" workflow has another step: setting up direnv to add our tools to your
I'm not super optimistic that simply setting up the |
Setting up direnv doesn't seem to have helped: au % which bazel |
Hmm... do you have evidence that direnv is otherwise working? Maybe something like |
I believe it is working. which au-docs-serve shows a valid path. And indeed, echo $PATH shows several entries added. |
Sanity check: does the Au folder show up before So... where are we at here?
I'm not really sure where to go from here. @philsc, if you get any spare cycles to look at this, do you have any ideas? |
@SagaciousB , could you give the following a try?
That should prevent bazel from looking at your host system for a toolchain. If that works, we should be able to encode that in bazelisk. I'm not entirely sure that the library we're using to set up clang will download a Mac variant, but I'm hopeful. @chiphogg , is there any way to add a Mac machine to the CI setup? I'm guessing the answer is no. |
/opt/homebrew/bin is at the root level (not a subdirectory of the au/ folder). However,
This did not work: ERROR: /private/var/tmp/_bazel_briansaghy/3047493c79fd1e640ae6a43cd0621331/external/bazel_tools/tools/cpp/BUILD:58:19: in cc_toolchain_alias rule @bazel_tools//tools/cpp:current_cc_toolchain: Unable to find a CC toolchain using toolchain resolution. Did you properly set --platforms? I tried setting --platforms=@platforms//os:macos but I get "Target @platforms//os:osx was referenced as a platform, but does not provide PlatformInfo" |
Okay. So I think what's happening is that we don't ourselves define a toolchain for macOS. So Bazel falls back to auto-configuring your host toolchain. Not sure how Bazel decides to do this auto-configuration, honestly. Either way, it does not set up the compiler for C++14, it seems. I'll think of some possibilities here. |
@SagaciousB , what kind of Mac do you have? Is it an ARM-based one? |
Yes, it's an M2 MacBook Pro |
Would you mind giving https://github.com/philsc/au/tree/c%2B%2B14-for-macos a try, @SagaciousB ? I can't test it myself (no mac), but I hope it'll work. EDIT: Or put another way, could you give philsc@004fbb3 a try? |
In trying to compile au, I found that a simple
bazel test //...:all
command resulted in errors out-of-the-box due to defaulting to the C++11 standardEx:
I noticed that the build command included the flag -std=c++11 :
Manually specifying via the --cxxopts flag fixes this issue:
bazel test --cxxopt="--std=c++14" //...:all
Development Enviornment:
Note:
the WORKSPACE file does include the following:
but it doesn't appear to be used.
Potential Fixes:
The text was updated successfully, but these errors were encountered: