stack-ide-sublime
stack-ide-sublime copied to clipboard
How to use stack-ide-sublime on docker enabled projects ?
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
docker: enable: true
to the generated
stack.yaml
-
ran
stack docker pull
andstack 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):