heroku / heroku-geo-buildpack

37 stars 26 forks source link

Strip symbols from compiled assets before creating tarballs #11

Closed klette closed 4 years ago

klette commented 4 years ago

By default, GDAL includes debug symbols in the compiled libraries and binaries.

This patch runs alls libraries and binaries through strip -s before gzipping for S3 upload.

GDAL also got an extra configure flag to remove internal symbols during the build, shaving another MB from the archives.

Looking at the size of the tarballs we see the following changes:

Baseline master:

MB File
2 /tmp/tmp.35TOH895Ns/PROJ-5.2.0.tar.gz
56 /tmp/tmp.VDi6KURfEc/GDAL-2.4.0.tar.gz
10 /tmp/tmp.XH8LQVrIen/GEOS-3.7.2.tar.gz
68 Total

Baseline + strip:

MB File
17 /tmp/tmp.Ck3svpj3AV/GDAL-2.4.0.tar.gz
1 /tmp/tmp.nkBO1r6GDV/PROJ-5.2.0.tar.gz
1 /tmp/tmp.tvBBt4zCRO/GEOS-3.7.2.tar.gz
19 Total

Baseline + strip + --with-hide-internal-symbols:

MB File
16 /tmp/tmp.Ck3svpj3AV/GDAL-2.4.0.tar.gz
1 /tmp/tmp.nkBO1r6GDV/PROJ-5.2.0.tar.gz
1 /tmp/tmp.tvBBt4zCRO/GEOS-3.7.2.tar.gz
18 Total

The same strategy for reducing the size of the compiled assets is used by GDAL upstream for their official Docker images.

klette commented 4 years ago

Hi!

I've updated this PR replacing the change in compiler flags to using strip for removing the symbols.

This aligns with the way GDAL upstream is creating their official Docker images.

KevinBrolly commented 4 years ago

This is awesome @klette - Many thanks 👍