haskell / docker-haskell

MIT License
63 stars 37 forks source link

137 exit status on Cabal package installations with DOCKER_DEFAULT_PLATFORM=linux/amd64 on an M1 Mac #79

Closed jonkri closed 2 years ago

jonkri commented 2 years ago

Hello!

My goal is to prepare a linux/amd64 Docker image using DOCKER_DEFAULT_PLATFORM on an M1 Mac, but cabal seems to fail to install any package.

For example, running DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run -it --rm haskell:9-slim bash -c "cabal update && cabal install array"; echo $? prints 137 indicating an out-of-memory error (even though I have made 12 GB of memory available to Docker). (I arbitrarily picked the array package since it has no dependencies (except for base), but any package that I've tried has failed.)

The cabal-install version is 3.6.2.0.

I'm using a fully updated M1 MacBook Pro (14-inch, 2021) with an Apple M1 Pro chip, 16 GB of RAM and macOS Monterey.

I have the latest version of Docker Desktop (4.9.1). The Docker version is 20.10.16 (build aa7e414).

I have tried both version 8 and version 9 of the images (with and without “-slim”).

Thanks!

jonkri commented 2 years ago

I noticed that this 137 exit status can occur with apt (with DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run -it --rm debian bash -c "apt update && apt-get install -y cabal-install"; echo $?) and on Arch Linux (with DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run -it --rm archlinux bash -c "pacman --noconfirm -Suy cabal-install && cabal update && cabal install array"; echo $?) as well, so it's not specific to this repository. Closing.

DaQuirm commented 1 year ago

Hi @jonkri, did you manage to find a workaround for this?

jonkri commented 1 year ago

Hi @jonkri, did you manage to find a workaround for this?

Hi, @DaQuirm! I guess it depends on the definition of workaround... 😅 I decided to use a GNU/Linux VPS in the end. I got virtualization with UTM to work as well (installing x86 Arch), but it's very slow, and I never got sharing files between the host and guest system to work in a satisfactory way either. Hope that helps!