awslabs/aws-c-common

Can't compile with musl-libc (aka Alpine Linux)

m4c0 opened this issue · 1 comments

m4c0 commented

A bunch of systems does not use provide execinfo.h in their libc. Android and Alpine are two major Linux players without such header. Android was fixed in #275 but Alpine still doesn't work. Here's a minimal Dockerfile to replicate the issue:

FROM alpine
RUN apk add --no-cache --virtual .deps cmake git build-base
RUN git clone --depth=1 https://github.com/awslabs/aws-c-common
RUN mkdir build && cd build && cmake ../aws-c-common && make

Eventually, that fails with this message:

In file included from /aws-c-common/tests/array_list_test.c:19:
/aws-c-common/include/aws/testing/aws_test_harness.h:448:14: fatal error: execinfo.h: No such file or directory
 #    include <execinfo.h>
              ^~~~~~~~~~~~
compilation terminated.

I'm pretty sure there are more platforms without this header, so it would be good to either:

  1. Add an option to disable testing; or
  2. Extend the #ifndef ANDROID check to be something like #if HAS_EXECINFO_H

Note: I'm aware I could add libexecinfo to the apk add, but that will not solve the root issue. It doesn't resolve the issue in Alpine either, since it adds the execinfo.h file, but it doesn't add -lexecinfo to the linker options.

This should be addressed in 0.3.7. Please reopen if not the case.