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

Arm64 binary fails to run on Alpine linux #994

Open
rickeyski opened this issue Jan 30, 2024 · 1 comment
Open

Arm64 binary fails to run on Alpine linux #994

rickeyski opened this issue Jan 30, 2024 · 1 comment

Comments

@rickeyski
Copy link

Hi, I was setting up a build pipeline to begin supporting arm64 using Alpine linux. The build downloads ghcup and then install ghc and cabal.

The amd64 build works as expected for both Alpine 3.17.7 and 3.19.1.

INFO[0016] Running: [/bin/sh -c curl --fail --output /bin/ghcup   "https://downloads.haskell.org/ghcup/$(uname -m)-linux-ghcup"   && chmod 0755 /bin/ghcup   && ghcup upgrade --target /bin/ghcup   && ghcup install cabal --set   && /usr/local/.ghcup/bin/cabal update] 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.4M  100 15.4M    0     0   124M      0 --:--:-- --:--:-- --:--:--  124M
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.8.yaml as file /usr/local/.ghcup/cache/ghcup-0.0.8.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  367k  100  367k    0     0  4929k      0 --:--:-- --:--:-- --:--:-- 4961k
[ Info  ] Upgrading GHCup...
[ Warn  ] No GHCup update available

However, the arm64 build does not

INFO[0021] Running: [/bin/sh -c curl --fail --output /bin/ghcup   "https://downloads.haskell.org/ghcup/$(uname -m)-linux-ghcup"   && chmod 0755 /bin/ghcup   && ghcup upgrade --target /bin/ghcup   && ghcup install cabal --set   && /usr/local/.ghcup/bin/cabal update] 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 49.9M  100 49.9M    0     0   292M      0 --:--:-- --:--:-- --:--:--  293M
/bin/sh: ghcup: not found

I was then able to replicate the issue on 1.19 and 1.18, so I don't believe that arm64 on alpine has ever worked.

/ # curl --fail --output /bin/ghcup-old   "https://downloads.haskell.org/ghcup/0.1.19.5/aarch64-linux-ghcup-0.1.19.5"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49.3M  100 49.3M    0     0  90.3M      0 --:--:-- --:--:-- --:--:-- 90.4M
/ # chmod 0755 /bin/ghcup-old 
/ # /bin/ghcup-old --help
/bin/sh: /bin/ghcup-old: not found
/ # curl --fail --output /bin/ghcup-old   "https://downloads.haskell.org/ghcup/0.1.18.0/aarch64-linux-ghcup-0.1.18.0"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 51.5M  100 51.5M    0     0  84.4M      0 --:--:-- --:--:-- --:--:-- 84.4M
/ # chmod 0755 /bin/ghcup-old 
/ # /bin/ghcup-old --help
/bin/sh: /bin/ghcup-old: not found

Additional debugging attempted on arm64 3.19.1 after installing apk dependencies from https://www.haskell.org/ghcup/install/

/ # readelf -h /bin/ghcup 
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x40faec
  Start of program headers:          64 (bytes into file)
  Start of section headers:          52354768 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         32
  Section header string table index: 31
/ # ldd /bin/ghcup 
	/lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libz.so.1 => /lib/libz.so.1 (0xffff9c0a0000)
Error loading shared library libtinfo.so.6: No such file or directory (needed by /bin/ghcup)
	librt.so.1 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libutil.so.1 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libdl.so.2 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xffff9bdf0000)
	libgmp.so.10 => /usr/lib/libgmp.so.10 (0xffff9bd60000)
	libc.so.6 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libm.so.6 => /lib/ld-linux-aarch64.so.1 (0xffff9c110000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xffff9bd20000)
Error relocating /bin/ghcup: gnu_dev_makedev: symbol not found
Error relocating /bin/ghcup: gnu_dev_major: symbol not found
Error relocating /bin/ghcup: gnu_dev_minor: symbol not found
Error relocating /bin/ghcup: set_curterm: symbol not found
Error relocating /bin/ghcup: tigetstr: symbol not found
Error relocating /bin/ghcup: tigetflag: symbol not found
Error relocating /bin/ghcup: tigetnum: symbol not found
Error relocating /bin/ghcup: setupterm: symbol not found
Error relocating /bin/ghcup: tparm: symbol not found
Error relocating /bin/ghcup: del_curterm: symbol not found

Please let me know if you need any other information.

Thanks in advance,
Rickey

@hasufell
Copy link
Member

hasufell commented Jan 31, 2024

This is expected. We don't provide ARM64 alpine binaries (yet). There are no GHC/Cabal/Stack/HLS binaries for it, so there's nothing to install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants