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!

 
0
Kudos
 
0
Kudos

Now read this

Having some fun (and pain) with generics

Decided to try and wrap my head around generic programming and ended up sinking too much time trying to understand (or not?) some of the basic ideas. Just for fun, I tried to think how it would be possible to go from a homogenous list... Continue →