Skip to content

Issue #293: Bootstrap on Alpine#296

Merged
SpamapS merged 1 commit intogearman:masterfrom
esabol:issue-293-bootstrap-on-alpine-redux
Aug 27, 2020
Merged

Issue #293: Bootstrap on Alpine#296
SpamapS merged 1 commit intogearman:masterfrom
esabol:issue-293-bootstrap-on-alpine-redux

Conversation

@esabol
Copy link
Member

@esabol esabol commented Aug 1, 2020

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 or BITS_PER_LONG or LONG_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 or BITS_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

@esabol
Copy link
Member Author

esabol commented Aug 1, 2020

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.

Copy link
Collaborator

@p-alik p-alik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@SpamapS SpamapS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wish we had some CI for Alpine, to lock this in.

@SpamapS SpamapS merged commit 67407a4 into gearman:master Aug 27, 2020
@esabol
Copy link
Member Author

esabol commented Aug 27, 2020

I do wish we had some CI for Alpine, to lock this in.

It’s on my to-do list, along with macOS.

@esabol esabol deleted the issue-293-bootstrap-on-alpine-redux branch August 27, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants