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

Disable cc toolchain resolution in examples on Mac #967

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

comius
Copy link
Contributor

@comius comius commented Sep 20, 2022

The examples/cmake_android picks up local instead of Android Cc toolchains.

The examples/cmake_android picks up local instead of Android Cc toolchains.
@jsharpe
Copy link
Member

jsharpe commented Sep 20, 2022

I'm not familiar with the android toolchains at all so can you clarify to me here is there an issue with the build files in rules_foreign_cc examples that needs fixing to flip this flag or is it a bazel core issue?

@comius
Copy link
Contributor Author

comius commented Sep 21, 2022

I'm not familiar with the android toolchains at all so can you clarify to me here is there an issue with the build files in rules_foreign_cc examples that needs fixing to flip this flag or is it a bazel core issue?

It seems the problem is in rules_foreign_cc. For reproduction run cd examples; bazel build --incompatible_enable_cc_toolchain_resolution -- //cmake_android:all on Mac.

Example error:

ERROR: /Users/ilist/src/rules_foreign_cc/examples/cmake_android/BUILD.bazel:5:6: Foreign Cc - CMake: Building libhello failed: (Exit 64): bash failed: error executing command /bin/bash -c bazel-out/android-armeabi-v7a-fastbuild/bin/cmake_android/libhello_foreign_cc/wrapper_build_script.sh

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____

Bazel external C/C++ Rules. Building library libhello

xcrun: error: no utility name specified
Usage: xcrun [options] <tool name> ... arguments ...

Link to logs: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2641#01835443-c1d8-4c64-b27a-4d7c3f6da962

I further inspected and compared the generated cmake_android/libhello_foreign_cc/build_script.sh scripts.

Good ones point to /androidndk/ndk/toolchains/llvm/prebuilt/darwin-x86_64/, bad ones point to local_config_cc.

I'm assuming those scripts are generated by rules_foreign_cc and somewhere they depend on crosstool_top instead on cc toolchain.

@jsharpe jsharpe merged commit a7f9e8b into bazel-contrib:main Sep 23, 2022
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

Successfully merging this pull request may close these issues.

2 participants