Description
Hello there!
A common problem we've noticed if folks trying to deploy a Gleam/Erlang application using OCI/Docker containers and being confused by their build failing when unable to compile a NIF, typically one used for hashing passwords.
To fix the issue they need to install whatever package is required to add make
, such as build-essential
on Alpine Linux.
This may be slightly unusual a feature for rebar3, but I thought we could greatly help newcomers to Erlang or containers if we special cased this particular error to print helpful information on how to fix the problem.
Here's an error as it exists today:
2.129 ===> Fetching rebar3_hex v7.0.9
2.216 ===> Fetching hex_core v0.10.3
2.256 ===> Fetching verl v1.1.1
2.289 ===> Analyzing applications...
2.424 ===> Compiling verl
2.638 ===> Compiling hex_core
3.395 ===> Compiling rebar3_hex
3.605 ===> Fetching rebar3_ex_doc v0.2.26
3.777 ===> Analyzing applications...
3.787 ===> Compiling rebar3_ex_doc
3.940 sh: exec: line 0: make: not found
3.940 ===> Hook for compile failed!
Perhaps it could look something like this for make
specifically.
2.129 ===> Fetching rebar3_hex v7.0.9
2.216 ===> Fetching hex_core v0.10.3
2.256 ===> Fetching verl v1.1.1
2.289 ===> Analyzing applications...
2.424 ===> Compiling verl
2.638 ===> Compiling hex_core
3.395 ===> Compiling rebar3_hex
3.605 ===> Fetching rebar3_ex_doc v0.2.26
3.777 ===> Analyzing applications...
3.787 ===> Compiling rebar3_ex_doc
3.940 sh: exec: line 0: make: not found
The application `jargon` calls the `make` program as part of its
build process, but it could not be found. Is it installed?
If you are building your project using a Dockerfile you will need
to add `RUN` step to install `make` and any other build dependencies.
3.940 ===> Hook for compile failed!
The If you are building...
sentence could be omitted if the OS is not Linux, as we know it's not an OCI container in that case.
What do you think? :)
Thank you,
Louis