Compile errors on Alpine Linux after upgrading

Affected versions

  • AppSignal for Ruby gem versions 2.4.x and higher.
  • AppSignal for Elixir package versions 1.4.x and higher.
  • Systems: In combination with hosts running Alpine Linux.

Description

In order to fix another known issue (DNS timeouts) AppSignal Ruby gem v2.4.x, AppSignal Elixir package v1.4.x, and higher versions started shipping separate builds for Alpine Linux.

When installing an AppSignal integration, the installer will try to detect the system architecture for which it needs to download the AppSignal extension. If the detection mismatches the wrong extension build will be downloaded and installed. The installation will fail and AppSignal will not work.

Our Ruby gem will not raise an error, but log the problem to the install.log file in the ext/ directory in the AppSignal gem directory.

The Elixir package will raise an error and halt any compilation. See issue #273 on the appsignal-elixir repo for more details on the specific error.

Mismatching architecture

This problem occurs because the AppSignal system architecture detection mismatches. It will detect, or fall back on, a libc build, rather than the musl build for Alpine Linux.

The AppSignal Ruby gem detects the system architecture by asking the ldd program whether it uses libc or musl. If ldd is not available or not allowed to be called by the user installing the AppSignal Ruby gem, it falls back on the libc build.

The AppSignal Elixir package detects the system architecture by asking Erlang's system_info function for which architecture it has been compiled. If this function returns the wrong architecture type, AppSignal will assume the wrong architecture and try to install it for that architecture.

For Elixir this has been reported with the bitwalker/alpine-elixir Docker image. This Docker image is based on the bitwalker/alpine-erlang which reports the wrong system architecture. A fix was merged to have these newer images from this vendor report the correct system architecture. We expect newer versions of this image than tag 20.1.3 to be released with this fix.

Symptoms

  • During installation of AppSignal Ruby gem v2.4.x or any higher version, on Alpine Linux the installation will log an error. AppSignal will not report any data for your app.
  • During installation of AppSignal for Elixir package v1.4.x, or any higher version, on Alpine Linux the installation will exit with an error.

Solution

There is no permanent solution available, as the problem is not entirely the fault of the AppSignal integrations. See workaround.

If you think the system architecture detection for Ruby or Elixir is incomplete or broken for your system, please let us know.

Workaround

APPSIGNAL_BUILD_FOR_MUSL environment variable

Use the APPSIGNAL_BUILD_FOR_MUSL environment variable when compiling your app or installing dependencies. This will force the system architecture detection to pick the musl build over the libc build.

For more information about support for Alpine Linux, please see our Operating Systems page for Alpine Linux.

# For Ruby
export APPSIGNAL_BUILD_FOR_MUSL=1
gem install appsignal
# or with Bundler
bundle install
 
# For Elixir
export APPSIGNAL_BUILD_FOR_MUSL=1
mix deps.get
mix compile

Downgrading

It's also possible to downgrade to an older version of the AppSignal Ruby gem or Elixir package. Ruby gem versions 2.1.x - 2.3.x and Elixir package v0.10.x - v1.3.x will use a shared extension build for libc and musl and no system architecture mismatch can occur.

If you do find it necessary to downgrade to an older AppSignal integration version, please contact us so we can fix your issue.

Want to help us improve this documentation page?

Create a pull request

Need more help?

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

Contact us

Start a trial - 30 days free

AppSignal is a great way to monitor your Ruby, Elixir & Node.js applications. Works great with Rails, Phoenix, Express and other frameworks, with support for background jobs too. Let's improve your apps together.

Start a trial