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

Support alpine images for arm32v7/armhf #141

Open
fblampe opened this issue Jan 17, 2022 · 13 comments
Open

Support alpine images for arm32v7/armhf #141

fblampe opened this issue Jan 17, 2022 · 13 comments
Labels
enhancement New feature or request

Comments

@fblampe
Copy link

fblampe commented Jan 17, 2022

Hi,

are there any plans to build the Alpine-based containers for the arm32v7 (aka. armhf) architecture? So far, there are Alpine builds for other architectures, and non-Alpine builds for arm32v7, but the combination doesn't exist.

I believe such images would be very useful, since devices with this architecture tend to have little resources, making Alpine a nice fit.

@fblampe fblampe changed the title Support Alpine images for arm32v7/armhf Support alpine images for arm32v7/armhf Jan 18, 2022
@sxa
Copy link
Member

sxa commented Jan 31, 2022

We have Alpine builds for x86-64 and aarch64 but not other Alpine architectures, so we would have to build for that platform before we could consider producing docker files for it. I'm not personally sure there's so much demand for it on this architecture though, and to my knowledge this is the first time I've seen a request for it.

@karianna karianna added enhancement New feature or request question Further information is requested labels Feb 3, 2022
@mrdziuban
Copy link

@sxa did you by chance mean amd64 instead of aarch64? I'm currently trying to build an image based on eclipse-temurin:17-jre-alpine on an Apple silicon (M1) Mac and having trouble because I'm hitting an "Unsupported arch: aarch64" error

@passga
Copy link

passga commented Feb 7, 2022

@sxa we have same situation with temurin:11-jre-alpine as describes above with using of Apple silicon (M1) Mac, do you plan to build image for arm64 soon?

@sxa
Copy link
Member

sxa commented Feb 7, 2022

@mrdziuban Yep sorry for the confusion - have done a strikethrough on aarch64 in my earlier comment.

We don't currently have the testing infrasdtructure set up to do Alpine on aarch64 but given that this particular issue was a request for arm32v7 rather than aarch64 could you raise a separate issue to cover aarch64 please?

@mrdziuban
Copy link

No problem! Created #158 to track aarch64 support

@fblampe
Copy link
Author

fblampe commented Feb 21, 2022

We have Alpine builds for x86-64 and aarch64 but not other Alpine architectures, so we would have to build for that platform before we could consider producing docker files for it. I'm not personally sure there's so much demand for it on this architecture though, and to my knowledge this is the first time I've seen a request for it.

I see. Well then maybe you can start collecting requests here and once there's sufficient demand, it might become a thing? :)

@gounthar
Copy link

gounthar commented Mar 7, 2022

I need it, that's for sure. I have tons of arm32 machines, and they do need this arm32 version.

@gounthar
Copy link

I built an Alpine Docker image to build openJDK, but I'm kind of stuck.
My build fails with a strange (to me at least) error

#7 1285.3 Running ./configure with arguments 'bash ./configure --verbose  --with-vendor-name="Undefined Vendor" --with-vendor-url= --with-vendor-bug-url=file:///dev/null --with-vendor-vm-bug-url=file:///dev/null --with-version-opt=202205171934 --with-version-pre=beta --with-version-build=12 --with-debug-level=release --with-native-debug-symbols=none --with-jvm-variants=server,client --with-cacerts-file=/temurin-build/sbin/../security/cacerts --with-jobs=2 '''
#7 1285.3 Should have the source, I'm at /temurin-build/workspace/build/src
#7 1285.3 Currently at '/temurin-build/workspace/build/src'
#7 1288.8 Running generated-configure.sh
#7 1290.6 configure: WARNING: you should use --build, --host, --target
#7 1290.6 configure: error: unrecognized options: --with-vendor-name, --with-vendor-url, --with-vendor-bug-url, --with-vendor-vm-bug-url
#7 1290.7 configure exiting with result code 1
#7 1290.7 Note: Command line contains non-control variables:
#7 1290.7 * DEBUG_BINARIES=true
#7 1290.7 Make sure it is not mistyped, and that you intend to override this variable.
#7 1290.7 'make help' will list known control variables.
#7 1290.7 
#7 1290.7 Error: No configurations found for /temurin-build/workspace/build/src.

This does not happen with the same image for aarch64 for example.
Of course, I'm not trying to build openjdk9 on aarch64, only openjdk11; for Alpine armhf, I can only find openjdk8 as a bootstrap, so I'm trying to build openjdk9.

