hledger icon indicating copy to clipboard operation
hledger copied to clipboard

Alpine package for aarch64

Open wbadart opened this issue 1 year ago • 18 comments

Hi Simon-

I'm trying to get hledger installed on a Raspberry Pi 4 running Alpine (3.16). I was excited to see packages in the Installation Guide for both Alpine (apk) and Raspberry Pi, but after enabling the apk testing repo and trying to install hledger, the package wasn't found.

I realized after a moment that the apk package is x86_64-only. Given what automation the project already has in place, how big a lift would it be to tack on aarch64 binaries for apk? Happy to help out where I can, though I've never been on the distributor end of an apk package, so I'd need some time to get spun up on that.

Thanks for your consideration!

wbadart avatar Aug 01 '22 17:08 wbadart

Thanks @wbadart. (We should clarify that it's x64 on the install page.) I think the answer depends on whether Github offers aarch64 workers - I think not right now ?

simonmichael avatar Aug 01 '22 17:08 simonmichael

Or, does alpine have such infrastructure ? How do they obtain aarch64 binaries for other packages ?

simonmichael avatar Aug 01 '22 17:08 simonmichael

And does it need to be Alpine-specific, or would a generic static aarch64 binary that also worked for other Pi distros be possible ?

simonmichael avatar Aug 01 '22 17:08 simonmichael

Good questions, not sure. I think the Alpine wiki page on creating packages may be outdated (e.g. it doesn't give aarch64 as an accepted value of the arch parameter of APKBUILD file that declares the package's metadata). I can experminent on that Pi of mine to see if I can put one of those 3rd party rpi hledger binaries in the apk package without it blowing up.

Could cross-compiling be a possible avenue for aarch64 CI builds until GitHub supports them natively?

wbadart avatar Aug 02 '22 04:08 wbadart

I believe GHC doesn't really do cross-compiling, unless possibly via some Nix magic.

simonmichael avatar Aug 03 '22 16:08 simonmichael

@wbadart You should be able to just take an existing static aarch64 build from https://hledger.org and use that. Or follow my instructions here to build it youself e.g. In a aarch64 docker or chroot: https://github.com/simonmichael/hledger/issues/1268#issuecomment-653615056

nobodyinperson avatar Dec 02 '22 19:12 nobodyinperson

I didn't understand that, where is "an existing static aarch64 build from https://hledger.org/" ?

simonmichael avatar Dec 06 '22 02:12 simonmichael

On https://hledger.org/install.html there is a link unter Raspberry Pi to https://github.com/simonmichael/hledger/releases/tag/1.18.1 where my build of hledger for aarch64 is available: https://github.com/simonmichael/hledger/releases/download/1.18.1/hledger-aarch64-manjaro.gz

It's a little outdated though...

nobodyinperson avatar Dec 06 '22 06:12 nobodyinperson

Ah, thanks.

simonmichael avatar Dec 06 '22 16:12 simonmichael

@nobodyinperson thanks for the tip! I'll see check and see if hledger-aarch64-manjaro.gz works on my Alpine Pi when I'm back home in a few weeks.

wbadart avatar Dec 07 '22 18:12 wbadart

I put the build instructions together into a Dockerfile so building hledger e.g. for aarch64 is simpler in the future: https://gitlab.com/nobodyinperson/hledger-build-docker

Here is hledger v 1.26.1 aarch64 built this way, @simonmichael feel free to add it to the GitHub Release page and https://hledger.org/install.html#raspberry-pi:

hledger-1.26.1-linux-aarch64.gz

Apparently, with cabal, hledger 1.26.1 is the latest buildable version. Later versions throw weird dependency errors. At least in that debian container. 🤷

nobodyinperson avatar Dec 22 '22 09:12 nobodyinperson

Thanks! Did you try cabal update to resolve the build errors ? What was the full cabal output ?

On Dec 21, 2022, at 23:47, Yann Büchau @.***> wrote:

I put the build instructions together into a Dockerfile so building hledger e.g. for aarch64 is simpler in the future: https://gitlab.com/nobodyinperson/hledger-build-docker https://gitlab.com/nobodyinperson/hledger-build-docker Here is hledger v 1.26.1 aarch64 built this way, @simonmichael https://github.com/simonmichael feel free to add it to the GitHub Release page and https://hledger.org/install.html#raspberry-pi https://hledger.org/install.html#raspberry-pi:

hledger-1.26.1-linux-aarch64.gz https://github.com/simonmichael/hledger/files/10285691/hledger-1.26.1-linux-aarch64.gz Apparently, with cabal, hledger 1.26.1 is the latest buildable version. Later versions throw weird dependency errors. At least in that debian container. 🤷

— Reply to this email directly, view it on GitHub https://github.com/simonmichael/hledger/issues/1903#issuecomment-1362627877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACPIHDJTVFSWWXTP3GKPTWOQPTPANCNFSM55IJWDIQ. You are receiving this because you were mentioned.

simonmichael avatar Dec 22 '22 12:12 simonmichael

Meanwhile my Raspberry Pi built yet an older version of hledger:

hledger-1.26-linux-aarch64.gz

Error message for any version above 1.26.1 (tested with 1.27 and 1.28):

Sending build context to Docker daemon  211.2MB
Step 1/9 : FROM debian
 ---> 917ea2fdcbd6
Step 2/9 : MAINTAINER Yann Büchau <[email protected]>
 ---> Using cache
 ---> a1bc1777526f
Step 3/9 : ENV LC_ALL=C.UTF-8
 ---> Using cache
 ---> b6a4e72e5443
Step 4/9 : RUN apt-get update
 ---> Using cache
 ---> 31021e0f6b66
Step 5/9 : RUN apt-get install -y cabal-install
 ---> Using cache
 ---> 5d652f6765ac
Step 6/9 : RUN cabal update
 ---> Using cache
 ---> 512969eb431f
Step 7/9 : RUN cabal install alex happy
 ---> Using cache
 ---> 356c275388a5
Step 8/9 : RUN cabal install hledger-1.28
 ---> Running in 6d1780a6fcfb

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: hledger-1.28 (user goal)
[__1] next goal: base (dependency of hledger)
[__1] rejecting: base-4.13.0.0/installed-4.1... (conflict: hledger =>
base>=4.14 && <4.18)
[__1] rejecting: base-4.17.0.0, base-4.16.4.0, base-4.16.3.0, base-4.16.2.0,
base-4.16.1.0, base-4.16.0.0, base-4.15.1.0, base-4.15.0.0, base-4.14.3.0,
base-4.14.2.0, base-4.14.1.0, base-4.14.0.0, base-4.13.0.0, base-4.12.0.0,
base-4.11.1.0, base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0,
base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2,
base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0,
base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0,
base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0,
base-3.0.3.2, base-3.0.3.1 (constraint from non-upgradeable package requires
installed instance)
[__1] fail (backjumping, conflict set: base, hledger)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hledger, base

nobodyinperson avatar Dec 22 '22 19:12 nobodyinperson

If it's using base-4.13, that must be GHC 8.8 ? If so that's too old, the oldest GHC we build with nowadays is 8.10.

simonmichael avatar Dec 22 '22 19:12 simonmichael

❯ sudo docker run --rm -it debian sh -c 'apt update -q 2>/dev/null >/dev/null;apt show ghc 2>/dev/null | grep -i version'
Version: 8.8.4-2

Yep, debian again with its delightfully up-to-date software... 🙄

nobodyinperson avatar Dec 22 '22 20:12 nobodyinperson

Finally got the build working with the fedora image with latest hledger:

hledger-1.28-linux-aarch64-fedora.gz

However as alpine uses musl-libc, these builds won't work under Alpine I'm afraid, maybe with this compatibility g-something. All other platforms should be able to run this binary as usual.

nobodyinperson avatar Dec 23 '22 14:12 nobodyinperson

Would it help you out if there were more platforms supported in Docker images? I'm attempting to do that in #2002. Also thinking that potentially all the build steps in the Linux binary build could happen in the top level Dockerfile and the CI step for that could just consume that Dockerfile

cardoe avatar Feb 10 '23 04:02 cardoe

hledger, on aarch64, is available since alpine v3.17 from upstream community repository. The instructions to install hledger are updated to reflect this as well.

dhruvin-dev avatar Sep 04 '23 14:09 dhruvin-dev