
No native libraries support for aarch64 servers (Oracle ARM servers && Raspberry Pi)
TheSainEyereg opened this issue · 47 comments
I have been keeping servers with mods for my friends for several years, initially I kept my servers on my Raspberry Pi (which coped well), but then I switched to powerful Oracle virtual servers, which also worked on the ARM architecture. And on both machines I have a problem with the opencomputer mod, some programs didn't working, lua 5.3 also does not work. I checked mod file and noticed that there are no native libraries for the ARM at all. I compiled my native library and puted it into mod file (I'll attach it below) after that, ploblem was fixed. But I am interested, will native support for aarch64 be added in the feature for those who cannot build the library themselves?
lua 5.2 native: native.64.arm.so.zip
lua 5.3 native: native.64.arm.so.zip
Thanks to @artemking4 for compiling this libs
Sorry but this didnt fix the issue i have.
the issue i have is that i have in chat: OpenComputers: Native Lua libraries are not available, computers will not be able to persist their state.
@TheSainEyereg can u tell me how do i fix this error
@TheSainEyereg Can u tell me how do i install this?
@TheSainEyereg Can u tell me how do i install this?
Just put these files into the .jar file in /assets/opencomputers/lib/ in lua52
and lua53
accordingly and made forceNativeLibWithName
setting in settings.conf look like:
forceNativeLibWithName="native.64.arm.so"
Then replace your old jar with patched and restart server, now It should work
@TheSainEyereg can u tell me how do i fix this error
What is your machine CPU architecture?
What is your machine OS?
What is your server core?
Have you changed your settings in /config/opencomputers/settings.conf ?
I cant find the assets folder its probaly bc i have 1.7.10 on the server
@TheSainEyereg Can you send me please the 1.7.10 patched file?
also i forgot to tell u the system info
OS: Raspberry Pi OS 64Bit Beta
RAM: 8GB
CPU Archeticture: ARM64
I dont know what is server core
also i forgot to tell u the system info
OS: Raspberry Pi OS 64Bit Beta
RAM: 8GB
CPU Archeticture: ARM64
I dont know what is server core
Ok, I'll provide you jar as soon as I can. But I'm surprised you didn't find assets folder
So, I downloaded 1.7.10 version and found aseets
folder...
But anyway, here is your file:
Patched.zip
Dont forget to change forceNativeLibWithName
to native.64.arm.so
(I included my config in archive for example)
Have you changed your settings in /config/opencomputers/settings.conf ?
There is only application.conf . Other names still not being recognized, this was an error in text i guess, sorry for bothering you again.
Hello, i have tried patching these libs on my pi, but no luck! Same errors, i inserted libs, changed config, and still nothing! Am i doing this wrong, or there is one more thing i should do? The error is being encountered in 1.12.2 OC version
Hm, I don't know. I provided you all that I done myself and It worked. Unlikely, but it could be an OS problem, cuz all my servers (RPI and Oracle) are running same Ubuntu Server 20.04, but I don't think that it is. Can you include your server log?
log.txt
Okay, i attached the log.txt, the only thing that spots out is that the config was generated on old version of MC.
Thanks for this, I've managed to get it to accept the libs (which it wasn't doing with the OC-native ones I compiled myself) but I've run into an issue whenever I turn on a computer: java: symbol lookup error: <...>/OpenComputersMod-1.7.5.192-lua52-native.64.arm.so: undefined symbol: pow
, I'm not sure if this is in the lua library or actually an issue with failing to link to glibc properly, I'm guessing you have no such issue?
Also what did you do to compile the native libs? I've tried modifying and using the OC-natives repo (compiled for arm on the machine ofc) but it doesn't accept them even when named correctly.
Edit:
Not two minutes after posting this did I decide to run ld
on it, which told me it was failing to find any of the maths symbols, which then reminded me that of course under gcc math is a separate lib (libm.so
).
tl;dr add /usr/lib/libm.so
(or whatever the path to libm is for your system, locate
is your friend) to LD_PRELOAD
and it works!
opencomputers-armpatched.1.7.5-1.12.2.jar.txt
patched jar for 1.12.2 oc 1.7.5 if anyone needs it, just remove the .txt extension (github doesn't like "executables")
Hi there. I'm trying this on a 32-bit version of Raspberry Pi OS for the Pi 4 and I can't get 0x00002a's instructions to work for me. I don't get the same errors either; there definitely seems to be a compatibility (or maybe linking? idk) issue with the math library (/usr/lib/arm-linux-gnueabihf/libm.so). I'm not sure if there's any more that's relevant, but I'll be as helpful as I can!
This configuration worked before when I was running on an Intel setup, but I moved to the Pi to save power (160W > 15W) so any help is appreciated.
I'm running the (Compact Claustrophobia modpack) if that's useful to know. I can try to isolate the issue by creating a standalone pack with only OC if that's helpful too.
BTW I will gladly compile something for ARM, I just don't really know where to start. I'm familiar with gcc and makefiles and whatnot, but I don't know what source (it would be from this repo, right?) I'd need to compile to have a compatible Lua library.
Y'all rock and I appreciate you so much; solving Minecraft problems with programming has been super fun, and learning Lua has been such a good time for me. <3
PS. Using the patched jar above, I was able to produce the following lines toward the end of my (successful) server-startup routine:
[23:07:49] [Server thread/INFO] [opencomputers]: Initializing OpenComputers API.
[23:07:49] [Server thread/INFO] [opencomputers]: Found a compatible native library: 'OpenComputersMod-1.7.5.192-lua52-native.32.arm.so'.
[23:07:50] [Server thread/WARN] [opencomputers]: Native library with name 'lua53/native.32.arm.so' not found.
[23:07:50] [Server thread/WARN] [opencomputers]: Unsupported platform, you won't be able to host games with persistent computers.
[23:07:50] [Server thread/INFO] [opencomputers]: Done with pre init phase.
[23:08:49] [Server thread/INFO] [opencomputers]: Found extended redstone mods, enabling tier two redstone card.
[23:08:50] [Server thread/INFO] [opencomputers]: Initializing capabilities.
[23:08:50] [Server thread/INFO] [opencomputers]: Done with init phase.
[23:09:04] [Server thread/INFO] [opencomputers]: Done with post init phase.
[23:09:48] [Server thread/INFO] [opencomputers]: Initializing unicode wcwidth.
[23:09:48] [Server thread/INFO] [opencomputers]: Initializing font glyph widths.
[23:09:48] [Server thread/WARN] [opencomputers]: Invalid glyph char code detected in font.hex. Expected 0<= charCode <10000, got: 1D300
[23:09:48] [Server thread/WARN] [opencomputers]: 87 total invalid glyph char codes detected in font.hex
[23:09:48] [Server thread/INFO] [opencomputers]: glyph width ready.
Should I be starting here? https://github.com/fnuecke/eris
This seems to be the thing that ought to be running to execute the necessary Lua code to run the robots (the Lua VM). I found the link at the documentation homepage (https://ocdoc.cil.li/).
Edit: got stuck when compiling. Error was the following:
lua.c:67:10: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: lua.o] Error 1
make[2]: Leaving directory '/opt/minecraft/compactclaustrophobia/oc-testing/eris/src'
make[1]: *** [Makefile:123: linux] Error 2
make[1]: Leaving directory '/opt/minecraft/compactclaustrophobia/oc-testing/eris/src'
make: *** [Makefile:55: linux] Error 2
If I had to guess I'd say our libsm's have different ABIs or smth. If you wanna try compiling yourself u need: https://github.com/MightyPirates/OC-Natives, you'll prolly have to edit the gradle file to get it working. I'll see if I can find the one I used and if its reusable I'll upload it
Edit:
build-on-pi4.patch.txt again just remove the .txt
. Note that is for adopt open jdk 8 installed at /usr/lib/jvm/adoptopenjdk-8-openj9-arm64
so you'll have to change it if you have a different jdk. Also note it changes the compiler to just gcc
since this is for compiling on the pi itself and finally it adds -lm
for the math lib
0x00002a, thanks a ton, I'm going to try this and get back to you. Busy day with work and whatnot but I'll try and get a quick turnaround. Thanks a bunch for the help!
Okay, so I saw in your patch diff that there's a /jvm/include directory that I don't have. I've installed both the OpenJDK and the AdoptOpenJDK like I thought you must have done, and the directory still isn't there. I've tried searching the web, but I don't know exactly what I'm looking for. If I knew what manual to read I'd RTFM, but I am super new to Java as a programming language.
With respect to the patch, I think I got everything else (all the other lines) in place.
Any help is appreciated!
I added these libs from OP inside the folders he said they belong, i changed the oconfig file and added the name of the libs were required, but the game stills reboot any computer after re-entering to a world, what can i do?
For anyone else that has the made the same stupid mistake, you need to add the binaries at the path inside the opencomputers mod jar, not server root.
The binaries OP supplied seemed to work on an arm64 oracle linux vps
For anyone else that has the made the same stupid mistake, you need to add the binaries at the path inside the opencomputers mod jar, not server root.
i did exactly this, opening the .jar file and added the files in their respective folder (x86 and x64), but it doesn't work, maybe because i'm on android ARM? (i'm using PojavLauncher)
It could be the fact they're compiled for a different ABI, in which case you would have to do it on your own
Just as a heads-up: there has always been intent to fix this officially, but it will most likely be coupled with a more reproducible, updated, and optimized build of Eris/JNLua in general, if ever.
well, i know that it might never happen, but no problem, the only issue is: How can i compile these files by myself? honestly, i have 0% idea on how to do it, but i have worked with code before (just in a superficial way), so if it is as easy as writing some commands in a command line, i can do it
That's the "fix this officially" part. The old natives code lives here: https://github.com/MightyPirates/OC-Natives/tree/90170902641b49659a6a4466bdca572da9f0ac49 - but I have never built them from here and I'm not sure if they're up to date.
Fixed in ac4d935 .
Keeping this issue pinned as help for people stuck on older OpenComputers versions.
mmm, should these fixes work on Android? (i'm using PojavLauncher to play minecraft java on my phone, but while using this version computers still not persist, and i got the same warning about this in chat)
No. The Lua library is still linked against glibc, while Android uses Bionic - therefore, Android would need separate builds.
You'd need to set up an Android NDK cross-compiler that works with the Meson build system in here.
ok, let me try it once vacations start, many thanks
lets see if this thing might work
https://github.com/ppetraki/meson-android-helloworld
Would you consider changing the forceNativeLibWithName
config option to take a lua version pattern string, or split it up into an array with an entry for each version? I'm currently trying to get the native libs working on ppc64, but that config option only takes a normal string, so only one version can be loaded by OC. If the library chosen is not for lua 5.4, this also makes even the single native not work at all, because haveNativeLibrary
in LuaStateFactory
gets set to false.
I'd be willing to work on a solution for that if you would accept it. I'm not sure what the breaking change policy is for that config option, but since it's already a bit broken now anyway, I can't imagine anyone is actually using it.
(Sorry for hijacking the issue a bit, but this could also help avoid the "no native libraries for x system" issues in the future)
That is a good idea. Could you open a separate issue for it?
Breaking changes for the config file are fine in the 1.8.0 snapshot; we're breaking the ABI for native libraries anyway.
What about Windows on ARM? (cus yes that's a thing). The changelog for OC 1.8.0 claims to have added Aarch64 support for Linux and MacOS. But I am planning to install Windows on my Raspberry Pi and use that to run a Minecraft server and I was wondering if OC would work on it because it isn't mentioned anywhere