Could it be linked to a too recent gcc ?

Thanks.

@gounthar
Copy link

I tried to build with docker on an armv7machine (so using Ubuntu) and I have the same kind of error, so this may not be linked to Alpine.

Certificate was added to keystore

real    4m42.839s
user    4m2.770s
sys     0m37.815s
build.sh : 13:00:31 : Initiating build ...
Pulling latest tags and getting the latest update version using git fetch -q --tags --depth=1
NOTE: This can take quite some time!  Please be patient
From /openjdk//./build//src
 * branch                  HEAD       -> FETCH_HEAD
OpenJDK repo tag is jdk-9.0.4+12
Version: jdk
Should have the source, I'm at /openjdk/build/src
From /openjdk//./build//src
 * branch                  HEAD       -> FETCH_HEAD
OpenJDK repo tag is jdk-9.0.4+12
Completed configuring the version string parameter, config args are now:  --with-vendor-name="Undefined Vendor" --with-vendor-url= --with-vendor-bug-url=file:///dev/null --with-vendor-vm-bug-url=file:///dev/null --with-version-opt=202205181300 --with-version-pre=beta --with-version-build=12
Building up the configure command...
Configuring jvm variants if provided
Configure custom cacerts file security/cacerts
setting freetype dir to /openjdk//./build//installedfreetype
Completed configuring the version string parameter, config args are now:  --with-vendor-name="Undefined Vendor" --with-vendor-url= --with-vendor-bug-url=file:///dev/null --with-vendor-vm-bug-url=file:///dev/null --with-version-opt=202205181300 --with-version-pre=beta --with-version-build=12 --with-boot-jdk=/usr/lib/jvm/jdk8 --with-debug-level=release --with-native-debug-symbols=none --enable-ccache --with-jvm-variants=server,client --with-cacerts-file=/openjdk/sbin/../security/cacerts --with-jobs=1 '' --with-freetype=/openjdk//./build//installedfreetype
Configuring command and using the pre-built config params...
Should have the source, I'm at /openjdk/build/src
Currently at '/openjdk/build/src'
Running ./configure with arguments 'bash ./configure --verbose  --with-vendor-name="Undefined Vendor" --with-vendor-url= --with-vendor-bug-url=file:///dev/null --with-vendor-vm-bug-url=file:///dev/null --with-version-opt=202205181300 --with-version-pre=beta --with-version-build=12 --with-boot-jdk=/usr/lib/jvm/jdk8 --with-debug-level=release --with-native-debug-symbols=none --enable-ccache --with-jvm-variants=server,client --with-cacerts-file=/openjdk/sbin/../security/cacerts --with-jobs=1 '' --with-freetype=/openjdk//./build//installedfreetype'
Should have the source, I'm at /openjdk/build/src
Currently at '/openjdk/build/src'
Running generated-configure.sh
configure: WARNING: you should use --build, --host, --target
configure: error: unrecognized options: --with-vendor-name, --with-vendor-url, --with-vendor-bug-url, --with-vendor-vm-bug-url
configure exiting with result code 1
Note: Command line contains non-control variables:
* DEBUG_BINARIES=true
Make sure it is not mistyped, and that you intend to override this variable.
'make help' will list known control variables.

Error: No configurations found for /openjdk/build/src.
Please run 'bash configure' to create a configuration.

