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

Compile issues of release-5.13 #219

Closed
shivanraptor opened this issue Jan 3, 2020 · 82 comments
Closed

Compile issues of release-5.13 #219

shivanraptor opened this issue Jan 3, 2020 · 82 comments

Comments

@shivanraptor
Copy link

I just cloned / downloaded the release-5.13 source, and cannot find the Workspace file Telegram-iOS.xcworkspace to start with. Help!

@ghost
Copy link

ghost commented Jan 3, 2020

It seems like they just open source the code, but don't want anyone else to build, strange.

@alyfreym
Copy link

alyfreym commented Jan 3, 2020

Yes, after many days of trying to build project, I realized what it is fake open source project

@shivanraptor
Copy link
Author

Yes, after many days of trying to build project, I realized what it is fake open source project

no. Telegram is actually an open source project. The Workspace file is included in previous releases. Let's not lose faith.

@alyfreym
Copy link

alyfreym commented Jan 3, 2020

Yes, after many days of trying to build project, I realized what it is fake open source project

no. Telegram is actually an open source project. The Workspace file is included in previous releases. Let's not lose faith.

Ok last release 5.11, it starts but it has a lot of errors in new versions ios its crashed for example - App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead. and there are many such errors. As a result, we get open-source project which cannot be used. it is very unstable, in each assembly there are some problems with dependencies.

@strangeliu
Copy link

It seems telegram change to use buck to build and it's able to create a project file via buck project,
but it's missing some config files somehow.

@klaus01
Copy link

klaus01 commented Jan 3, 2020

I have generated the Telegram_Buck.xcworkspace file, compiled successfully in Xcode 11.3, and run normally in the simulator.

Generate Telegram_Buck.xcworkspace method:

  1. Need to install buck, and buck project can run normally.
  2. Insert before include Utils.makefile in the Makefile file:
export BUCK=buck
export TELEGRAM_ENV_SET=1
export DEVELOPMENT_CODE_SIGN_IDENTITY=iPhone Distribution: Digital Fortress LLC (C67CF9S4VU)
export DISTRIBUTION_CODE_SIGN_IDENTITY=iPhone Distribution: Digital Fortress LLC (C67CF9S4VU)
export DEVELOPMENT_TEAM=C67CF9S4VU
export API_ID=8
export API_HASH=7245de8e747a0d6fbe11f7cc14fcc0bb
export BUNDLE_ID=ph.telegra.Telegraph
export IS_INTERNAL_BUILD=false
export IS_APPSTORE_BUILD=true
export APPSTORE_ID=686449807
export APP_SPECIFIC_URL_SCHEME=tgapp
export BUILD_NUMBER=199
export ENTITLEMENTS_APP=Telegram-iOS/Telegram-iOS-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_APP=match Development ph.telegra.Telegraph
export DISTRIBUTION_PROVISIONING_PROFILE_APP=match AppStore ph.telegra.Telegraph
export ENTITLEMENTS_EXTENSION_SHARE=Share/Share-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE=match Development ph.telegra.Telegraph.Share
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE=match AppStore ph.telegra.Telegraph.Share
export ENTITLEMENTS_EXTENSION_WIDGET=Widget/Widget-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET=match Development ph.telegra.Telegraph.Widget
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET=match AppStore ph.telegra.Telegraph.Widget
export ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE=NotificationService/NotificationService-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE=match Development ph.telegra.Telegraph.NotificationService
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE=match AppStore ph.telegra.Telegraph.NotificationService
export ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT=NotificationContent/NotificationContent-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT=match Development ph.telegra.Telegraph.NotificationContent
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT=match AppStore ph.telegra.Telegraph.NotificationContent
export ENTITLEMENTS_EXTENSION_INTENTS=SiriIntents/SiriIntents-AppStoreLLC.entitlements
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS=match Development ph.telegra.Telegraph.SiriIntents
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS=match AppStore ph.telegra.Telegraph.SiriIntents
export DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP=match Development ph.telegra.Telegraph.watchkitapp
export DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP=match AppStore ph.telegra.Telegraph.watchkitapp
export DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION=match Development ph.telegra.Telegraph.watchkitapp.watchkitextension
export DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION=match AppStore ph.telegra.Telegraph.watchkitapp.watchkitextension
export BUILDBOX_DIR=buildbox
export CODESIGNING_PROFILES_VARIANT=appstore
export PACKAGE_METHOD=appstore
  1. Insert in SHARED_CONFIGS of Config/utils.bzl file:
    "DEAD_CODE_STRIPPING": "YES",
  1. Execute the command make project

@alyfreym
Copy link

alyfreym commented Jan 4, 2020

https://core.telegram.org/reproducible-builds#reproducible-builds-for-ios. Docs how to build telegram using buck.

@Floris497
Copy link

Floris497 commented Jan 4, 2020

I was able to build with buck following those instructions.. but I end up with an "Error 2" Alert on a black screen.. not sure If i'm missing anything obvious. I did enter my own API key (if in the right place..?) and I changed to my own code sign certificate + profiles. Both when i build with buck or the buck generated xcode project. either in Simulator or on a real iPhone.

Image 04-01-2020 at 16 34

EDIT: My bad, had groups set up incorrectly. build is working now.

@shivanraptor
Copy link
Author

I encountered couple errors after successfully generated the project workspace via make project with the instructions above.

Error 1 - Undefined symbols: _swift_getFunctionReplacement

Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error 2 - Missing com.apple.developer.pushkit.unrestricted-voip in provisioning profile

I can only clear this error by removing the key in the entitlements file, which I think I shouldn't.

How can I resolve this?

@strangeliu
Copy link

I encountered couple errors after successfully generated the project workspace via make project with the instructions above.

Error 1 - Undefined symbols: _swift_getFunctionReplacement

Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error 2 - Missing com.apple.developer.pushkit.unrestricted-voip in provisioning profile

I can only clear this error by removing the key in the entitlements file, which I think I shouldn't.

How can I resolve this?

enable dead-code-stripping

@klaus01
Copy link

