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

Cannot run simulator on M1 Mac #467

Closed
mahenzon opened this issue Jan 26, 2021 · 7 comments
Closed

Cannot run simulator on M1 Mac #467

mahenzon opened this issue Jan 26, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@mahenzon
Copy link

I built XCode project using bazel (point 6 at README), trying to build the app and run it in the simulator, but getting this error:

In cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'ios_sim_arm64'

image

I think it's related to this line

'\'--cpu=ios_arm64\'.replace(\'ios_arm64\', \'ios_sim_arm64\' if os.environ.get(\'EFFECTIVE_PLATFORM_NAME\') '

ios_sim_arm64

There's some patch containing ios_sim_arm64, but I'm not sure how to apply it
https://gist.github.com/brentleyjones/17d8bcf308558a19dd54a30e4a6db57a

did you test it running on M1 Mac? I see the repo is updated for arm CPU, but I cannot run it on my machine because sim is not starting

Environment

Device: Apple MacBook Pro (13-inch, M1, 2020)

macOS version: 11.1 (20C69)


Some more screenshots in case it can help:

image

image

@mahenzon mahenzon added the bug Something isn't working label Jan 26, 2021
@ali-fareed
Copy link

Building for arm64 simulator is currently implemented is an internal branch. The patches will be published with the next release build.

@ali-fareed
Copy link

With the latest commit it's possible to build the app for arm64 simulators.
To do this a patched Bazel is required. The Bazel itself should not be older than bazelbuild/bazel@8c7e11a

After checking out Bazel apply this patch: bazelbuild/rules_apple#980 (comment) (rules_swift is already patched and points to our internal fork for now).

An x86_64 version of Bazel is still required to build Tulsi (until bazelbuild/bazel#12671 is resolved).

After that, use the following command to generate a project file:

python3 build-system/Make/Make.py \
	--bazel="$HOME/bazel/bazel" \
	--cacheDir="$HOME/build/telegram/bazel-cache" \
	--overrideBazelVersion \
	generateProject \
	--bazel_x86_64=$HOME/bazel/bazel_x86_64 \
	--configurationPath="$HOME/telegram-configuration" \
	 --disableExtensions

@mahenzon
Copy link
Author

tried to build bazel for darwin_arm64, but getting an error, described it here bazelbuild/bazel#12900 (comment)

but if you succeeded building bazel for arm and generating project, maybe you could help me with this? my steps were:

  • clone bazel
  • apply patch
  • build bazel for arm using bazel for x86 (this ends up with an error)

@mahenzon
Copy link
Author

UPD: this is solved: bazelbuild/bazel#12900 (comment)

Full list of steps for building TG:

Your build will be in bazel-bin/src/bazel. Copy it where you need it and run chmod +x bazel

Note that this build's version will be no_version:

➜ ./bazel --version
bazel no_version

So you'll need to use flag --overrideBazelVersion. Also, Xcode version changed too already, so the full command for me was:

python3 build-system/Make/Make.py \
    --overrideXcodeVersion --overrideBazelVersion \
    --bazel="$HOME/bazel-arm/bazel" \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --bazel_x86_64="$HOME/bazel-dist/bazel"\
    --configurationPath="$HOME/telegram-configuration" \
    --disableExtensions \
    --disableProvisioningProfiles

Also note that --bazel uses new arm version, but --bazel_x86_64 is still that old x86 v3.7.0

And this time simulator can be run!

@ali-fareed
Copy link

I would recommend to build Bazel in release mode by adding -c opt:

~/bazel-dist-4.0.0/bazel build --cpu=darwin_arm64 -c opt //src:bazel

@bohlool
Copy link

bohlool commented Apr 14, 2021

I have M1 Macbook and I'm trying to build this project using instructions that is provided here but I'm getting following error.

Screen Shot 2021-04-14 at 6 56 56 PM

Any help is appreciated.

@ali-fareed
Copy link

@bohlool Please open a new issue.

@TelegramMessenger TelegramMessenger locked as resolved and limited conversation to collaborators Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants