New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling PassengerAgent on Alpine Linux / musl libc fails #1870

Closed
felixbuenemann opened this Issue Sep 9, 2016 · 9 comments

Comments

Projects
None yet
4 participants
@felixbuenemann

felixbuenemann commented Sep 9, 2016

Currently (5.0.30) compiling the Passenger Agent on Alpine Linux fails, because the source code assumes that running on linux means glibc is used so the check for LIBC_HAS_BACKTRACE_FUNC wrongly detect backtrace support on musl, which then fails because execinfo.h does not exist.

A possible solution could be to check for the __GNU_LIBRARY__ macro instead of __linux__ when setting the LIBC_HAS_BACKTRACE_FUNC define in src/agent/Shared/Base.cpp:51.

Way to reproduce with docker:

docker run --rm -it alpine:3.4 /bin/sh
apk update
apk add ruby ruby-irb ruby-rake ruby-dev build-base linux-headers curl curl-dev pcre-dev
gem install --no-document passenger
passenger-config install-standalone-runtime --auto
# Compilation fails with:
src/agent/Shared/Base.cpp:55:23: fatal error: execinfo.h: No such file or directory

I'm currently working around the issue with the following hack:

echo "#undef LIBC_HAS_BACKTRACE_FUNC" > /usr/include/execinfo.h
@FooBarWidget

This comment has been minimized.

Member

FooBarWidget commented Sep 12, 2016

Looks good to me. @CamJN can you make the change?

CamJN added a commit that referenced this issue Sep 12, 2016

Fixes compilation on Linux when a non-glibc C library is in use. Closes
GH-1870.

Fixes compilation on Linux by more explicitely detecting when a non-glibc C library (such as musl) is in use. This is neccesary for Alpine Linux and other minimal Linux distros, which are commonly used with Docker.
@nikolay

This comment has been minimized.

nikolay commented Sep 19, 2016

@FooBarWidget Should we use the workaround above for the time being?

@FooBarWidget

This comment has been minimized.

Member

FooBarWidget commented Sep 20, 2016

Yes the workaround is fine.

@nikolay

This comment has been minimized.

nikolay commented Sep 21, 2016

@FooBarWidget Unfortunately, it didn't work for me due to libcurl issue. The only thing that works for me is actually by using the edge repository (v3.5), which has libexecinfo in it:

echo "http://alpine.gliderlabs.com/alpine/edge/main" > /etc/apk/repositories
@felixbuenemann

This comment has been minimized.

felixbuenemann commented Sep 21, 2016

@nikolay What do mean by "libcurl issue"?

Here's a complete Dockerfile for a rails app based on alpine:3.4 that works for me:

https://gist.github.com/ab7b6256e5bd1818cf8679b88e1c11b3

@nikolay

This comment has been minimized.

nikolay commented Sep 23, 2016

@felixbuenemann The issue is that the prerequisites check of Passenger failed for libcurl. Let me try your Dockerfile. Maybe the issue is that I used FROM ruby:alpine instead of using the base Alpine Linux image.

@felixbuenemann

This comment has been minimized.

felixbuenemann commented Sep 23, 2016

You are likely missing the curl-dev package.

@nikolay

This comment has been minimized.

nikolay commented Sep 23, 2016

@felixbuenemann I do have it - it said thought that it is installed, but not usable. I think this Ruby Dockerfile could be used as a base as it's the official one and it still uses alpine:3.4 as the base.

@OnixGH OnixGH removed the SupportCentral label Oct 14, 2016

@OnixGH OnixGH added this to the 5.1.0 milestone Oct 14, 2016

@CamJN CamJN closed this in 06d0fe7 Oct 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment