If you trying to build your project with tdlib on MacOS M1 (Apple Silicon chip), you probably are gonna 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: https://github.com/lawlight33/tdlight-java-natives-aarch64/blob/master/compiled/tdlight-natives-osx-aarch64.zip
Step 1. Compile tdlight-java-natives
If you want to build it from scratch, then clone the repo: https://github.com/lawlight33/tdlight-java-natives-aarch64, and follow README.md:
- Install JDK 1.8, and make it default (
java -version
should print 1.8). - Run
scripts/utils./compile-natives-package.sh
. - After successful compilation
tdlight-natives-osx-aarch64:4.0.0-SNAPSHOT
will 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 https://github.com/lawlight33/tdlight-java-aarch64, and follow README.md:
- Install JDK 11+ by default (JAVA_HOME & PATH environment variables)
cd tdlight
mvn install
tdlight-java:1.0.0.0-SNAPSHOT
placed to mavenLocal (~/.m2/repository/it/tdlight/tdlight-java/1.0.0.0-SNAPSHOT
)
Step 3. Use dependencies we just built
<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>
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")
}
That’s all. Many thanks to:
Telegram channel
If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.
If I saved your day, you can support me 🤝