Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No native libraries support for aarch64 servers (Oracle ARM servers && Raspberry Pi) #3466

Closed
TheSainEyereg opened this issue Aug 27, 2021 · 47 comments
Milestone

Comments

@TheSainEyereg
Copy link

TheSainEyereg commented Aug 27, 2021

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

@TheNicolasDeveloper
Copy link

@TheSainEyereg Can u tell me how do i install this?

@TheSainEyereg
Copy link
Author

@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

@TheNicolasDeveloper
Copy link

Thank you.

@TheNicolasDeveloper
Copy link

wait

@TheNicolasDeveloper
Copy link

I cant find the assets folder its probaly bc i have 1.7.10 on the server

@TheNicolasDeveloper
Copy link

@TheSainEyereg

@TheNicolasDeveloper
Copy link

wait jar file? oh ok

@TheNicolasDeveloper
Copy link

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.

@TheNicolasDeveloper
Copy link

@TheSainEyereg can u tell me how do i fix this error

@TheSainEyereg
Copy link
Author

TheSainEyereg commented Aug 30, 2021

@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 ?

@TheNicolasDeveloper
Copy link

wait in config? Oh ok

@TheNicolasDeveloper
Copy link

i cant find the settings.conf in /config/opencomputers

@TheNicolasDeveloper
Copy link

@TheSainEyereg Can you send me please the 1.7.10 patched file?

@TheNicolasDeveloper
Copy link

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

@TheSainEyereg
Copy link
Author

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

@TheNicolasDeveloper
Copy link

Ok

@TheNicolasDeveloper
Copy link

Uhhh... how long will this take...

@TheSainEyereg
Copy link
Author

So, I downloaded 1.7.10 version and found aseets folder...
screenshoot
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)
screenshoot

@TheNicolasDeveloper
Copy link

Thanks

@ghost
Copy link

ghost commented Sep 29, 2021

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
Снимок экрана от 2021-09-29 16-06-40

@ghost
Copy link

ghost commented Sep 29, 2021

@TheSainEyereg

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.

@TheSainEyereg
Copy link
Author

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
Снимок экрана от 2021-09-29 16-06-40

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?

@ghost
Copy link

ghost commented Oct 3, 2021

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.

@0x00002a
Copy link

0x00002a commented Feb 14, 2022

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!

@0x00002a
Copy link

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")

@kilometersperhour
Copy link

kilometersperhour commented Jul 2, 2022

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.

@kilometersperhour
Copy link

kilometersperhour commented Jul 3, 2022

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

@0x00002a
Copy link

0x00002a commented Jul 3, 2022

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

@kilometersperhour
Copy link

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!

@kilometersperhour
Copy link

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!

@gatoborrachon
Copy link

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?

@rushiiMachine
Copy link

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

@gatoborrachon
Copy link

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)

@rushiiMachine
Copy link

It could be the fact they're compiled for a different ABI, in which case you would have to do it on your own

@asiekierka
Copy link
Contributor

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.

@asiekierka asiekierka pinned this issue Aug 31, 2022
@gatoborrachon
Copy link

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

@asiekierka
Copy link
Contributor

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.

@asiekierka
Copy link
Contributor

Fixed in ac4d935 .

Keeping this issue pinned as help for people stuck on older OpenComputers versions.

@gatoborrachon
Copy link

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)

@asiekierka
Copy link
Contributor

No. The Lua library is still linked against glibc, while Android uses Bionic - therefore, Android would need separate builds.

@gatoborrachon
Copy link

gatoborrachon commented Sep 18, 2022

oh, and how could i make these builds?

@asiekierka
Copy link
Contributor

You'd need to set up an Android NDK cross-compiler that works with the Meson build system in here.

@gatoborrachon
Copy link

ok, let me try it once vacations start, many thanks

lets see if this thing might work
https://github.com/ppetraki/meson-android-helloworld

@TheCodex6824
Copy link
Contributor

TheCodex6824 commented Sep 20, 2022

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)

@asiekierka
Copy link
Contributor

asiekierka commented Sep 21, 2022

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.

@kristibektashi
Copy link

kristibektashi commented May 7, 2023

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

@asiekierka
Copy link
Contributor

Not at this time, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants