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

Can't generate Project on M1 #587

Closed
AnjeyNov opened this issue Jul 29, 2021 · 7 comments
Closed

Can't generate Project on M1 #587

AnjeyNov opened this issue Jul 29, 2021 · 7 comments

Comments

@AnjeyNov
Copy link

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!

Originally posted by @mahenzon in #467 (comment)

@AnjeyNov AnjeyNov changed the title **UPD**: решено: https://github.com/bazelbuild/bazel/pull/12900#issuecomment-769900027 Can't generate Project Jul 29, 2021
@AnjeyNov
Copy link
Author

I do everything as described above, but I get a message

usage: Make [-h] [--verbose] --bazel path [--bazelUserRoot path] [--overrideBazelVersion] [--overrideXcodeVersion] [--bazelArguments arguments] [--cacheHost http://host:9092 | --cacheDir path]
            {clean,generateProject,build} ...
Make: error: unrecognized arguments: --bazel_x86_64=/Users/anjeynovitskiy/bazel-dist/bazel

@AnjeyNov AnjeyNov changed the title Can't generate Project Can't generate Project on M1 Jul 29, 2021
@ali-fareed
Copy link

An Intel version of Bazel is no longer required, so the --bazel_x86_64 argument was dropped.

@AnjeyNov
Copy link
Author

How can i generate a project on Mac M1? None of the instructions found for me can do this (

@ali-fareed
Copy link

At which step are you getting stuck?

@AnjeyNov
Copy link
Author

  1. Clone the project from GitHub:
    git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git
    DONE ✅

  2. Download Bazel 4.0.0 to ~/bazel-arm
    DONE ✅

  3. Adjust configuration parameters

Modify the values in variables.bzl - SKIP
Replace the provisioning profiles in provisioning with valid files - SKIP
Replace value "Xcode" in Telegram_iOS/versions.json to "12.5.1"

  1. Create a build cache directory to speed up rebuilds
    DONE ✅

  2. Build the app

Run:

python3 build-system/Make/Make.py \
    --bazel="$HOME/bazel-arm/bazel" \
    --cacheDir="$HOME/telegram-bazel-cache" \
    build \
    --configurationPath="$HOME/telegram-configuration" \
    --buildNumber=100001 \
    --configuration=release_universal;  

but I get a message:

libpng warning: Warning: Input PNG does not have an 8 bit input depth.  Please convert your PNG to 8-bit for optimal performance on iPhone OS.
ERROR: /Users/anjeynovitskiy/Telegram-iOS/Telegram/BUILD:530:18: Processing and signing TelegramWatchExtension failed: (Exit 1): process-and-sign-1202728910.sh failed: error executing command 
  (cd /private/var/tmp/_bazel_anjeynovitskiy/07474b6724c73e05d47a84ddd296afbc/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=WatchOS \
    APPLE_SDK_VERSION_OVERRIDE=7.4 \
    XCODE_VERSION_OVERRIDE=12.5.1.12E507 \
  bazel-out/applebin_watchos-watchos_armv7k-opt-ST-58153144368d/bin/Telegram/TelegramWatchExtension-intermediates/process-and-sign-1202728910.sh should_sign should_compress)
Execution platform: @local_config_platform//:host
ERROR: Unable to find an identity on the system matching the ones in external/build_configuration/provisioning/WatchExtension.mobileprovision
Target //Telegram:Telegram failed to build
INFO: Elapsed time: 3837.920s, Critical Path: 1861.26s
INFO: 7691 processes: 930 internal, 6761 local.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
  File "/Users/anjeynovitskiy/Telegram-iOS/build-system/Make/Make.py", line 615, in <module>
    build(arguments=args)
  File "/Users/anjeynovitskiy/Telegram-iOS/build-system/Make/Make.py", line 418, in build
    bazel_command_line.invoke_build()
  File "/Users/anjeynovitskiy/Telegram-iOS/build-system/Make/Make.py", line 311, in invoke_build
    call_executable(combined_arguments)
  File "/Users/anjeynovitskiy/Telegram-iOS/build-system/Make/BuildEnvironment.py", line 60, in call_executable
    subprocess.check_call(resolved_arguments, env=resolved_env)
  File "/opt/homebrew/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/anjeynovitskiy/bazel-arm/bazel', 'build', 'Telegram/Telegram', '--override_repository=build_configuration=/Users/anjeynovitskiy/telegram-configuration', '--announce_rc', '--features=swift.use_global_module_cache', '--verbose_failures', '--features=swift.skip_function_bodies_for_derived_files', '--jobs=8', '--define=buildNumber=100001', '--define=telegramVersion=7.8.4', '--features=swift.split_derived_files_generation', '--disk_cache=/Users/anjeynovitskiy/telegram-bazel-cache', '-c', 'opt', '--ios_multi_cpus=armv7,arm64', '--watchos_cpus=armv7k,arm64_32', '--apple_generate_dsym', '--output_groups=+dsyms', '--features=swift.opt_uses_wmo', '--features=swift.opt_uses_osize', '--swiftcopt=-num-threads', '--swiftcopt=0', '--features=dead_strip', '--objc_enable_binary_stripping', '--apple_bitcode=watchos=embedded']' returned non-zero exit status 1.
  1. Generate an Xcode project

Run:

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

I get a project with errors
Снимок экрана 2021-07-29 в 20 19 04

to solve this error I use

but when executing the command:

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

get

usage: Make [-h] [--verbose] --bazel path [--bazelUserRoot path] [--overrideBazelVersion] [--overrideXcodeVersion] [--bazelArguments arguments]
            [--cacheHost http://host:9092 | --cacheDir path]
            {clean,generateProject,build} ...
Make: error: unrecognized arguments: --bazel_x86_64=/Users/anjeynovitskiy/bazel-dist/bazel

@ali-fareed
Copy link

An Intel version of Bazel is no longer required, so the --bazel_x86_64 argument was dropped.

@Rotemy
Copy link

Rotemy commented Jan 19, 2022

For anyone that has M1 Max, what I did is downloaded version 5 from here https://github.com/bazelbuild/bazel/releases/tag/5.0.0 and used that. Nothing else worked for me.

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