Closed esabol closed 4 years ago
Dockerfile I used for testing:
FROM alpine:latest
# Install packages
RUN apk add --no-cache \
musl-dev gcc g++ autoconf automake m4 git libtool make bash py3-sphinx \
file util-linux-dev libuuid libevent-dev gperf boost-dev openssl-dev
# Switch to non-root user
RUN adduser --disabled-password --shell /bin/bash gearman
USER gearman
ARG GEARMAN_REPO=https://github.com/esabol/gearmand
RUN cd /tmp && git clone --depth 1 --branch issue-293-bootstrap-on-alpine-redux ${GEARMAN_REPO}.git
WORKDIR /tmp/gearmand
RUN git reset --hard 6fe74214a68367f95467df970038237c5e44b5d7
RUN ./bootstrap.sh -a
RUN ./configure --enable-ssl 2>&1 | tee ./configure.log
RUN make 2>&1 | tee ./build.log
RUN make test 2>&1 | tee ./test.log
It bootstraps and builds fine. All tests pass.
I do wish we had some CI for Alpine, to lock this in.
It’s on my to-do list, along with macOS.
This PR addresses issue #293 and adds support for bootstrapping on Alpine Linux.
I did some additional research into
__WORDSIZE
, and what I saw was a confusing mess, as usual whenever I seem to look into C preprocessor macros. I saw a lot of recommendations to use__BITS_PER_LONG
orBITS_PER_LONG
orLONG_BITS
instead. Plus a whole host of other methods. I eventually came across this Alpine patch for libmemcached:https://git.alpinelinux.org/aports/plain/main/libmemcached/musl-fixes.patch
That at least gave me confidence to add some checks for
LONG_BITS
. Should I add__BITS_PER_LONG
orBITS_PER_LONG
too? Am I overcomplicating this? Probably!And I think you need to
#include <limits.h>
. I didn't see an#include
for that, but maybe I missed it somewhere. Anyway, I added it, mainly because the above Alpine patch also had it. What do you think?References: https://www.linuxquestions.org/questions/programming-9/c-preprocessor-define-for-32-vs-64-bit-long-int-4175658579/ https://www.google.com/search?q=c+preprocessor+detect+%22wordsize%22+site:stackoverflow.com