theam / aws-lambda-haskell-runtime

⚡Haskell runtime for AWS Lambda
https://theam.github.io/aws-lambda-haskell-runtime/
Other
270 stars 48 forks source link

Example fails to build on macOS Mojave #4

Closed mezzomondo closed 5 years ago

mezzomondo commented 5 years ago

Hi,

I'm following the guide on Medium, but after pulling the Docker image make fails to complete with this error:

$ make
Warning (added by new or init): Some packages were found to be incompatible with the resolver and have been left commented out in the packages section.
You can omit this message by removing it from stack.yaml

Warning (added by new or init): Some packages were found to be incompatible with the resolver and have been left commented out in the packages section.
You can omit this message by removing it from stack.yaml

random-1.1: configure
... (some stuff)
text-1.2.3.1: copy/register
Progress 9/75
Received ExitFailure 1 when running
Raw command: /opt/ghc/8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /Users/mikifossati/.stack/snapshots/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/lts-12.13/8.4.3/pkgdb describe --simple-output text --expand-pkgroot
Standard error:

ghc-pkg: getCurrentDirectory:getWorkingDirectory: does not exist (Current working directory no longer exists)

Received ExitFailure 1 when running
Raw command: /opt/ghc/8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /Users/mikifossati/.stack/snapshots/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/lts-12.13/8.4.3/pkgdb describe --simple-output th-abstraction --expand-pkgroot
Standard error:

ghc-pkg: getCurrentDirectory:getWorkingDirectory: does not exist (Current working directory no longer exists)

Received ExitFailure 1 when running
Raw command: /usr/local/bin/docker start -a -i df8a50e7914c42830b499f6c7158d9087d9b2b531d40c9adc9e482b1563e38fc

make: *** [all] Error 1

Any suggestion? In case I'm happy to help.

Thank you,

(M)

NickSeagull commented 5 years ago

Looks related to #3 , have you added the appropriate content to your stack.yaml as in the guide? 😄

mezzomondo commented 5 years ago

Actually it seems so:

$ cat stack.yaml
...(stuff)
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
#    git: https://github.com/commercialhaskell/stack.git
#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#  subdirs:
#  - auto-update
#  - wai
packages:
- .

# Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
extra-deps:
- aws-lambda-haskell-runtime-1.0.4
...(more stuff)
NickSeagull commented 5 years ago

How did you install Stack? Was it with the proposed command at the guide? If not, could you try updating it with stack upgrade --git (or update cant remember)

mezzomondo commented 5 years ago

The method curl -sSL https://get.haskellstack.org/ | sh installs stack version 1.9.3 (git rev. 40cf7b37526b86d1676da82167ea8758a854953b) that gives me the error getCurrentDirectory:getWorkingDirectory: does not exist. stack upgrade --git installs version 1.10.0 (git rev. 8c29d445aab82fdb8ed805662115ec79ac95b9a6) that gives

$ make
Downloading Docker-compatible stack executable
Control.Exception.Safe.throwString called with:

Could not get release information for Stack from: https://api.github.com/repos/commercialhaskell/stack/releases/tags/v1.10.0
Called from:
  throwString (src/Stack/Setup.hs:1845:14 in stack-1.10.0-1xz2mm9y5muEhDOsnven1x:Stack.Setup)

make: *** [all] Error 1

that makes sense because last release is 1.9.3.

Now my system is a bit of a mess, I'll clean it up and get back if something changes.

NickSeagull commented 5 years ago

Any update on this? 🙂

mezzomondo commented 5 years ago

Hi, yes, I just tried to build using directly Docker as in docker run --rm -v $HOME/.stack:/root/.stack -v $(pwd):$(pwd) -w $(pwd) -i -t fpco/stack-build:lts-12.13 stack build and the project builds with no issues, so it's definitely something related to stack itself. Will be back after some more testing.

mezzomondo commented 5 years ago

It's a memory problem, cleaning all up and starting from scratch, doing stack build --docker after a couple of

Received ExitFailure 1 when running
Raw command: /usr/local/bin/docker start -a -i ecdb74bf6d0c0b31a1802b7efb84ba799f6d693023af9869eced3887fe41f10f

I ended up with:

--  While building package Cabal-2.2.0.1 using:
      ...(stuff)
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

It didn't happen using Docker directly, let me double check both ways, it'll take some time.

mezzomondo commented 5 years ago

Ok, so my final report :-)

On a 16GB machine no problems whatsoever, on my 8GB laptop I need to be careful, it works only after a reboot and with no other containers running, otherwise the building process randomly fails.

I think you can close the issue now, thank you very much.

NickSeagull commented 5 years ago

Thanks @mezzomondo ! Please report if you find any solution for that so we can add it to the docs! :D