Reputation: 577
I would like to use Signal to send status messages from my NAS to my phone.
A well-maintained solution, signal-cli, requires at least Java 21. The
My NAS is a armv7 (ARM Cortex-A15). The only pre-built ARMv7-compatible binary that I could find has a dependency on glibc that is higher (GLIBC_2.18) than what I have installed (2.17).
I've spent most of the past few days trying to cross-compile OpenJDK using the Linaro tool-chain.
The problem that I appear to have come up against is that OpenJDK requires a gcc version greater than 6.0, which builds against lib > 2.17.
Is there any cross-compile tool that will help me to solve this problem? I.e. gcc >= 6.0, libc 2.17.
I'm also open to any other solution that solves my use-case.
Upvotes: 1
Views: 50
Reputation: 577
ChatGPT presented me with an alternate solution while I was using it to diagnose compiler errors: Cross-compile and install Glibc 2.18 onto the NAS.
This was a relatively straight forward operation (See notes, below).
The result is that I can now install the pre-built JDK installation from Bellsoft and it runs fine.
To be clear, I installed the Glibc 2.18 in parallel, in it's own location, and I manually specify the library paths to the Java environment.
An example command-line looks like this:
signal/glibc-2.18/lib/ld-2.18.so --library-path signal/sysroot_built/lib:signal/glibc-2.18/lib signal/jdk-21.0.6/bin/java Test
This can be simplified with suitable LD_LIBRARY_PATH
in a launcher script:
#!/bin/bash
# Launch local Java application using the local glibc 2.18 dynamic loader.
PATH=signal/jdk-21.0.6/bin:$PATH
LD_LIBRARY_PATH=LD_LIBRARY_PATH="signal/sysroot_built/lib:signal/glibc-2.18/lib"
signal/glibc-2.18/lib/ld-2.18.so java JavaMain
NOTES: I did have to make 3 changes to get the library to compile using gcc-linaro-7.5.0:
../configure
to accept my newer version of make
:
../configure
, around line 4775, change 3.79* | 3.[89]*
to 3.79* | 3.[89]* | 4.*
_Unwind_Resume
error, I had to add __attribute_used__
to both
../ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
../ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
Then I configured, compiled and installed with:
../configure --prefix=~/local/glibc-2.18 --host=arm-linux-gnueabihf --build=x86_64-linux-gnu
make -j15
make install
Copied to the NAS with:
rsync -avz ~/local/glibc-2.18 [email protected]:signal
Upvotes: 0