When linking goes wrong
I have a Haskell application that needs to be deployed to a server. I took the route of having CircleCI copy the binary after stack install
to a S3 bucket, and have an Ansible playbook that copies the binary to the server and launch it with Upstart. (which I thought routine, having deployed a few apps this way)
Except that the app didn’t quite run. Looking at the upstart logs
...
error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
It’s fair to note at this point that all machines were on the same Ubuntu distro, and the obligatory aptitude install libmysqlclient-dev
was run on all of them: local, CI and server. After reading up a bit on linking and checking the shared libraries on each server, it seems that Circle had libmysqlclient.so.20
installed because they had packages/programs that relied on it.
To get around the issue, I set the instructions to the linker to use the older version in circle.yml
:
post:
- stack install --ghc-options "-optl /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18"
And created a symlink via Ansible.
Linked!