klaus01 commented Jan 7, 2020

I encountered couple errors after successfully generated the project workspace via make project with the instructions above.

Error 1 - Undefined symbols: _swift_getFunctionReplacement

Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error 2 - Missing com.apple.developer.pushkit.unrestricted-voip in provisioning profile

I can only clear this error by removing the key in the entitlements file, which I think I shouldn't.

How can I resolve this?

Insert in SHARED_CONFIGS of Config/utils.bzl file:

    "DEAD_CODE_STRIPPING": "YES",

@shivanraptor
Copy link
Author

I encountered couple errors after successfully generated the project workspace via make project with the instructions above.
Error 1 - Undefined symbols: _swift_getFunctionReplacement

Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error 2 - Missing com.apple.developer.pushkit.unrestricted-voip in provisioning profile
I can only clear this error by removing the key in the entitlements file, which I think I shouldn't.
How can I resolve this?

Insert in SHARED_CONFIGS of Config/utils.bzl file:

    "DEAD_CODE_STRIPPING": "YES",

It works. Any idea about Error 2 ?

@klaus01
Copy link

klaus01 commented Jan 7, 2020

I encountered couple errors after successfully generated the project workspace via make project with the instructions above.
Error 1 - Undefined symbols: _swift_getFunctionReplacement

Undefined symbols for architecture arm64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getFunctionReplacement50)
  "_swift_getOrigOfReplaceable", referenced from:
      _swift_getOrigOfReplaceable50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)
     (maybe you meant: _swift_getOrigOfReplaceable50)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error 2 - Missing com.apple.developer.pushkit.unrestricted-voip in provisioning profile
I can only clear this error by removing the key in the entitlements file, which I think I shouldn't.
How can I resolve this?

Insert in SHARED_CONFIGS of Config/utils.bzl file:

    "DEAD_CODE_STRIPPING": "YES",

It works. Any idea about Error 2 ?

No.

As long as I can debug and work on the simulator, I don't pay attention to Error 2.

@shivanraptor
Copy link
Author

https://core.telegram.org/reproducible-builds#reproducible-builds-for-ios. Docs how to build telegram using buck.

I can compile the source code for simulator, but for real device, the code verification via VM is way too complicated, especially Step 8 and obtaining a decrypted Telegram IPA. Anyone can suggest a simpler way to do so?

@shivanraptor shivanraptor changed the title Telegram-iOS.xcworkspace missing from release-5.13 ? Compile issues of release-5.13 Jan 7, 2020
@Floris497
Copy link

Why do you want the decrypted telegram IPA. I’m not sure what your intentions are. But as i read it you only need that if you want tot verify that the code hosted on GitHub is exactly the same as the one code they used on their AppStore build.

Creating your own certificates and profiles equal to the ‘fake’ ones provided in this repository, and editing the configuration a bit should make it possible to run it on your device. I got that working by trail and error.

@shivanraptor
Copy link
Author

Please ignore my previous comment regarding obtaining a decrypted Telegram IPA.

I finished setting up the Parallels VM and now trying to run build-telegram.sh command. The full command is:

The following error occurred after the buck build line:

Starting new Buck daemon...
Parsing buck files: finished in 4.5 sec
Building: finished in 0.5 sec
  Total time: 5.4 sec
Buck encountered an internal error
java.lang.IllegalStateException: A build rule for this target has already been created: //submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#iphoneos-arm64,iphoneos-armv7,shared
	at com.google.common.base.Preconditions.checkState(Preconditions.java:501)
	at com.facebook.buck.core.rules.resolver.impl.MultiThreadedActionGraphBuilder$Task.setFutureValue(MultiThreadedActionGraphBuilder.java:376)
	at com.facebook.buck.core.rules.resolver.impl.MultiThreadedActionGraphBuilder$Task.forceComplete(MultiThreadedActionGraphBuilder.java:369)
	at com.facebook.buck.core.rules.resolver.impl.MultiThreadedActionGraphBuilder$Task.access$200(MultiThreadedActionGraphBuilder.java:292)
	at com.facebook.buck.core.rules.resolver.impl.MultiThreadedActionGraphBuilder.lambda$addToIndex$17(MultiThreadedActionGraphBuilder.java:258)
	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1877)
	at com.facebook.buck.core.rules.resolver.impl.MultiThreadedActionGraphBuilder.addToIndex(MultiThreadedActionGraphBuilder.java:254)
	at com.facebook.buck.apple.MultiarchFileInfos.requireMultiarchRule(MultiarchFileInfos.java:180)
	at com.facebook.buck.apple.AppleLibraryDescription.requireUnstrippedBuildRule(AppleLibraryDescription.java:567)
	at com.facebook.buck.apple.AppleLibraryDescription.createLibraryBuildRule(AppleLibraryDescription.java:475)
	at com.facebook.buck.apple.AppleLibraryDescription.createBuildRule(AppleLibraryDescription.java:376)
	at com.facebook.buck.apple.AppleLibraryDescription.createBuildRule(AppleLibraryDescription.java:112)
	at com.facebook.buck.core.rules.transformer.impl.DefaultTargetNodeToBuildRuleTransformer.transform(DefaultTargetNodeToBuildRuleTransformer.java:112)
	... 9 more

    When creating rule //submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7,shared.
make: *** [build] Error 10

What did I miss this time?


Also on the other hand, I noticed that it feeds the BUCK config into the command, which includes the setup of provisioning profiles and code sign identity. It's currently set to iPhone Distribution: Digital Fortress LLC (C67CF9S4VU) and match Development ph.telegra.Telegraph.NotificationService etc.

I have set the code signing settings to my Developer ID and use Automatic Signing in my host Xcode project. How do I config the BUCK config to adapt my settings?

@Floris497
Copy link

In the build-system folder, you can define everything in verify.sh. Either manually add the signing certificate to the VMs keychain or put it in an unprotected p12 file.. this isn’t ideal for security though. For the profiles it’s the same, i named them self_uuid.mobileprovision Not sure if it’s needed.

