Using Rusoto on Ubuntu 18.04.03 LTS

2019/09/18

Just today I was piffling about with Rust to do some very simple AWS commands (nothing you can’t already do with the AWS command line tools). Getting up and started with Rusoto on my laptop was a little tricky though. Rusoto requires the OpenSSL libraries and headers as a dependency, and they’re not in the usual place(s) on Ubuntu - or at least not on 18.04.03 LTS which is what I’m currently using on that machine.

A bit of fiddling about and I got it working though - I ended up doing this in two steps; firstly I symlinked the necessary header files into an appropriate directory within my development directory, and then I updated the necessary environment variables to point to this directory and the lib directory. So:

# Install the libraries
sudo apt install openssl libssl-dev

# Symlink all the headers into a directory
mkdir include
cd include
ln -s /usr/include/x86_64-linux-gnu/openssl/opensslconf.h
for file in /usr/include/openssl/* ; do ln -s $file ; done

# Set up the environment variables pointing to the binary and headers
export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
export OPENSSL_INCLUDE_DIR=/home/dcminter/development/aws-rust-tool/include

Obviously you’ll need to customize that last line for your actual development directory! You’ll also probably want to have those last two files in a convenient script to source before running cargo (I don’t think cargo can set them for you). Is there a better way to do this? Probably, and if I come across it I’ll link to it here. But for now - it works.

Happy hacking!