/openjdk/build/src/make/Init.gmk:124: *** Cannot continue.  Stop.
OpenJDK make failed, archiving make failed logs
/openjdk/sbin/build.sh: line 601: cd: build/*: No such file or directory
Copying hotspot/src/share/tools/IdealGraphVisualizer/branding/core/core.jar to TemurinLogsArchive/hotspot/src/share/tools/IdealGraphVisualizer/branding/core
cp: -r not specified; omitting directory 'hotspot/src/share/tools/IdealGraphVisualizer/branding/core/core.jar'
Archiving and compressing with gzip

real    0m0.030s
user    0m0.010s
sys     0m0.019s
Your final archive was created at /openjdk/build/src/OpenJDK.tar.gz
Moving the artifact to /openjdk//target/
archive done.
Failed to make the JDK, exiting

@sxa
Copy link
Member

sxa commented May 18, 2022

Those options are different between 8 and 11+ IIRC. My suspicion would be that our conditionals are set wrongly for JDK9 and pick up the 11 way instead of 8 or vice-versa (Not a surprise since we haven't built it for years). If you wanted to build it you could probably just strip those options out of the build process (or find the conditional that's wrong and PR it - I wouldn't have a problem with putting something that like in personally but I can't speak for other committers!
)

@barthel
Copy link

barthel commented Apr 28, 2023

@gounthar Any progress and maybe success on this topic?
I'm also interested on (any) java 11+ for use with Alpine (musl) on armv7.

@gounthar
Copy link

Unfortunately, no.

I have retried building the armv7 jdk17 alpine image, but there is no Temurin release for armv7 with musl.
Before remembering that, I modified the Dockerfile so it looks like this:

FROM alpine:3.17

ENV JAVA_HOME /opt/java/openjdk
ENV PATH $JAVA_HOME/bin:$PATH

# Default to UTF-8 file.encoding
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# fontconfig and ttf-dejavu added to support serverside image generation by Java programs
RUN apk add --no-cache fontconfig libretls musl-locales musl-locales-lang ttf-dejavu tzdata zlib \
    && rm -rf /var/cache/apk/*

ENV JAVA_VERSION jdk-17.0.7+7

RUN set -eux; \
    ARCH="$(apk --print-arch)"; \
    case "${ARCH}" in \
       amd64|x86_64) \
         ESUM='b6edac2fa669876ef16b4895b36b61d01066626e7a69feba2acc19760c8d18cb'; \
         BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_alpine-linux_hotspot_17.0.7_7.tar.gz'; \
         ;; \
       armv7) \
         ESUM='e7a84c3e59704588510d7e6cce1f732f397b54a3b558c521912a18a1b4d0abdc'; \
         BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.7_7.tar.gz'; \
         ;; \
        *) \
         echo "Unsupported arch: ${ARCH}"; \
         exit 1; \
         ;; \
    esac; \
          wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
          echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
          mkdir -p "$JAVA_HOME"; \
          tar --extract \
              --file /tmp/openjdk.tar.gz \
              --directory "$JAVA_HOME" \
              --strip-components 1 \
              --no-same-owner \
          ; \
    rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/src.zip;

 RUN echo Verifying install ... \
    && fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java \
    && echo javac --version && javac --version \
    && echo java --version && java --version \
    && echo Complete.

CMD ["jshell"]

But it makes no sense, as the downloaded openJDK uses libc and not musl.
So of course when you try jshell you get:

 file jshell
jshell: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, not stripped
/opt/java/openjdk/bin # ldd jshell
        /lib/ld-linux-armhf.so.3 (0xb6ed3000)
        libz.so.1 => /lib/libz.so.1 (0xb6eb2000)
        libjli.so => ./../lib/libjli.so (0xb6e94000)
        libpthread.so.0 => /lib/ld-linux-armhf.so.3 (0xb6ed3000)
        libdl.so.2 => /lib/ld-linux-armhf.so.3 (0xb6ed3000)
        libc.so.6 => /lib/ld-linux-armhf.so.3 (0xb6ed3000)
Error loading shared library ld-linux-armhf.so.3: No such file or directory (needed by ./../lib/libjli.so)
Error relocating ./../lib/libjli.so: __rawmemchr: symbol not found
Error relocating ./../lib/libjli.so: __xstat: symbol not found
Error relocating ./../lib/libjli.so: __fxstat: symbol not found
Error relocating ./../lib/libjli.so: __strdup: symbol not found
/opt/java/openjdk/bin # ll /lib/ld-musl-armhf.so.1 

As long as there isn't any binary package for armv7 and Alpine, we won't be able to build any Docker image with it. 🤷

@stokito
Copy link

stokito commented Aug 17, 2023

The armv7 (and v8) are used widely in new routers.
Here is for example list of routers based Marvell Armada that are supported by OpenWrt https://openwrt.org/docs/techref/targets/mvebu

Alpine has OpenJDK 8 compiled with the musl for the amrv7 and I was able to use it my router. There is even a repo that just repackaged the OpenJDK from the Alpine https://github.com/josedelinux/openwrt-jdk
The repo has 23 stars which is not so many but given how many of new devices appears on a market this may become more popular.

I also was able to use the Eclipse Temurin openjdk17 with glibc in Docker but that's cost me almost all of disk.
It would be really nice if users can download just the jdk directly from Temurin.

@karianna karianna removed the question Further information is requested label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants