Stack has support for building projects inside docker containers
I was wondering how I could use this plugin on projects where the docker integration is enabled because it does not seem to work out of the box.
I:
-
bootstraped a new project with stack new
-
added
to the generated stack.yaml
-
ran stack docker pull and stack setup
And I got the following error when opening my sublime-text:
[SublimeStackIDE][WARN]: Stack-IDE error: Executable named stack-ide not found on path: [...]
This is not surprising as stack-ide-sublime calls stack as a subprocess. stack ide subcommands are run inside docker containers when docker integration is enabled. Those containers are instantiated from fpco/stack-build images which do not contain stack-ide.
I then tried to add a custom docker argument to mount stack-ide related binaries inside the containers:
docker:
enable: true
run-args: ["--volume=/usr/local/bin:/usr/local/bin"]
but then I get a dlopen error:
[SublimeStackIDE][WARN]: Stack-IDE error: /usr/local/bin/ide-backend-server: error while loading shared libraries: libHSide-backend-common-0.10.1-4GFay7LkYLkBlq1EZZjmSI-ghc7.10.2.so: cannot open shared object file: No such file or directory
Indeed, a lot of the shared library dependencies are missing in the fpco/stack-build images as shown by:
docker run --rm \
-v /usr/local/bin:/usr/local/bin \
fpco/stack-build:lts-3.19 \
ldd /usr/local/bin/ide-backend-server \
| grep "not found" \
| wc -l
53
edit:
I overlooked the fact that stack was also sharing the /home/user/.stack directory with docker containers. So if we retry the command above:
docker run --rm \
-v /usr/local/bin:/usr/local/bin \
-v $HOME/.stack:$HOME/.stack \
fpco/stack-build:lts-3.19 \
ldd /usr/local/bin/ide-backend-server \
| grep "not found"
libHSide-backend-common-0.10.1-4GFay7LkYLkBlq1EZZjmSI-ghc7.10.2.so => not found
there is only one missing dependency left (the one I mentioned earlier):
Stack has support for building projects inside docker containers
I was wondering how I could use this plugin on projects where the docker integration is enabled because it does not seem to work out of the box.
I:
bootstraped a new project with
stack newadded
to the generated
stack.yamlran
stack docker pullandstack setupAnd I got the following error when opening my sublime-text:
This is not surprising as
stack-ide-sublimecallsstackas a subprocess.stack idesubcommands are run inside docker containers when docker integration is enabled. Those containers are instantiated from fpco/stack-build images which do not contain stack-ide.I then tried to add a custom docker argument to mount
stack-iderelated binaries inside the containers:but then I get a
dlopenerror:Indeed, a lot of the shared library dependencies are missing in the
fpco/stack-buildimages as shown by:docker run --rm \ -v /usr/local/bin:/usr/local/bin \ fpco/stack-build:lts-3.19 \ ldd /usr/local/bin/ide-backend-server \ | grep "not found" \ | wc -l 53edit:
I overlooked the fact that stack was also sharing the
/home/user/.stackdirectory with docker containers. So if we retry the command above:docker run --rm \ -v /usr/local/bin:/usr/local/bin \ -v $HOME/.stack:$HOME/.stack \ fpco/stack-build:lts-3.19 \ ldd /usr/local/bin/ide-backend-server \ | grep "not found" libHSide-backend-common-0.10.1-4GFay7LkYLkBlq1EZZjmSI-ghc7.10.2.so => not foundthere is only one missing dependency left (the one I mentioned earlier):