deploy action broken by switch from ubuntu-20.04 to ubuntu-22.04
As ubuntu-latest = ubuntu-22.04 is rolled out,
- https://github.com/actions/runner-images/issues/6399
our deploy workflow got broken: https://github.com/agda/agda/actions/runs/3603326548/jobs/6071389168 This workflow creates a static binary:
args = --disable-executable-profiling --disable-library-profiling --enable-executable-static --enable-split-sections
It uses GHC 9.4.2 and Cabal 3.8.1:
Resolved 9.4 to 9.4.2
Resolved 3.8 to 3.8.1.0
Linking fails:
[3 of 3] Linking /home/runner/work/agda/agda/dist-newstyle/build/x86_64-linux/ghc-9.4.2/Agda-2.6.4/build/agda-mode/agda-mode
/home/runner/.ghcup/ghc/9.4.2/lib/ghc-9.4.2/lib/../lib/x86_64-linux-ghc-9.4.2/process-1.6.15.0/libHSprocess-1.6.15.0.a(fork_exec.o):function do_spawn_fork: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
... (repeats)
...
/home/runner/.ghcup/ghc/9.4.2/lib/ghc-9.4.2/lib/../lib/x86_64-linux-ghc-9.4.2/unix-2.7.3/libHSunix-2.7.3.a(Files.o):
function ghczuwrapperZC1ZCunixzm2zi7zi3ZCSystemziPosixziFilesZCmknod:
error: undefined reference to '__xmknod'
rts/Linker.c:597:0: error:
warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
rts/linker/Elf.c:2167:0: error:
warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
We also got the warnings under ubuntu-20.04, but not the error:
/home/runner/.ghcup/ghc/9.4.2/lib/ghc-9.4.2/lib/../lib/x86_64-linux-ghc-9.4.2/unix-2.7.3/libHSunix-2.7.3.a(Files.o):
function ghczuwrapperZC1ZCunixzm2zi7zi3ZCSystemziPosixziFilesZCmknod:
error: undefined reference to '__xmknod'
This ain't a caching problem because we do not have caching for this workflow.
Since our Cabal workflow has no problems maybe it is the combination of these three:
-
ubuntu-22.04 - GHC 9.4 with
unix-2.7.3 -
--enable-executable-static
~~I wonder whether haskell/actions/setup also contributes, but there is not evidence for this yet.~~ (UPDATE: it does not.)
Someone with ubuntu-22.04, could you please test building Agda with --enable-executable-static and GHC 9.4.2 or GHC 9.4.3? (@nad, @asr, ...)
I am on Linux Mint 21 which is based on Ubuntu 22.04, so I can give it a try.
I am able to run cabal install --enable-executable-static --overwrite-policy=always --disable-executable-profiling --disable-library-profiling --enable-split-sections with no problems, using Cabal 3.8.1.0 and GHC 9.4.3 on Linux Mint 21. So something else must be causing the problem. If there's any other experiments that I can help with, please let me know.
Thanks for checking, @jesper. So it is not a problem in common setups.
It could still be a problem with the ubuntu-22.04 image that github ships.
Here is a MWE workflow that demonstrates that static linking breaks with GHC 9.4 on ubuntu-22.04: https://github.com/andreasabel/ci-executable-static/actions/runs/3620795602/jobs/6103451937
Upstream reports:
- https://github.com/actions/runner-images/issues/6689
- https://github.com/haskell/unix/issues/265
For the moment, pin to ubuntu-20.04 to get CI green again, while issue is being investigated.
The laconic answer by @hasufell is that static binaries are not expected to work on ubuntu and we should use an Alpine docker container: https://github.com/actions/runner-images/issues/6689#issuecomment-1338510435
But I wonder whether the binaries build under Alpine will the be usable under Ubuntu!? Is there a reason to expect this?
(Frankly, I do not feel like going beyond the Blessed GitHub Trinity: Mac, Windows, Ubuntu.)
But I wonder whether the binaries build under Alpine will the be usable under Ubuntu!? Is there a reason to expect this?
Yes, if you statically link. Musl supports full static linking. GHCup itself does this.
Moving to Alpine seems more pressing now that GHC 9.6 cannot build static binaries even under Ubuntu 20.04. https://github.com/agda/agda/actions/runs/4434689947/jobs/7788095060#step:13:29
/usr/lib/x86_64-linux-gnu/libm-2.31.a(s_atan.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
There seems to be a problem with linking against the floating point library.
Discussion with @L-TChen at AIM XXXVII:
- try
setup-alpineaction for deploy on linux to build static executable - use the deploy workflow also to deploy releases
- to this end,
- add triggers on push tag starting with
v - in that case use the tag as name for the release and not
nightly
- add triggers on push tag starting with
Discussion with @L-TChen at AIM XXXVII:
try
setup-alpineaction for deploy on linux to build static executableuse the deploy workflow also to deploy releases
to this end,
- add triggers on push tag starting with
v- in that case use the tag as name for the release and not
nightly
Just to keep you updated: the GitHub action does work and Agda can be statically linked within Alpine Linux on the Linux runner. I just need to simplify the workflow before pushing it to the master branch.
https://github.com/L-TChen/agda/actions/runs/7638946291/job/20810887455