sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.07k stars 280 forks source link

arm support? #54

Closed yangxuan8282 closed 6 years ago

yangxuan8282 commented 7 years ago

I'm trying to compile glibc for raspberry pi

and here is my commit:

https://github.com/yangxuan8282/docker-glibc-builder/commit/b2e59b549e7d6653c45734a641dae7bfeb3d41ca

https://github.com/yangxuan8282/docker-alpine-abuild/commit/c6b9cb3565862a3d8a64acca620834815b9043b8

https://github.com/yangxuan8282/alpine-pkg-glibc/commit/d65d1ff62def2faa66dfda9124f0198109f6e41d

one change of APKBUILD is add:

ls -s /usr/glibc-compat/lib/ld-linux-armhf.so.3 ${pkgdir}/lib/ld-linux-armhf.so.3

but it will complaint:

ls: cannot access '/usr/glibc-compat/lib/ld-linux-armhf.so.3': No such file or directory
ls: cannot access '/home/builder/package/pkg/glibc/lib/ld-linux-armhf.so.3': No such file or directory

I'm not sure why this happen, because it look pretty same as original:

ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 ${pkgdir}/lib/ld-linux-x86-64.so.2
ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 ${pkgdir}/lib64/ld-linux-x86-64.so.2

when I extract glibc-bin-2.25.tar.gz, found the file did exist:

ls ./usr/glibc-compat/lib/ld-linux-armhf.so.3 
./usr/glibc-compat/lib/ld-linux-armhf.so.3
yangxuan8282 commented 6 years ago

I have updated my glibc apk build for armhf to latest 2.27-r0: https://github.com/yangxuan8282/alpine-pkg-glibc/releases . It should works. If not, you can try this old one: https://github.com/armhf-docker-library/alpine-pkg-glibc/releases .

marianopeck commented 5 years ago

Hi,

I am trying to get it work on Raspberry Pi, using latest 2.29 I am also finding an issue: https://github.com/sgerrand/alpine-pkg-glibc/issues/113

Do you know if it is the same issue? Were your changes integrated in this upstream project or only in your fork? As far as I can see your latest release is for 2.27. Any idea how to try your fork for me issue?

Thanks in advance,

Josua-SR commented 5 years ago

Hi everyone,

I think this issue may be worth reopening. I found that compiling glibc was no big deal, executing the docker-glibc-builder natively on an arm board was enough to produce working binaries, and the changes to the apkbuild aren't difficult either.

@sgerrand it would be really cool imo if you could be publishing binary releases for aarch32 and aarch64. The place that I found your binaries used, and that could benefit from arm binaries, is the https://github.com/AdoptOpenJDK/openjdk-docker/ alpine containers. I was able to build and run their openjdk12/jdk-alpine with the glibc apk I built using this earlier built glibc package!

If there is something we can do to make that happen, please let us know.

marianopeck commented 5 years ago

+1 I would love aarch32 and aarch64 releases. In fact, I am ONLY using Alpine on Raspberry...

marianopeck commented 5 years ago

Hi @yangxuan8282 I am giving a try to version 2.27 but I cannot add the correct pub key. I tried many different URLs:

RUN apk --no-cache add ca-certificates wget \
    && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/sgerrand.rsa.pub \
    && wget https://github.com/yangxuan8282/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk \
    && wget https://github.com/yangxuan8282/alpine-pkg-glibc/releases/download/2.27-r0/glibc-bin-2.27-r0.apk \
    && wget https://github.com/yangxuan8282/alpine-pkg-glibc/releases/download/2.27-r0/glibc-i18n-2.27-r0.apk \
    && apk add glibc-bin-2.27-r0.apk glibc-i18n-2.27-r0.apk glibc-2.27-r0.apk

I also tried https://github.com/yangxuan8282/alpine-pkg-glibc/blob/master/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub https://github.com/yangxuan8282/alpine-pkg-glibc/blob/2.27-r0/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub

But I always get:

"ERROR: glibc-bin-2.27-r0.apk: UNTRUSTED signature"

Do you know what is the correct link to pub file?

gokalper commented 5 years ago

I compiled an arm32v7 glibc 2.30 by changing the dockerfile for https://github.com/sgerrand/docker-glibc-builder and running the build on a raspberry pi:

FROM arm32v7/ubuntu:19.04
MAINTAINER Sasha Gerrand <github+docker-glibc-builder@sgerrand.com>
ENV PREFIX_DIR /usr/glibc-compat
ENV GLIBC_VERSION 2.30
RUN apt-get -q update \
    && apt-get -qy install \
        bison \
        build-essential \
        gawk \
        gettext \
        openssl \
        python3 \
        texinfo \
        wget
COPY configparams /glibc-build/configparams
COPY builder /builder
ENTRYPOINT ["/builder"]

Then running this docker run --rm --env STDOUT=1 imagename/forabovedockerfile:tag 2.30 /usr/glibc-compat > glibc-bin.tar.gz to generate the required files and copying them into a new image to build the APK with:

FROM arm32v7/alpine:3.10

RUN apk add alpine-sdk && \
    git config --global user.name "Gokalp Ercilasun" && \
    git config --global user.email "gercilasun@gmail.com" && \
    git clone git://git.alpinelinux.org/aports && \
    sed -i "s/#PACKAGER=\"Your Name <your@email.address>\"/PACKAGER=\"Gokalp LASTNAME <email@domain.com>\"/g" /etc/abuild.conf && \
    adduser --disabled-password --shell /bin/sh --gecos "User" appuser && \
    echo appuser:appuser | chpasswd && \
    sudo echo "appuser ALL=(ALL) ALL" >> /etc/sudoers && \
    sudo addgroup appuser abuild && \
    sudo mkdir -p /var/cache/distfiles && \
    sudo chmod a+w /var/cache/distfiles && \
    sudo chgrp abuild /var/cache/distfiles && \
    sudo chmod g+w /var/cache/distfiles
#    abuild-keygen -a -i -n

USER appuser

COPY glibc-bin.tar.gz /home/appuser/glibc-bin.tar.gz
COPY ld.so.conf /home/appuser/ld.so.conf 
COPY nsswitch.conf /home/appuser/nsswitch.conf
COPY APKBUILD /home/appuser/APKBUILD
COPY glibc-bin.trigger /home/appuser/glibc-bin.trigger

RUN abuild-keygen -a -i -n && \
    abuild checksum && \
    abuild -r

# COPY FILES OUT MANUALLY ALSO COPY PUBLIC KEY

ENTRYPOINT ["/bin/sh"] 

I hosted my compiled APK for alpine here: https://github.com/gokalper/glibc-alpine-arm32v7/tree/master/armv7

halower commented 3 years ago

aarch64:

 apk add glibc-bin-2.27-r0.apk glibc-i18n-2.27-r0.apk glibc-2.27-r0.apk 
returned a non-zero code: 99