Skip to content

Commit

Permalink
Add GCC to runtime dependencies
Browse files Browse the repository at this point in the history
Ruby 2.6.0 ships with a JIT (just in time compiler) that utilizes GCC (or any other `cc` such as clang) at runtime. This version of Ruby will be released on December 25th, 2018 and Heroku needs to provide support for this feature out of the box.

## Background

The design alternatives can be found in this document

https://docs.google.com/document/d/1q5yEpRddUU2JPynESmffI_BpLDW4XaBgO7iyJE-mwio/edit?usp=sharing

## This PR

This PR adds the `gcc` package to Heroku-16 and Heroku-18 runtime images.

## Size cost

Adding the `gcc` package increases the runtime stack image by about 84mb:

Before adding `gcc`

```
-----> Size breakdown...
# ...
       ubuntu:18.04                      85.8MB
       heroku/heroku:18                  428MB
       heroku/heroku:18-build            805MB
```

After adding `gcc`

```
-----> Size breakdown...
# ...
       ubuntu:18.04                      85.8MB
       heroku/heroku:18                  512MB
       heroku/heroku:18-build            805MB
```

It looks like this works with only `gcc`, however if we end up needing `build-essential` then the cost would increase by 64MB to 576MB.

## Testing JIT on the stack images testing

On a currently running Heroku-18 dyno with Ruby 2.6:

```
$ hs run bash -a infinite-everglades-58502
~ $ ruby -v
ruby 2.6.0preview3 (2018-11-06 trunk 65578) [x86_64-linux]
~ $ ruby -e "def a; end; def b; end; a; a; a; a; a; a; a;  puts 'done'" --jit --jit-verbose=1
MJIT: Error in execv: /usr/bin/gcc
MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker...
done
```

> Note: The warnings in the output indicate gcc could not be found

On a local docker image with `gcc` available:

```
$ bin/build.sh heroku-18 heroku/heroku:18 heroku/heroku:18-build
# ...
$ docker run -i -t heroku/heroku:18 /bin/bash
root@4437f834d502:/# mkdir -p vendor/ruby-2.6.0
root@4437f834d502:/# cd vendor/ruby-2.6.0
root@4437f834d502:/vendor/ruby-2.6.0# curl https://heroku-buildpack-ruby.s3.amazonaws.com/heroku-18/ruby-2.6.0.tgz -s -o - | tar zxf -
root@4437f834d502:/vendor/ruby-2.6.0# bin/ruby -e "def a; end; def b; end; a; a; a; a; a; a; a;  puts 'done'" --jit --jit-verbose=1
done
Successful MJIT finish
```
 
> Note: The output indicates that MJIT was successful

For more output you can also apply `--jit-wait` which will force mjit to run synchronously (instead of in a background thread).

cc/ @hone @hunterloftis
  • Loading branch information
schneems committed Nov 18, 2018
1 parent 6598dea commit 03b38d7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