(Make sure that the app group is set up the same way as they have it, if you used com.company.tele your group has to be group.com.company.tele

Regarding the error, keep the VM as clean as possible, i see that you have a buck daemon running. I don’t have that. Don’t run build command directly on your VM it’s not needed. (and stick with the exact xcode version they list, and checkout a release like git checkout release-5.13 that is where it went wrong for me in the first place)

I removed the line that uploads the source every time and the one that packs and unpacks it. So you can rebuild with buck in “just a few” minutes when you only change a few swift files and upload them separately.

On your host you can comment out the creation of source tar in build-telegram.sh (around line 130) and the sending of the tar with scp (around 187)

In guest-build-telegram.sh you can change APP_TARGET from app to app_arm64 at line 108 to have a bit faster build for only 64bit arm. (iPhone 5s and newer)

I think that is about all I changed, good luck

@free1990
Copy link

free1990 commented Jan 9, 2020

a bit complicated

@Floris497
Copy link

Nobody said it was going to be easy, but it is possible.. maybe my way is way to complicated because i'm missing something.. but it's not all that well documented :)

@shivanraptor
Copy link
Author

I will try all these.

Any example of modifying the config? e.g. change the code signing to Automatic, and generate code signing identity and mobile provision file? Currently Xcode manages these for me.

My VM is freshly built as instructed, I just added watchman to enable daemon as I see the message watchman is missing.

I also modified the guest-build-telegram.sh to specify JAVA_HOME (not sure why it always points to Java 13 even I specify Java 8 home in .zshrc)

Also, as my VM is located at USB hard drive, I have to change the prlctl clone command as well to add VM store destination using —dst flag. Hope it helps someone who has the same settings with me.

My last problem is, every time there is an error, a new linked VM will be cloned and started. I have to manually stop and delete it. Anyway it can be removed automatically after an error occurred?

p.s. I only have chance to test build again few days later.

@Floris497
Copy link

Floris497 commented Jan 9, 2020

You can remove those VM cloning commands and even put static IP of your VM, it is only needed if you want to be 100% sure there is no leftovers from another build. but that is only important if you try to make an executable for AppStore or if you want to be 100% sure your build is clean. else, rebuilding is fairly quick (4min or so) if it makes sense.. (also remove the check that checks if there is the directory called telegram-ios)

Also, USB might be slowing you down even more..

@shivanraptor
Copy link
Author

shivanraptor commented Jan 13, 2020

I encountered this error:

Parsing buck files: finished in 7.4 sec
Creating action graph: finished in 3.9 sec
Building: finished in 36:00.3 min (100%) 1153/2915 jobs, 1153 updated
  Total time: 36:11.7 min
Command failed with exit code 134.

