tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

arm64 support #2278

Closed georgeprokopenko closed 1 year ago

georgeprokopenko commented 1 year ago

Hey! Having this issue while trying to build on Apple Watch Ultra

Screenshot 2023-01-23 at 01 10 47

Can it be fixed somehow? Thanks

levlam commented 1 year ago

Could you try to build the Framework applying this patch and check whether it builds successfully?

georgeprokopenko commented 1 year ago

Previously I tried to use TDLibFramework & TDLibKit, but now trying to build a raw td with a patch you advised and ./build.sh gives the following

Screenshot 2023-01-24 at 11 47 25 Screenshot 2023-01-24 at 11 47 37
levlam commented 1 year ago

Sorry, I provided a wrong patch. Here should be the correct one: patch.txt.

You can check that it is correct by running lipo -info third_party/openssl/watchOS/lib/libcrypto.a and checking that arm64 architecture is present among others.

georgeprokopenko commented 1 year ago

Thank you, now getting this error while trying to build ci https://github.com/georgeprokopenko/TDLibFramework/actions/runs/4039106882

Do you know how to resolve this?

Screenshot 2023-01-30 at 01 31 01
levlam commented 1 year ago

You have Xcode 13.3 or 13.4 in the CI. It is very likely that you need Xcode 14 to use arm64 architecture for watchOS.

levlam commented 1 year ago

You need to change value of environment variable DEVELOPER_DIR from "/Applications/Xcode_13.4.1.app/Contents/Developer" to "/Applications/Xcode_14.2.app/Contents/Developer".

georgeprokopenko commented 1 year ago

Thank you, have thought about it already, will try

Kylmakalle commented 1 year ago

@levlam I can confirm the provided patch enables arm64 arch for watchOS successfully. CI run

file lib/libtdjson.dylib   
lib/libtdjson.dylib: Mach-O universal binary with 3 architectures: [arm_v7k:Mach-O dynamically linked shared library arm_v7k] [arm64_32_v8] [arm64]
lib/libtdjson.dylib (for architecture armv7k):  Mach-O dynamically linked shared library arm_v7k
lib/libtdjson.dylib (for architecture arm64_32):    Mach-O dynamically linked shared library arm64_32_v8
lib/libtdjson.dylib (for architecture arm64):   Mach-O 64-bit dynamically linked shared library arm64

However, I don't have real devices to test.

Keep in mind, that this patch will require latest WatchOS SDK which was mentioned above

Xcode 14.2.1

levlam commented 1 year ago

@Kylmakalle Thank you for the confirmation. Xcode 14 was released 5 month ago, and it should be already widely available, so I will merge the patch unconditionally and add a notice that Xcode >= 14 is required for watchOS building.

levlam commented 1 year ago

ARM64 support for watchOS was added in TDLib 1.8.12.