-
Notifications
You must be signed in to change notification settings - Fork 273
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
Missing support for iPhoneSimulator platform on arm64 #980
Comments
I haven't heard of anyone successfully doing this yet (although I doubt many have tried). I also haven't audited the rules or bazel core for where these assumptions are (i imagine many are in bazel itself) |
I did a little bit more digging and found the following assumption in the More critically, though, it looks like the method for selecting the build platform to use assumes a 1:1 mapping between |
Related: bazelbuild/bazel#11628 I def agree there's some UX question here because of the archs overlap |
Facing the same problem here. |
I wouldn't expect there to be much investment in Apple Silicon in the near term so if this is blocking you I would suggest submitting a PR to bazel core with the fix |
For anyone blocked on being able to build an arm64 iOS simulator slice, I came up with a small patch to bazel core that adds support -- check out bazel at the Then generate an arm64 iOS Simulator slice by running:
I don't have a plan to contribute this as-is to bazel as it seems like this may not be the right approach to fixing the archs overlap issue, but it's good enough to solve the immediate problem. |
indragiek's solution works for me, but if you have Swift files in your project, you may need a small change in |
From https://gist.github.com/indragiek/e14162c0098d97ee976bceae9441f04d#file-ios_sim_arm64-patch Referenced at bazelbuild/rules_apple#980 To build: bazel build ... --cpu=ios_sim_arm64 --apple_platform_type=ios
@indragiek Trying to use your solution to get the arm64 simulator slice from an intel mac in Catalina 10.15.7. This is the script I am using to build bazel with your patch: #!/bin/zsh
set -euo pipefail
readonly WORK_DIR="$(pwd)"
readonly BUILD_DIR="${WORK_DIR}/build-frameworks"
readonly OUTPUT_DIR="${BUILD_DIR}/output"
readonly BAZEL_DIR="${BUILD_DIR}/bazel"
readonly BAZEL_BIN="${BAZEL_DIR}/bin/bazel"
download_patched_version_of_bazel() {
mkdir -p "${BAZEL_DIR}/4.1.0"
cd "${BAZEL_DIR}/4.1.0"
curl -O -L "https://github.com/bazelbuild/bazel/releases/download/4.1.0/bazel-4.1.0-darwin-x86_64"
mv bazel-4.1.0-darwin-x86_64 bazel
chmod +x bazel
cd "${BAZEL_DIR}"
git clone --branch "3.7.2" --depth 1 https://github.com/bazelbuild/bazel.git "3.7.2"
cd "3.7.2"
curl -O -L https://gist.githubusercontent.com/indragiek/e14162c0098d97ee976bceae9441f04d/raw/dba3a66a90d0a96d0dc6e236ab3fa1d41a2ce359/ios_sim_arm64.patch
git apply ios_sim_arm64.patch
# To install java11 on macos: brew install java11 https://mkyong.com/java/how-to-install-java-on-mac-osx/
# https://github.com/bazelbuild/bazel/issues/11399#issuecomment-628945756
# https://github.com/bazelbuild/rules_nodejs/issues/1301
export JAVA_HOME="/usr/local/opt/openjdk@11/libexec/openjdk.jdk/Contents/Home" && "${BAZEL_DIR}"/4.1.0/bazel build --incompatible_restrict_string_escapes=false -c opt //src:bazel
mkdir -p "$(dirname ${BAZEL_BIN})"
cp bazel-bin/src/bazel "${BAZEL_BIN}"
chmod +x "${BAZEL_BIN}"
cd "${WORK_DIR}"
} Which then I am using as:
Bazel builds correctly with your patch, but then when using it I am getting the following error:
Any help would be much appreciated 🙌 EDIT: never mind, seems an issue specific to the project I am building and not bazel 🙏 |
From https://gist.github.com/indragiek/e14162c0098d97ee976bceae9441f04d#file-ios_sim_arm64-patch Referenced at bazelbuild/rules_apple#980 To build: bazel build ... --cpu=ios_sim_arm64 --apple_platform_type=ios
Hi @acecilia, I got the same error. It seems that |
@peterkorodi yes. I managed to compile an xcframework for tensorflowlite. Find the binary here: https://github.com/revolut-mobile/TensorFlowLiteC-binary/releases/tag/2.5.0 |
Note that this stuff is starting to land upstream, once bazelbuild/bazel#13870 lands building for the arm64 simulator should work |
bazelbuild/bazel#13870 seems to have been merged for release in Bazel 5.0, targeted release date November 16. |
Closing this now that |
@acecilia are you still using your patches to build TensorFlowLiteC for Apple Silicon or is there an easier path now? |
@bvirlet I did not need to rebuild TensorFlowLiteC yet, so no idea about current status |
I've been stuck on this for awhile now. Since the introduction of Xcode 12, the default behavior when building a binary for all architecture is to include the iPhoneSimulator target for arm64, which would be to support Apple Silicon computers.
I'm trying to build an
apple_static_library
for the simulator with something like a--ios_multi_cpus=arm64,x86_64
option to build a simulator fat archive with both simulator slices.Ultimately my goal is to create a simulator fat archive and a device fat archive and then merge them into an XCFramework that is importable by an Xcode based project, but I am stuck on figuring out how to configure bazel to build something that doesn't always assume that
arm64
isiphoneos
andiphonesimulator
isx86_64
ori386
.I've been looking through the rules and configuration in this repo and don't think that this is possible. Am I missing something, or is this a missing feature?
The text was updated successfully, but these errors were encountered: