Build TDLight natives for ARM64
What's inside this article
⌄
- TDLight native build aarch64
- Compile TDLight arm64 natives
- TDLight aarch64 compilation
- Build TDLight arm architecture
If you’re trying to build your project with tdlib on macOS M1 (Apple Silicon chip), you probably are going to face this error:
Caused by: it.tdlight.common.utils.CantLoadLibrary: Native libraries for platform OSX-AARCH64 not found! Required version: tdlight osx aarch64 4.0.267
You need to compile these natives for aarch64 architecture. The final artifact will be named as: tdlight-natives-osx-aarch64.
NOTE: If you want to take compiled artifact, just download it from my repo, then put into mavenLocal and use, here is a link.
Step 1. Compile tdlight-java-natives
If you want to build it from scratch, then clone the repo, and follow README.md:
- Install JDK 1.8, and make it default (
java --versionshould print1.8). - Run
scripts/utils./compile-natives-package.sh. - After successful compilation
tdlight-natives-osx-aarch64:4.0.0-SNAPSHOTwill be place to you mavenLocal repository (~/.m2/repository/it/tdlight/tdlight-natives-osx-aarch64/4.0.0-SNAPSHOT).
Step 2. Compile tdlight-java
Clone the repo, and follow README.md:
- Install JDK 11+ by default (
JAVA_HOME&PATHenvironment variables) cd tdlightmvn installtdlight-java:1.0.0.0-SNAPSHOTplaced to mavenLocal (~/.m2/repository/it/tdlight/tdlight-java/1.0.0.0-SNAPSHOT)
Step 3. Use dependencies we just built
For Maven:
<dependencies>
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-java-bom</artifactId>
<version>1.0.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-java</artifactId>
<version>1.0.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-osx-aarch64</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
For Gradle:
repositories {
mavenLocal()
}
dependencies {
implementation(platform("it.tdlight:tdlight-java-bom:1.0.0.0-SNAPSHOT"))
implementation("it.tdlight:tdlight-java:1.0.0.0-SNAPSHOT")
implementation("it.tdlight:tdlight-natives-osx-aarch64:4.0.0-SNAPSHOT")
}