command: [/Applications/Xcode.app/Contents/Developer/usr/bin/actool, --platform, iphoneos, --minimum-deployment-target, 9.0, --compile, /Users/telegram/telegram-ios/buck-out/gen/Telegram#apple-asset-catalog,dwarf-and-dsym,iphoneos-arm64/Merged.bundle, --output-partial-info-plist, /Users/telegram/telegram-ios/buck-out/bin/Telegr...
<truncated>
...

    When running <actool>.
    When building rule //:Telegram#apple-asset-catalog,dwarf-and-dsym,iphoneos-arm64.
make: *** [build_arm64] Error 1
+ OUTPUT_PATH=build/artifacts
+ rm -rf build/artifacts
+ mkdir -p build/artifacts
+ cp build/Telegram_signed.ipa ./build/artifacts/Telegram.ipa
cp: build/Telegram_signed.ipa: No such file or directory
+ cp build/DSYMs.zip ./build/artifacts/Telegram.DSYMs.zip
cp: build/DSYMs.zip: No such file or directory
+ cd /Users/telegram
Connection to 10.211.55.18 closed.
zsh:1: no matches found: telegram-ios/build/artifacts/*

The build process failed immediately after building //third-party/cmake

What did I miss this time?

Also, is there any way to retry that problematic command quickly? Restarting the whole process took a lot of time.

@shivanraptor
Copy link
Author

In addition, when I run the App in Simulator, it shows the following message in Xcode console:

publicDatabase.fetch error: <CKError 0x600001575d40: "Bad Container" (5/1014); server message = "unknown container: 'iCloud.com.mycompany.myapp'"; uuid = E2CD27FC-467B-4D3D-90B7-20C9858AAAAA; container ID = "iCloud.com.mycompany.myapp">

Should I change the iCloud container to mine? Or should I keep the default value? I changed this value to the above settings in previous version, but this error first shown up in this version 5.13...

@shivanraptor
Copy link
Author

shivanraptor commented Jan 17, 2020

The previous issues I encountered haven't been solved yet. I tried to skip VM's part, and use TestFlight to test my app in device. Thus I need to upload the App to App Store for TestFlight build.

When I upload the App to App Store via Xcode / Transporter, the following errors occurred:

ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftMetal.dylib, libswiftCoreAudio.dylib, libswiftsimd.dylib, libswiftCallKit.dylib, libswiftIntents.dylib, libswiftQuartzCore.dylib, libswiftos.dylib, libswiftObjectiveC.dylib, libswiftDispatch.dylib, libswiftCoreLocation.dylib, libswiftCoreGraphics.dylib, libswiftCoreFoundation.dylib, libswiftUIKit.dylib, libswiftCoreMedia.dylib, libswiftAVFoundation.dylib, libswiftContacts.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftCloudKit.dylib, libswiftCoreImage.dylib aren’t at the expected location /Payload/MyApp.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.

In the .xcarchive file's package contents, I found all the above files located in the Frameworks folder.

How can I resolve this?

@Floris497
Copy link

Why not just install using xcode? For TestFlight they need to review the application.. I’m not sure what you’re changing, but is that worth all the effort?
I think I remember that the buck build replaces those frameworks and re-codesigns them (not exactly sure why)
And you can also host the app somewhere online with a manifest instead of TestFlight if you want to download it from somewhere..

@shivanraptor
Copy link
Author

Why not just install using xcode? For TestFlight they need to review the application.. I’m not sure what you’re changing, but is that worth all the effort?
I think I remember that the buck build replaces those frameworks and re-codesigns them (not exactly sure why)
And you can also host the app somewhere online with a manifest instead of TestFlight if you want to download it from somewhere..

It is because I cannot fix the issues during the VM build, thus I cannot directly install and debug the app directly via Xcode. Can you please help me with the issues above? Thanks! (I tried release-5.13.1 as well, it is still stuck at actool command with exit code 134)

@shivanraptor
Copy link
Author

shivanraptor commented Jan 22, 2020

Now I encounter the following errors:

ERROR ITMS-90206: "Invalid Bundle. The bundle at 'Telegram.app/Plugins/IntentsExtension.appex' contains disallowed file 'Frameworks'."

ERROR ITMS-90206: "Invalid Bundle. The bundle at 'Telegram.app/Plugins/NotificationContentExtension.appex' contains disallowed file 'Frameworks'."

ERROR ITMS-90206: "Invalid Bundle. The bundle at 'Telegram.app/Plugins/NotificationServiceExtension.appex' contains disallowed file 'Frameworks'."

@TimorYang
Copy link

Thank you @NgCongMinh-Dev
Now, its better. but again at the end failed.
p.s. Since I noticed strange statement on comment #219 I would like to clarify that Im running it on my mac, not virtual machine, I guess its not a problem? Since I want to be able to run it locally.
Parsing buck files: finished in 2.6 sec
Generating project: finished in 06:59.0 min (100%)
Building: finished in 06:56.3 min (100%) 114/216 jobs, 112 updated
Total time: 06:59.0 min
Command failed with exit code 2.
command: [/bin/bash, -e, /Users/swift2geek/Projects/Telegram-iOS/buck-out/tmp/genrule-4804425508128626483.sh]
stderr: make[1]: *** No rule to make target `clean'. Stop.
/bin/sh: /Library/Developer/CommandLineTools/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc: No such file or directory
make[2]: *** [apps/app_rand.o] Error 127
make[1]: *** [all] Error 2

When running <genrule>.
When building rule //submodules/openssl:openssl_build_arm64.

make: *** [project] Error 1

Thank you @NgCongMinh-Dev
Now, its better. but again at the end failed.
p.s. Since I noticed strange statement on comment #219 I would like to clarify that Im running it on my mac, not virtual machine, I guess its not a problem? Since I want to be able to run it locally.
Parsing buck files: finished in 2.6 sec
Generating project: finished in 06:59.0 min (100%)
Building: finished in 06:56.3 min (100%) 114/216 jobs, 112 updated
Total time: 06:59.0 min
Command failed with exit code 2.
command: [/bin/bash, -e, /Users/swift2geek/Projects/Telegram-iOS/buck-out/tmp/genrule-4804425508128626483.sh]
stderr: make[1]: *** No rule to make target `clean'. Stop.
/bin/sh: /Library/Developer/CommandLineTools/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc: No such file or directory
make[2]: *** [apps/app_rand.o] Error 127
make[1]: *** [all] Error 2

When running <genrule>.
When building rule //submodules/openssl:openssl_build_arm64.

make: *** [project] Error 1

How to solve it?

You should confirm that the path of your Command Line Tool is correct.
How to confirm whether the path is correct:
Use xcode-select -p command
Get the current Command Line Tool Path, and then check whether Toolchains/XcodeDefault.xctoolchain is included in the path. If the path is included, it is correct, and then make project will work normally

@Gargo
Copy link

Gargo commented Oct 30, 2020

@TimorYang
1)The question persists - why doesn't anybody just post a workspace file - separately if you don't want to include it in this repo?
2)suddenly I was able to setup buck properly but now I get a lot of errors with command line tools - they are installed but inside "xcode.app"

@TimorYang
Copy link

@Gargo
This will be useful for you
#219 (comment)

@Gargo
Copy link

Gargo commented Nov 2, 2020

@TimorYang
tried, it doesn't help

@TimorYang
Copy link

@Gargo
Does the terminal output any information ?

@ali-fareed
Copy link

Please see the updated build instructions in README.md.

@k-o-d-e-n
Copy link

Please see the updated build instructions in README.md.

It gets stuck in [Syslog] Create project: Telegram. What would you suggest?

@Floris497
Copy link

Do you have a little more information? is there no error message anywhere else in the terminal?

@k-o-d-e-n
Copy link

Absolutely nothing. Just no progress.
Made all compilation guide by excluding 5.

@ali-fareed
Copy link

Could you please provide the terminal output?

@ali-fareed ali-fareed reopened this Jan 16, 2021
@k-o-d-e-n
Copy link

% python3 build-system/Make/Make.py \
    --bazel="$HOME/bazel-dist/bazel" \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath="$HOME/telegram-configuration" \
    --disableExtensions
No matching processes belonging to you were found
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:tulsi (46 packages loaded, 570 targets configured).
INFO: Found 1 target...
INFO: From Action external/build_bazel_rules_apple/apple/internal/environment_plist_macos.plist:
2021-01-16 15:59:14.082 xcodebuild[68254:188254] [MT] PluginLoading: Required plug-in compatibility UUID 3928AC50-EA32-404F-9CAF-49710A35483C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2021-01-16 15:59:14.083 xcodebuild[68254:188254] [MT] PluginLoading: Required plug-in compatibility UUID 3928AC50-EA32-404F-9CAF-49710A35483C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SYConfigurableVariable.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2021-01-16 15:59:14.083 xcodebuild[68254:188254] [MT] PluginLoading: Required plug-in compatibility UUID 3928AC50-EA32-404F-9CAF-49710A35483C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
INFO: From XibCompile tulsi-intermediates/nibs/Base.lproj/BazelOpenSheetAccessoryView:
/* com.apple.ibtool.document.notices */
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/BazelOpenSheetAccessoryView.xib:atU-NU-IiP: note: View is clipping its content [13]
INFO: From XibCompile tulsi-intermediates/nibs/Base.lproj/SplashScreenWindowController:
/* com.apple.ibtool.document.notices */
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/SplashScreenWindowController.xib:ujV-sA-1qZ: note: View is clipping its content [13]
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/SplashScreenWindowController.xib:9Gh-jw-2TU: note: View is clipping its content [13]
INFO: From StoryboardCompile tulsi-intermediates/Base.lproj_storyboardc/Main.storyboardc:
/* com.apple.ibtool.document.notices */
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/Main.storyboard:Igh-yT-sbk: note: View is clipping its content [13]
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/Main.storyboard:P9B-5h-yw2: note: View is clipping its content [13]
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/Main.storyboard:gu0-Vl-OiO: note: View is clipping its content [13]
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/Main.storyboard:qef-HC-mDi: note: View is clipping its content [13]
/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/tulsi/src/Tulsi/Base.lproj/Main.storyboard:TGM-OR-kqV: note: View is clipping its content [13]
INFO: From Compiling Swift module TulsiGenerator:
src/TulsiGenerator/BazelSettingsProvider.swift:59:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BazelSettingFeature' to 'Hashable' by implementing 'hash(into:)' instead
  public var hashValue: Int {
             ^
src/TulsiGenerator/BuildLabel.swift:69:19: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BuildLabel' to 'Hashable' by implementing 'hash(into:)' instead
  public lazy var hashValue: Int = { [unowned self] in
                  ^
src/TulsiGenerator/PBXObjects.swift:54:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'SourceTreePath' to 'Hashable' by implementing 'hash(into:)' instead
  var hashValue: Int {
      ^
src/TulsiGenerator/PBXObjects.swift:125:12: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXFileReference' to 'Hashable' by implementing 'hash(into:)' instead
  lazy var hashValue: Int = { [unowned self] in
           ^
src/TulsiGenerator/PBXObjects.swift:125:12: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXGroup' to 'Hashable' by implementing 'hash(into:)' instead
  lazy var hashValue: Int = { [unowned self] in
           ^
src/TulsiGenerator/PBXObjects.swift:903:12: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXTarget' to 'Hashable' by implementing 'hash(into:)' instead
  lazy var hashValue: Int = { [unowned self] in
           ^
src/TulsiGenerator/PBXObjects.swift:1049:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXContainerItemProxy' to 'Hashable' by implementing 'hash(into:)' instead
  var hashValue: Int {
      ^
src/TulsiGenerator/RuleEntry.swift:76:19: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BazelFileInfo' to 'Hashable' by implementing 'hash(into:)' instead
  public lazy var hashValue: Int = { [unowned self] in
                  ^
src/TulsiGenerator/PBXTargetGenerator.swift:526:11: warning: variable 'frameworkSearchPaths' was never mutated; consider changing to 'let' constant
      var frameworkSearchPaths = NSMutableOrderedSet()
      ~~~ ^
      let
src/TulsiGenerator/RuleEntry.swift:26:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'RuleInfo' to 'Hashable' by implementing 'hash(into:)' instead
  public var hashValue: Int {
             ^
src/TulsiGenerator/RuleEntry.swift:76:19: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BazelFileInfo' to 'Hashable' by implementing 'hash(into:)' instead
  public lazy var hashValue: Int = { [unowned self] in
                  ^
src/TulsiGenerator/TulsiOption.swift:54:16: warning: static property 'Generic' produces an empty option set
    static let Generic = OptionType(rawValue: 0)
               ^
src/TulsiGenerator/TulsiOption.swift:54:16: note: use [] to silence this warning
    static let Generic = OptionType(rawValue: 0)
               ^                   ~~~~~~~~~~~~~
                                   ([])
src/TulsiGenerator/BuildLabel.swift:69:19: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BuildLabel' to 'Hashable' by implementing 'hash(into:)' instead
  public lazy var hashValue: Int = { [unowned self] in
                  ^
src/TulsiGenerator/PBXObjects.swift:903:12: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXTarget' to 'Hashable' by implementing 'hash(into:)' instead
  lazy var hashValue: Int = { [unowned self] in
           ^
src/TulsiGenerator/PBXObjects.swift:125:12: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'PBXGroup' to 'Hashable' by implementing 'hash(into:)' instead
  lazy var hashValue: Int = { [unowned self] in
           ^

INFO: From Compiling Swift module Tulsi:
src/Tulsi/ConfigEditorWizardViewController.swift:144:79: warning: 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
    let newPageIndex = ConfigEditorWizardViewController.wizardPageIdentifiers.index(of: object as! String)!
                                                                              ^
src/Tulsi/ConfigEditorWizardViewController.swift:144:79: note: use 'firstIndex(of:)' instead
    let newPageIndex = ConfigEditorWizardViewController.wizardPageIdentifiers.index(of: object as! String)!
                                                                              ^~~~~
                                                                              firstIndex
src/Tulsi/MessageViewController.swift:55:55: warning: coercion of implicitly unwrappable value of type 'NSArrayController?' to 'Any' does not unwrap optional
    bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController, withKeyPath: "arrangedObjects.@count", options: nil)
                                                      ^~~~~~~~~~~~~~~~~~~~~~
src/Tulsi/MessageViewController.swift:35:17: note: implicitly unwrapped property 'messageArrayController' declared here
  @IBOutlet var messageArrayController: NSArrayController!
                ^
src/Tulsi/MessageViewController.swift:55:55: note: provide a default value to avoid this warning
    bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController, withKeyPath: "arrangedObjects.@count", options: nil)
                                                      ^~~~~~~~~~~~~~~~~~~~~~
                                                                             ?? <#default value#>
src/Tulsi/MessageViewController.swift:55:55: note: force-unwrap the value to avoid this warning
    bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController, withKeyPath: "arrangedObjects.@count", options: nil)
                                                      ^~~~~~~~~~~~~~~~~~~~~~
                                                                            !
src/Tulsi/MessageViewController.swift:55:55: note: explicitly cast to 'Any' with 'as Any' to silence this warning
    bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController, withKeyPath: "arrangedObjects.@count", options: nil)
                                                      ^~~~~~~~~~~~~~~~~~~~~~
                                                                             as Any
src/Tulsi/ProjectEditorConfigManagerViewController.swift:88:14: warning: coercion of implicitly unwrappable value of type 'NSArrayController?' to 'Any' does not unwrap optional
         to: configArrayController,
             ^~~~~~~~~~~~~~~~~~~~~
src/Tulsi/ProjectEditorConfigManagerViewController.swift:33:17: note: implicitly unwrapped property 'configArrayController' declared here
  @IBOutlet var configArrayController: NSArrayController!
                ^
src/Tulsi/ProjectEditorConfigManagerViewController.swift:88:14: note: provide a default value to avoid this warning
         to: configArrayController,
             ^~~~~~~~~~~~~~~~~~~~~
                                   ?? <#default value#>
src/Tulsi/ProjectEditorConfigManagerViewController.swift:88:14: note: force-unwrap the value to avoid this warning
         to: configArrayController,
             ^~~~~~~~~~~~~~~~~~~~~
                                  !
src/Tulsi/ProjectEditorConfigManagerViewController.swift:88:14: note: explicitly cast to 'Any' with 'as Any' to silence this warning
         to: configArrayController,
             ^~~~~~~~~~~~~~~~~~~~~
                                   as Any
src/Tulsi/ProjectEditorPackageManagerViewController.swift:51:14: warning: coercion of implicitly unwrappable value of type 'NSArrayController?' to 'Any' does not unwrap optional
         to: packageArrayController,
             ^~~~~~~~~~~~~~~~~~~~~~
src/Tulsi/ProjectEditorPackageManagerViewController.swift:28:17: note: implicitly unwrapped property 'packageArrayController' declared here
  @IBOutlet var packageArrayController: NSArrayController!
                ^
src/Tulsi/ProjectEditorPackageManagerViewController.swift:51:14: note: provide a default value to avoid this warning
         to: packageArrayController,
             ^~~~~~~~~~~~~~~~~~~~~~
                                    ?? <#default value#>
src/Tulsi/ProjectEditorPackageManagerViewController.swift:51:14: note: force-unwrap the value to avoid this warning
         to: packageArrayController,
             ^~~~~~~~~~~~~~~~~~~~~~
                                   !
src/Tulsi/ProjectEditorPackageManagerViewController.swift:51:14: note: explicitly cast to 'Any' with 'as Any' to silence this warning
         to: packageArrayController,
             ^~~~~~~~~~~~~~~~~~~~~~
                                    as Any
src/Tulsi/SplashScreenWindowController.swift:107:11: warning: variable 'components' was never mutated; consider changing to 'let' constant
      var components: [String] = url.pathComponents
      ~~~ ^
      let
src/Tulsi/TulsiProjectDocument.swift:169:47: warning: coercion of implicitly unwrappable value of type 'NSObjectProtocol?' to 'Any' does not unwrap optional
    NotificationCenter.default.removeObserver(logEventObserver)
                                              ^~~~~~~~~~~~~~~~
src/Tulsi/TulsiProjectDocument.swift:135:15: note: implicitly unwrapped property 'logEventObserver' declared here
  private var logEventObserver: NSObjectProtocol! = nil
              ^
src/Tulsi/TulsiProjectDocument.swift:169:47: note: provide a default value to avoid this warning
    NotificationCenter.default.removeObserver(logEventObserver)
                                              ^~~~~~~~~~~~~~~~
                                                               ?? <#default value#>
src/Tulsi/TulsiProjectDocument.swift:169:47: note: force-unwrap the value to avoid this warning
    NotificationCenter.default.removeObserver(logEventObserver)
                                              ^~~~~~~~~~~~~~~~
                                                              !
src/Tulsi/TulsiProjectDocument.swift:169:47: note: explicitly cast to 'Any' with 'as Any' to silence this warning
    NotificationCenter.default.removeObserver(logEventObserver)
                                              ^~~~~~~~~~~~~~~~
                                                               as Any
Target //:tulsi up-to-date:
  bazel-bin/tulsi.zip
INFO: Elapsed time: 170.011s, Critical Path: 79.30s
INFO: 81 processes: 40 internal, 27 darwin-sandbox, 14 local.
INFO: Build completed successfully, 81 total actions
[Syslog] Tulsi CLI: version 0.20200930.88
[Syslog] Create project: Telegram

@ali-fareed
Copy link

Have you tried restarting the Mac?

@Floris497
Copy link

I don't see what is wrong.. it says "Build completed successfully, 81 total actions"

@k-o-d-e-n
Copy link

The result is the same. I have tried clean/build, and now I have got an error with provisioning profile. Sorry, I forgot to say that I only copy telegram-configuration folder without changes.
Can I generate Xcode project without provisioning profiles?

INFO: Analyzed target //Telegram:Telegram (301 packages loaded, 21057 targets configured).
INFO: Found 1 target...
ERROR: /Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/Telegram/BUILD:1142:14: Processing and signing WidgetExtension failed (Exit 1): process-and-sign-2145137351.sh failed: error executing command 
  (cd /private/var/tmp/_bazel_K-o-D-e-N/97685e701755c92927b9337916842e91/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneOS \
    APPLE_SDK_VERSION_OVERRIDE=14.3 \
    XCODE_VERSION_OVERRIDE=12.3.0.12C33 \
  bazel-out/applebin_ios-ios_armv7-opt-ST-ba0655cc809b/bin/Telegram/WidgetExtension-intermediates/process-and-sign-2145137351.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/Widget.mobileprovision
----------------
Note: The failure of target @build_bazel_rules_apple//tools/codesigningtool:codesigningtool (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
Target //Telegram:Telegram failed to build
INFO: Elapsed time: 84.959s, Critical Path: 9.53s
INFO: 39 processes: 5 remote cache hit, 15 internal, 19 local.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
  File "build-system/Make/Make.py", line 472, in <module>
    build(arguments=args)
  File "build-system/Make/Make.py", line 321, in build
    bazel_command_line.invoke_build()
  File "build-system/Make/Make.py", line 224, in invoke_build
    call_executable(combined_arguments)
  File "/Users/K-o-D-e-N/Documents/Projects/iOS/Research&Learning/Telegram-iOS/build-system/Make/BuildEnvironment.py", line 60, in call_executable
    subprocess.check_call(resolved_arguments, env=resolved_env)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/K-o-D-e-N/bazel-dist/bazel', 'build', 'Telegram/Telegram', '--override_repository=build_configuration=/Users/K-o-D-e-N/telegram-configuration', '--announce_rc', '--features=swift.use_global_module_cache', '--verbose_failures', '--features=swift.split_derived_files_generation', '--features=swift.skip_function_bodies_for_derived_files', '--jobs=4', '--define=buildNumber=100006', '--define=telegramVersion=7.3.1', '--disk_cache=/Users/K-o-D-e-N/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.

@ali-fareed
Copy link

It looks like in your previous comment the Bazel process was stuck (happens sometimes, it is listed as "java" in Activity Monitor).

You can use the example provisioning profiles to build the app, but you would have to install the corresponding certificate found at build-system/fake-codesigning/certs/distribution and make it trusted. Remember that it is not recommended to install third-party certificates into your OS.

@misteu
Copy link

misteu commented Jan 16, 2021

I did everything described in the updated Readme but for me it fails after some time with this:

ERROR: /Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/Telegram/BUILD:1142:14: Processing and signing WidgetExtension failed (Exit 1): process-and-sign-2145137351.sh failed: error executing command 
  (cd /private/var/tmp/_bazel_user/1977cd7950158028aa733c14b5ceff7c/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneOS \
    APPLE_SDK_VERSION_OVERRIDE=14.3 \
    XCODE_VERSION_OVERRIDE=12.3.0.12C33 \
  bazel-out/applebin_ios-ios_armv7-opt-ST-ba0655cc809b/bin/Telegram/WidgetExtension-intermediates/process-and-sign-2145137351.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/Widget.mobileprovision
----------------
Note: The failure of target @build_bazel_rules_apple//tools/codesigningtool:codesigningtool (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
Target //Telegram:Telegram failed to build
INFO: Elapsed time: 438.401s, Critical Path: 267.23s
INFO: 8974 processes: 7533 remote cache hit, 1239 internal, 202 local.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
  File "build-system/Make/Make.py", line 472, in <module>
    build(arguments=args)
  File "build-system/Make/Make.py", line 321, in build
    bazel_command_line.invoke_build()
  File "build-system/Make/Make.py", line 224, in invoke_build
    call_executable(combined_arguments)
  File "/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/Make/BuildEnvironment.py", line 60, in call_executable
    subprocess.check_call(resolved_arguments, env=resolved_env)
  File "/Volumes/ssd/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/user/bazel-dist/bazel', 'build', 'Telegram/Telegram', '--override_repository=build_configuration=/Users/user/telegram-configuration', '--announce_rc', '--features=swift.use_global_module_cache', '--verbose_failures', '--features=swift.split_derived_files_generation', '--features=swift.skip_function_bodies_for_derived_files', '--jobs=4', '--define=buildNumber=100001', '--define=telegramVersion=7.3.1', '--disk_cache=/Users/user/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.

tried to clean and run again, did not help :(

@ali-fareed
Copy link

The relevant line is:

ERROR: Unable to find an identity on the system matching the ones in external/build_configuration/provisioning/Widget.mobileprovision

You need to install the certificates that match the provisioning profiles you have in build_configuration/provisioning (the path you passed under --configurationPath).

@misteu
Copy link

misteu commented Jan 16, 2021

OK, I did not manage to use the fake signing stuff that is delivered, so I created all the identifiers and profiles error by error in my developer account, downloaded them and added them to ~/telegram-configuration/provisioning that was created before.

Now, finally it built 🎉

However, I cannot use the other command to generate the project. There is some "tulsi" error:

INFO: Analyzed target //:tulsi (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/tulsi/BUILD:61:18: Bundling tulsi failed (Exit 1): bundletool failed: error executing command 
  (cd /private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__ && \
  exec env - \
  bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool bazel-out/applebin_macos-darwin_x86_64-fastbuild-ST-3ee0a3fbeeba/bin/tulsi-intermediates/bundletool_control.json)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox bundletool failed: error executing command 
  (cd /private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__ && \
  exec env - \
  bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool bazel-out/applebin_macos-darwin_x86_64-fastbuild-ST-3ee0a3fbeeba/bin/tulsi-intermediates/bundletool_control.json)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__/bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool.runfiles/build_bazel_rules_apple/tools/bundletool/bundletool.py", line 237, in <module>
    _main(sys.argv[1])
  File "/private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__/bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool.runfiles/build_bazel_rules_apple/tools/bundletool/bundletool.py", line 225, in _main
    bundler.run()
  File "/private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__/bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool.runfiles/build_bazel_rules_apple/tools/bundletool/bundletool.py", line 117, in run
    f.get('contents_only', False), out_zip)
  File "/private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__/bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool.runfiles/build_bazel_rules_apple/tools/bundletool/bundletool.py", line 154, in _add_files
    self._write_entry(dest, f.read(), fexec, out_zip)
  File "/private/var/tmp/_bazel_user/716fd089274e0fdc5ba755dd7884f064/sandbox/darwin-sandbox/12/execroot/__main__/bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool.runfiles/build_bazel_rules_apple/tools/bundletool/bundletool.py", line 193, in _write_entry
    new_hash = hashlib.md5(data).digest()
AttributeError: 'module' object has no attribute 'md5'
----------------
Note: The failure of target @build_bazel_rules_apple//tools/bundletool:bundletool (with exit code 1) may have been caused by the fact that it is running under Python 2 instead of Python 3. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY3, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
Target //:tulsi failed to build
INFO: Elapsed time: 0.494s, Critical Path: 0.29s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
  File "build-system/Make/Make.py", line 470, in <module>
    generate_project(arguments=args)
  File "build-system/Make/Make.py", line 295, in generate_project
    generate(
  File "/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/Make/ProjectGeneration.py", line 41, in generate
    call_executable([
  File "/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/Make/BuildEnvironment.py", line 60, in call_executable
    subprocess.check_call(resolved_arguments, env=resolved_env)
  File "/Volumes/ssd/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/user/bazel-dist/bazel', 'build', '//:tulsi', '--xcode_version=12.3', '--use_top_level_targets_for_symlinks', '--verbose_failures']' returned non-zero exit status 1.

@ali-fareed
Copy link

It looks like you have python2 installed via Homebrew. Here is the answer I found that may be relevant:

https://stackoverflow.com/a/59816812

Both project generation and building were tested on a clean, unmodified Big Sur system installed in a VM.

@misteu
Copy link

misteu commented Jan 17, 2021

Thank you! I found this SO thread yesterday as well but could not make it work.

Today I got a little bit closer (I think), the problem seemed to be some broken python/openssl linkings on my machine, so your link to the SO thread brought me on the right path :)

I reinstalled openssl (via brew) and ran brew doctor, it showed some broken links for python and a suggestion how to fix it (which I did).

Now it runs longer but I have some other error regarding the build configuration: ERROR: error loading package 'Telegram': Unable to find package for @build_configuration//:variables.bzl: The repository '@build_configuration' could not be resolved.

I dont't understand what is missing there :( The build command relies on the same file and it runs fine for me now (after fixing all the provisioning issues), however generateProject does not :/

No matching processes belonging to you were found
INFO: Analyzed target //:tulsi (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:tulsi up-to-date:
  bazel-bin/tulsi.zip
INFO: Elapsed time: 0.197s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
[Syslog] Tulsi CLI: version 0.20200930.88
[Syslog] Create project: Telegram
[Syslog] Fetching bazel path info
[Info] Running /Users/user/bazel-dist/bazel info '--override_repository=tulsi=/Users/user/Library/Application Support/Tulsi/0.20200930.88/Bazel'
[Syslog] ** Completed bazel_get_package_path in 0.8534s
[Syslog] ** Completed get_package_path in 0.8551s
[Syslog] Fetching rules for packages ["Telegram"]
[Info] Running /Users/user/bazel-dist/bazel --max_idle_secs=60 query '--override_repository=tulsi=/Users/user/Library/Application Support/Tulsi/0.20200930.88/Bazel' --announce_rc --noimplicit_deps --order_output=no --noshow_loading_progress --noshow_progress 'kind(rule, Telegram:all)' --output xml
[Syslog] ** Completed bazel_query_fetch_rules in 0.9465s
[Info] Bazel command info:
/Users/user/bazel-dist/bazel --max_idle_secs=60 query '--override_repository=tulsi=/Users/user/Library/Application Support/Tulsi/0.20200930.88/Bazel' --announce_rc --noimplicit_deps --order_output=no --noshow_loading_progress --noshow_progress 'kind(rule, Telegram:all)' --output xml
Exited with code 7

INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
ERROR: error loading package 'Telegram': Unable to find package for @build_configuration//:variables.bzl: The repository '@build_configuration' could not be resolved.

[Error] Failed to retrieve information about the Bazel workspace. This usually means that the contents of a BUILD file are incorrect or flags are missing. Read the message log carefully for details. ERROR: error loading package 'Telegram': Unable to find package for @build_configuration//:variables.bzl: The repository '@build_configuration' could not be resolved.
[Syslog] ** Completed fetch_rules in 0.9489s
Failed to identify any valid build targets.
Traceback (most recent call last):
  File "build-system/Make/Make.py", line 470, in <module>
    generate_project(arguments=args)
  File "build-system/Make/Make.py", line 295, in generate_project
    generate(
  File "/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/Make/ProjectGeneration.py", line 94, in generate
    call_executable([
  File "/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-system/Make/BuildEnvironment.py", line 60, in call_executable
    subprocess.check_call(resolved_arguments, env=resolved_env)
  File "/Volumes/ssd/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-input/gen/project/Tulsi.app/Contents/MacOS/Tulsi', '--', '--verbose', '--create-tulsiproj', 'Telegram', '--workspaceroot', './', '--bazel', '/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-input/gen/project/bazel', '--outputfolder', '/Volumes/ssd/iOS/iOSDev/telegram/Telegram-iOS/build-input/gen/project', '--target', 'Telegram:Telegram', '--build-options', '--override_repository=build_configuration=/Users/user/telegram-configuration --//Telegram:disableExtensions']' returned non-zero exit status 24.

@ali-fareed
Copy link

@misteu it is now possible to skip generating and downloading provisioning profiles if you are not planning to deploy the app to a real device, see #453 (comment)

Try restarting your computer. A hack is currently required to pass the build_configuration folder to Tulsi. It involves generating a Bazel wrapper script that passes additional arguments to the real Bazel. The line after [Syslog] Fetching bazel path info should say [Info] Running /Users/user/telegram-ios/build-input/gen/project/bazel, not /Users/user/bazel-dist/bazel.

@misteu
Copy link

misteu commented Jan 17, 2021

Thank you so much! Now the project was generated successfully, restarting did the trick -.-

Please include something like "try restarting before generating the project" in the Readme as well.

This would have helped me a lot if I knew earlier yesterday. Currently I try to run the app from XCode, I am estimating to have to wait for another 30 minutes or so :/

@ali-fareed
Copy link

I think the better way would be to patch Tulsi.

@misteu
Copy link

misteu commented Jan 17, 2021

Ok, it runs now sucessfully in the simulator! Thank you for your help.

@ali-fareed
Copy link

Please open a new issue in case of problems with compilation.

@MacleChen
Copy link

Yes, after many days of trying to build project, I realized what it is fake open source project

no. Telegram is actually an open source project. The Workspace file is included in previous releases. Let's not lose faith.

But many people can't run it

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