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

Force Bazel to use different minimum macos version #41

Open
os12345678 opened this issue May 15, 2024 · 3 comments
Open

Force Bazel to use different minimum macos version #41

os12345678 opened this issue May 15, 2024 · 3 comments

Comments

@os12345678
Copy link
Contributor

os12345678 commented May 15, 2024

I am trying to bazel build @llvm-project//mlir/...:all but am getting errors with the minimum macos version.

external/llvm-project/llvm/utils/TableGen/DFAEmitter.cpp:367:18: error: 'get<unsigned int, llvm::Record *, unsigned int, std::string>' is unavailable: introduced in macOS 10.13 OS << std::get<unsigned>(SingleAction); ^

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1544:22: note: 'get<unsigned int, llvm::Record *, unsigned int, std::string>' has been explicitly marked unavailable here constexpr const _Tp& get(const variant<_Types...>& __v) {

I have added --macos_minimum_os=10.13 in .bazelrc but it seems to get ignored - building with verbose_failure flag shows '-mmacosx-version-min=10.11.

sw_vers ProductName: macOS ProductVersion: 13.2.1 BuildVersion: 22D68
clang --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Any help is appreciated, thanks!

@j2kun
Copy link
Owner

j2kun commented May 15, 2024

I don't have a mac machine to test on, but I think that flag may be for when you're building applications for Mac systems, not necessarily which C++ toolchain is used.

I see this in bazel upstream: https://github.com/bazelbuild/bazel/blob/28898a91543cb9388fae4231ccbebbba65177d71/src/main/starlark/builtins_bzl/common/xcode/providers.bzl#L177-L193

Which suggests to me you should be setting some macos_sdk_version: https://bazel.build/reference/command-line-reference#flag--macos_sdk_version

Could you try that and let me know if it works? Please send a PR to add that to .bazelrc if you get it working and have the time.

@j2kun
Copy link
Owner

j2kun commented May 15, 2024

I'm afraid you may need to update your xcode version, because it looks like bazel detects the xcode version automatically here.

@Stevengre
Copy link

Thank you very much for this helpful tutorial! In my macbook air M2, this command cannot be ommitted in .bazelrc:common --host_cxxopt='-std=c++17'. However, the environment setup seems can be skiped. I just check this and I don't know why. I hope this information can be helpful.

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

No branches or pull requests

3 participants