[![Build Status](https://travis-ci.org/heroku/stack-images.svg?branch=master)](https://travis-ci.org/heroku/stack-images)

This repository holds recipes for building [Heroku stack images](https://devcenter.heroku.com/articles/stack). The recipes are also rendered into Docker images that are available on Docker Hub:
This repository holds recipes for building [Heroku stack images](https://devcenter.heroku.com/articles/stack). The recipes are also rendered into Docker images that are available on Docker Hub:

* [Cedar-14 Docker image](https://registry.hub.docker.com/u/heroku/cedar/)
* [Heroku-16 Docker image](https://registry.hub.docker.com/u/heroku/heroku/)

### Learn more

* [Lists of packages installed on current stacks](https://devcenter.heroku.com/articles/stack-packages)
* [Stack update policy](https://devcenter.heroku.com/articles/stack-update-policy)
* [Stack update policy](https://devcenter.heroku.com/articles/stack-update-policy)

See [BUILD.md](BUILD.md) for instructions on how to build the images yourself.
1 change: 1 addition & 0 deletions heroku-16/bin/heroku-16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ apt-get install -y --force-yes \
curl \
dnsutils \
ed \
gcc \
git \
imagemagick \
iputils-tracepath \
Expand Down
24 changes: 24 additions & 0 deletions heroku-16/installed-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ base-files
base-passwd
bash
bind9-host
binutils
bsdutils
bzip2
ca-certificates
ca-certificates-java
coreutils
cpp
cpp-5
curl
dash
dbus
Expand All @@ -31,6 +34,8 @@ fontconfig
fontconfig-config
fonts-dejavu-core
fonts-lato
gcc
gcc-5
gcc-5-base
gcc-6-base
geoip-database
Expand Down Expand Up @@ -65,8 +70,10 @@ libacl1
libapparmor1
libapt-inst2.0
libapt-pkg5.0
libasan2
libasn1-8-heimdal
libatm1
libatomic1
libattr1
libaudit-common
libaudit1
Expand All @@ -78,11 +85,15 @@ libblkid1
libbsd0
libbz2-1.0
libc-bin
libc-dev-bin
libc6
libc6-dev
libcairo2
libcap-ng0
libcap2
libcap2-bin
libcc1-0
libcilkrts5
libcomerr2
libcroco3
libcryptsetup4
Expand Down Expand Up @@ -115,6 +126,7 @@ libffi6
libfftw3-double3
libfontconfig1
libfreetype6
libgcc-5-dev
libgcc1
libgcrypt20
libgd3
Expand Down Expand Up @@ -149,6 +161,8 @@ libisc-export160
libisc160
libisccc140
libisccfg140
libisl15
libitm1
libjbig0
libjbig2dec0
libjpeg-turbo8
Expand All @@ -163,6 +177,7 @@ libkrb5support0
liblcms2-2
libldap-2.4-2
liblqr-1-0
liblsan0
libltdl7
liblwres141
liblz4-1
Expand All @@ -175,7 +190,10 @@ libmcrypt4
libmemcached11
libmnl0
libmount1
libmpc3
libmpdec2
libmpfr4
libmpx0
libmysqlclient20
libncurses5
libncursesw5
Expand Down Expand Up @@ -205,6 +223,7 @@ libpython2.7-stdlib
libpython3-stdlib
libpython3.5-minimal
libpython3.5-stdlib
libquadmath0
librabbitmq4
libreadline6
libroken18-heimdal
Expand Down Expand Up @@ -232,6 +251,8 @@ libthai-data
libthai0
libtiff5
libtinfo5
libtsan0
libubsan0
libudev1
libusb-0.1-4
libustr-1.0-1
Expand All @@ -257,12 +278,15 @@ libxslt1.1
libxtables11
libyaml-0-2
libzip4
linux-libc-dev
locales
login
lsb-base
lsb-release
make
makedev
manpages
manpages-dev
mawk
mime-support
mount
Expand Down
1 change: 1 addition & 0 deletions heroku-18/bin/heroku-18.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ apt-get install -y --no-install-recommends \
ed \
file \
fontconfig \
gcc \
geoip-database \
ghostscript \
git \
Expand Down
23 changes: 23 additions & 0 deletions heroku-18/installed-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ base-files
base-passwd
bash
bind9-host
binutils
binutils-common
binutils-x86-64-linux-gnu
bsdutils
bzip2
ca-certificates
ca-certificates-java
coreutils
cpp
cpp-7
curl
dash
debconf
Expand All @@ -29,6 +34,9 @@ findutils
fontconfig
fontconfig-config
fonts-dejavu-core
gcc
gcc-7
gcc-7-base
gcc-8-base
geoip-database
ghostscript
Expand Down Expand Up @@ -62,15 +70,18 @@ libacl1
libapt-inst2.0
libapt-pkg5.0
libargon2-0
libasan4
libasn1-8-heimdal
libassuan0
libatomic1
libattr1
libaudit-common
libaudit1
libavahi-client3
libavahi-common-data
libavahi-common3
libbind9-160
libbinutils
libblkid1
libbsd0
libbz2-1.0
Expand All @@ -79,6 +90,8 @@ libc6
libcairo2
libcap-ng0
libcap2
libcc1-0
libcilkrts5
libcom-err2
libcroco3
libcups2
Expand Down Expand Up @@ -107,6 +120,7 @@ libffi6
libfftw3-double3
libfontconfig1
libfreetype6
libgcc-7-dev
libgcc1
libgcrypt20
libgd3
Expand Down Expand Up @@ -141,6 +155,8 @@ libirs160
libisc169
libisccc160
libisccfg160
libisl19
libitm1
libjbig0
libjbig2dec0
libjpeg-turbo8
Expand All @@ -156,6 +172,7 @@ liblcms2-2
libldap-2.4-2
libldap-common
liblqr-1-0
liblsan0
libltdl7
liblwres160
liblz4-1
Expand All @@ -168,7 +185,10 @@ libmcrypt4
libmemcached11
libmnl0
libmount1
libmpc3
libmpdec2
libmpfr6
libmpx2
libmysqlclient20
libncurses5
libncursesw5
Expand Down Expand Up @@ -198,6 +218,7 @@ libpython2.7-stdlib
libpython3-stdlib
libpython3.6-minimal
libpython3.6-stdlib
libquadmath0
librabbitmq4
libreadline7
libroken18-heimdal
Expand Down Expand Up @@ -226,6 +247,8 @@ libthai-data
libthai0
libtiff5
libtinfo5
libtsan0
libubsan0
libudev1
libunistring2
libuuid1
Expand Down

0 comments on commit 03b38d7

Please sign in to comment.