OpenComputers icon indicating copy to clipboard operation
OpenComputers copied to clipboard

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

Open TheSainEyereg opened this issue 2 years ago • 30 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

TheSainEyereg avatar Aug 27 '21 14:08 TheSainEyereg

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

TheNicolasDeveloper avatar Aug 30 '21 13:08 TheNicolasDeveloper

@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 avatar Aug 30 '21 15:08 TheSainEyereg

Thank you.

TheNicolasDeveloper avatar Aug 30 '21 15:08 TheNicolasDeveloper

wait

TheNicolasDeveloper avatar Aug 30 '21 15:08 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Aug 30 '21 15:08 TheNicolasDeveloper

@TheSainEyereg

TheNicolasDeveloper avatar Aug 30 '21 15:08 TheNicolasDeveloper

wait jar file? oh ok

TheNicolasDeveloper avatar Aug 30 '21 15:08 TheNicolasDeveloper

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 avatar Aug 30 '21 17:08 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Aug 30 '21 18:08 TheNicolasDeveloper

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

TheSainEyereg avatar Aug 30 '21 18:08 TheSainEyereg

wait in config? Oh ok

TheNicolasDeveloper avatar Aug 30 '21 19:08 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Aug 30 '21 19:08 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Aug 31 '21 08:08 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Aug 31 '21 16:08 TheNicolasDeveloper

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

TheSainEyereg avatar Sep 02 '21 12:09 TheSainEyereg

Ok

TheNicolasDeveloper avatar Sep 02 '21 14:09 TheNicolasDeveloper

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

TheNicolasDeveloper avatar Sep 02 '21 14:09 TheNicolasDeveloper

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

TheSainEyereg avatar Sep 08 '21 20:09 TheSainEyereg

Thanks

TheNicolasDeveloper avatar Sep 16 '21 13:09 TheNicolasDeveloper

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 avatar Sep 29 '21 12:09 ghost

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

ghost avatar Sep 29 '21 12:09 ghost

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?

TheSainEyereg avatar Sep 30 '21 09:09 TheSainEyereg

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.

ghost avatar Oct 03 '21 10:10 ghost

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 avatar Feb 14 '22 14:02 0x00002a

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

0x00002a avatar Feb 14 '22 21:02 0x00002a

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 avatar Jul 02 '22 06:07 kilometersperhour

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

kilometersperhour avatar Jul 03 '22 00:07 kilometersperhour

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 avatar Jul 03 '22 08:07 0x00002a

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 avatar Jul 03 '22 20:07 kilometersperhour

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!

kilometersperhour avatar Jul 05 '22 17:07 kilometersperhour