tdlight-java
tdlight-java copied to clipboard
Missing support for Apple M1
Currently Apple has stopped supporting Intel processors in their hardware, so the only viable architecture in the future will be ARM-based M1s, I think it would be convenient to include a tdlight-natives-osx-aarch64
type artifact to support them in the future.
If you try to run start the library on a JVM with ARM architecture, you will always get the following error:
Caused by: it.tdlight.common.utils.CantLoadLibrary: Native libraries for platform OSX-AARCH64 not found! Required version: tdlight osx aarch64 4.0.257
Unfortunately Apple M1 is still unsupported on github actions. You'll need to wait until this issue is closed: https://github.com/actions/virtual-environments/issues/2187
This is not a forum. I already explained why I can't add support to M1. Please comment only if you need to say something useful about the issue
@ghost It would be great to have macos aarch64 out-of-the-box indeed, but meanwhile you can compile it yourself. Here is what worked for me:
- complile native libraries with special settings: https://github.com/dimitree54/tdlight-java-natives
- compile tdlight-java slightly modified to support those natives: https://github.com/dimitree54/tdlight-java
- use tdlight-java from mavelLocal
@dimitree54 Hello, do you have the package with the compile number? Can you send me a copy?
Hi @dimitree54 ,
@ghost It would be great to have macos aarch64 out-of-the-box indeed, but meanwhile you can compile it yourself. Here is what worked for me:
- complile native libraries with special settings: https://github.com/dimitree54/tdlight-java-natives
- compile tdlight-java slightly modified to support those natives: https://github.com/dimitree54/tdlight-java
- use tdlight-java from mavelLocal
I compiled both tdlight-java-natives and tdlight-java and imported as suggested in my build.gradle.
But when I use Init.start();
in code, it throws following exception, any ideas why?
please help, thx in advance :)
my jdk version:
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode)
FATAL ERROR in native method: Can't find field [reaction] with signature [Ljava/lang/String;]
at jdk.internal.loader.NativeLibraries.load(java.base@17/Native Method)
at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(java.base@17/NativeLibraries.java:384)
at jdk.internal.loader.NativeLibraries.loadLibrary(java.base@17/NativeLibraries.java:228)
- locked <0x00000006003c3508> (a java.util.HashSet)
at jdk.internal.loader.NativeLibraries.loadLibrary(java.base@17/NativeLibraries.java:170)
at java.lang.ClassLoader.loadLibrary(java.base@17/ClassLoader.java:2389)
at java.lang.Runtime.load0(java.base@17/Runtime.java:755)
at java.lang.System.load(java.base@17/System.java:1953)
at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:197)
at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:88)
at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:71)
at it.tdlight.common.Init.start(Init.java:46)
- locked <0x000000061e883e58> (a java.lang.Class for it.tdlight.common.Init)
Hello @gillbates Yes, I tried to compile it again myself, and it does not work anymore for me too.
Maybe some dependencies updated and does not support old code anymore. For example, in my telegram project (for which I had to make m1 tdlight libs) 'it.tdlight:tdlight-api-sealed' updated to version 4.0.297 (I do not know what version it was when it worked for me) and interfaces of tdapi changed significantly, so my code does not compile anymore.
Unfortunately, I do not work with my telegram project anymore and have not time to solve that issue myself.
I would suggest you to merge latest changes from tdlight-java -> m1 tdlight-java and tdlight-java-natives -> m1 tdlight-java-natives and try to re-compile.
I've simplified a lot the natives CI scripts, and added the build script for apple silicon.
It's currently excluded from the Github Actions CI because Github currently does not support it, but if you want to build it by yourself, now you can.
Also, to simplify the usage of custom binaries, I've added the java property it.tdlight.native.workdir
: if set, tdlight-java will load libtdlight from there.
Unfortunately Apple M1 is still unsupported on github actions. You'll need to wait until this issue is closed: actions/runner-images#2187
It seems like Apple Silicon runners were introduced recently: "Introducing the new, Apple silicon powered M1 macOS larger runner for GitHub Actions".
https://github.com/actions/runner-images/issues/8439 Github Action already supports Apple Silicon, Will there be builds for this architecture?
**Toutsu ** commented
Are "large runners" free?
**Toutsu ** commented
Are "large runners" free?
I do not know which runners you use, I just asked if there will be builds for Apple Silicon. You could just say "no it won't be" or "it will be if they do it for free"
**Toutsu ** commented
Are "large runners" free?
I do not know which runners you use, I just asked if there will be builds for Apple Silicon. You could just say "no it won't be" or "it will be if they do it for free"
I didn't close this issue, there will be builds for Apple Silicon
macos_arm64 on macos-13-xlarge The job was not started because recent account payments have failed or your spending limit needs to be increased. Please check the 'Billing & plans' section in your settings.
Apple M1 runners are still behind a paywall, I'll wait until they are released to the general public
Apple M1 runners are still behind a paywall, I'll wait until they are released to the general public
No need to wait for GitHub! :)
You can also use FlyCI's M1 and M2 runners. Our runners are on average 2x faster and 2x cheaper than GitHub's AND we have a free tier for OSS projects (see below).
Install Instructrions
Easily replace your M1 runners:
jobs:
ci:
- runs-on: macos-latest
+ runs-on: flyci-macos-large-latest-m1
steps:
- name: 👀 Checkout repo
uses: actions/checkout@v4
Or try the M2 runners:
jobs:
ci:
- runs-on: macos-latest
+ runs-on: flyci-macos-large-latest-m2
steps:
- name: 👀 Checkout repo
uses: actions/checkout@v4
Pricing
Processor | vCPU | RAM (GB) | Storage | Label | Price on FlyCI | Price on GitHub |
---|---|---|---|---|---|---|
M1 | 4 | 7 | 28 GB | flyci-macos-large-latest-m1 | $0.06 | - |
M1 | 8 | 14 | 28 GB | flyci-macos-xlarge-latest-m1 | $0.12 | $0.16 |
M2 | 4 | 7 | 28 GB | flyci-macos-large-latest-m2 | $0.08 | - |
M2 | 8 | 14 | 28 GB | flyci-macos-xlarge-latest-m2 | $0.16 | - |
500 mins/month Free for Public Repos
If your repo is public, then FlyCI offers 500 mins/month of free M1 runner usage with the flyci-macos-large-latest-m1
runner.
Best Regards, Kiril Gantchev CEO and co-founder of FlyCI
Is there any functional method to make it work on M1 these days? It appears that simply direct compiling on M1 is failing.
@ventskus-roman tdlight developers don't have apple computers, we need to know why it fails and also someone who is willing to try to solve the problem, we are not able to debug/fix too complex problems because we don't have apple computers in our hands.
I added Apple M1 support in the latest version (v3.3.1+td.1.8.25). Can somebody test if it works?
The native classifier is macos_arm64
@cavallium it works! Thank you 🥳
great, finally we have this :)