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

stack not found when running on M1 #695

Open
smolendawid opened this issue May 26, 2022 · 6 comments
Open

stack not found when running on M1 #695

smolendawid opened this issue May 26, 2022 · 6 comments

Comments

@smolendawid
Copy link

 => [builder 5/7] ADD . .                                                                                                                                                  0.2s
 => ERROR [builder 6/7] RUN stack setup                                                                                                                                    0.2s
------
 > [builder 6/7] RUN stack setup:
#13 0.186 /bin/sh: 1: stack: not found

I'm trying to build the image on my Apple M1. This is the error I get. It's hard for me to debug, any suggestion what is it about?

@smolendawid
Copy link
Author

The progress I made is adding --platform=linux/amd64 to the build command

docker build --platform=linux/amd64 . -t duckling

returns:

 > [builder 6/7] RUN stack setup:
#13 18.70 Killed

but at least the stack is found.

@jmacedoit
Copy link

Same issue here

@aleneum
Copy link

aleneum commented Aug 23, 2022

If you use colima I found this which solved it for me at least explains the error.

Your VM probably needs more memory. (Edit: A lot more memory it seems)

The default VM created by Colima has 2 CPUs, 2GiB memory and 60GiB storage.

Building this from scratch requires a lot of memory. Try this:

I tried this:

# 50GB RAM and 100GB disk space
colima start --cpu 8 --memory 50 --disk 100

but the build process failed after about an hour with:

#15 3478.6 some                 > [7 of 8] Compiling Data.Some.Newtype
#15 3479.5 some                 > [8 of 8] Compiling Data.Some
#15 3489.5 some                 > copy/register
#15 3495.5 some                 > Installing library in /root/.stack/snapshots/x86_64-linux-tinfo6/8ae098606434194dfb0e7d2b8f74c0d24bfa643930ca121d2cfd7a8f7dd8d4d4/8.8.4/lib/x86_64-linux-ghc-8.8.4/some-1.0.2-4Gh6GmR1iTrGWcPYE7Ik5l
#15 3509.8 some                 > Registering library for some-1.0.2..
#15 3515.3
#15 3515.3 --  While building package haskell-src-exts-1.23.1 (scroll up to its section to see the error) using:
#15 3515.3       /root/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0 build --ghc-options ""
#15 3515.3     Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

I tried --memory 8 but ran into:

#13 234.0 Processed 162800 cabal files
#13 234.3 Package index cache populated
#13 235.5 Killed

With --memory 16 it stopped here:

#13 266.1 Unpacking GHC into /root/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.4.temp/ ...
#13 322.2 Configuring GHC ...
#13 341.6 Installing GHC ...
#13 508.6 Killed

With --memory 32 these were the last lines:

 => ERROR [builder 8/8] RUN stack install                                                                                                                                128.4s
------
 > [builder 8/8] RUN stack install:
#15 40.35 [1 of 2] Compiling Main             ( /root/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /root/.stack/setup-exe-src/setup-mPHDZzAJ.o )
#15 41.19 [2 of 2] Compiling StackSetupShim   ( /root/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /root/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
#15 41.82 Linking /root/.stack/setup-exe-cache/x86_64-linux-tinfo6/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4 ...
#15 57.30 base-compat          > configure
#15 109.7 base-compat          > Configuring base-compat-0.11.2...
#15 119.5 base-compat          > build
#15 119.6 base-orphans         > configure
#15 128.1 Killed
------

@tmbo
Copy link

tmbo commented Sep 19, 2022

@aleneum did you get the build to work?+

@aleneum
Copy link

aleneum commented Sep 19, 2022

Hello @tmbo,

did you get the build to work?+

unfortunately, I was not able to successfully compile duckling for amd64 with an M1 Macbook and colima. Seems like the amd64 emulation with colima just requires too much memory. But ramping up memory for the VM was enough to get docker images with compiled duckling versions to work with botpress which was my actual goal.

@DanBmh
Copy link

DanBmh commented Sep 21, 2022

You might be interested in #703 which provides arm64 docker images.

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

No branches or pull requests

5 participants