Issue with building Elixir and beam on Alpine Linux
Asked Answered
M

1

15

I am running a build with Alpine linux 3.12 and build fails with the following output indicating an error building beam and ERTS with a C++ dependency.

Error relocating /opt/app/erts-12.3.2.1/bin/beam.smp: _ZSt28__throw_bad_array_new_lengthv: symbol not found
Error relocating /opt/app/erts-12.3.2.1/bin/beam.smp: pthread_getname_np: symbol not found

So far I have been looking at threads on these two specific errors with various threads as to the failure.

Is there some dependency that may need updating?

Minhminho answered 13/6, 2022 at 21:59 Comment(0)
I
23

It may be caused by an update of the Elixir image in elixir:1.12.3-alpine, which bumped the base image from alpine:3.14 to alpine:3.16.

If you build the Elixir release from elixir:1.12.3-alpine and try to run the release on an older alpine, you will hit this error because of the runtime image has an older musl version.

To fix it, you can upgrade the runtime image to alpine:3.16.

Intercellular answered 14/6, 2022 at 8:25 Comment(4)
Alternatively, you can find the digest for a working version of the elixir:1.12.3-alpine, and build your release from that: FROM elixir:1.12.3-alpine@sha256:<DIGEST>.Intercellular
Awesome! The upgrade to alpine:3.16 resolved the issue. Thank you for the informed and detailed answer!Minhminho
I also had FROM --platform=linux/amd64 hexpm/elixir:1.13.4-erlang-25.0.2-alpine-3.16.0 AS build and then later in that Dockerfile FROM alpine:3.13.3 AS app, which is exactly the issue you well described.Sanious
@Intercellular Thank you very much. out of curiosity: How am I able to find the digest sha of an older image? In docker hub, I can only find the digest of the current docker image that (unfortunately) breaks my project, see hub.docker.com/_/elixir/tags?page=1&name=1.11-alpineSycophancy

© 2022 - 2024 — McMap. All rights reserved.