Skip to content

Compiling LibGSL 1.4 on Heroku

Jibran Kalia edited this page Oct 30, 2021 · 1 revision

In order to successfully install LibGSL we first need a binary for the correct version built in Heroku's environment.

Bash into your app

heroku run bash -a HEROKU_APP_NAME

Move to a tmp directory

cd tmp

Get the download url for the correct GSL version

This guide is going to use version 1.4 but any version should work similar

curl -O "https://ftp.gnu.org/gnu/gsl/gsl-1.4.tar.gz"

Unzip

tar xzvf gsl-1.4.tar.gz
cd gsl-1.4

Install the binary

./configure --prefix ~/tmp/binary

This will build the binary on the path ~/tmp/binary. This should have an output similar to:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output... a.out

Actually, make the binary:

make
make install

This should output similar to:

make  all-recursive
make[1]: Entering directory '/app/tmp/gsl-1.4'
Making all in gsl
make[2]: Entering directory '/app/tmp/gsl-1.4/gsl'
rm -f gsl*.h
HEADERLIST="../gsl*.h ../*/gsl*.h"; \
for h in $HEADERLIST; do \
  BASENAME=`basename $h`; \
  test -e $BASENAME || ln -s $h $BASENAME; \
done
make[2]: Leaving directory '/app/tmp/gsl-1.4/gsl'
Making all in utils

Zip the binary

The binary should be in /tmp/binary

tar czf gsl-1.4-binary.tar.gz binary/

Upload it to transfer.sh

This is an easy way to get the compiled from Heroku's servers to our local machine. You can also use the method outlined here: https://devcenter.heroku.com/articles/exec#copying-files-from-a-dyno

curl -H "Max-Days: 5" --upload-file gsl-1.4-binary.tar.gz  https://transfer.sh/gsl-1.4-binary.tar.gz

Copy the URL outputted.

Download the zipped file on your laptop

curl 'https://transfer.sh/fIMzwW/gsl-1.4-binary.tar.gz' -o gsl-1.4.tar.gz 

Upload to S3

Upload the file to S3. Make sure that it is public. Copy the S3 download url.