Skip to content
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 on alpine #79

Closed
waghanza opened this issue Nov 6, 2019 · 17 comments
Closed

Compiling on alpine #79

waghanza opened this issue Nov 6, 2019 · 17 comments

Comments

@waghanza
Copy link
Contributor

waghanza commented Nov 6, 2019

Hi @ohler55,

Trying to install on alpine, I have

dtime.c:11:31: error: 'CLOCK_REALTIME' undeclared (first use in this function); did you mean 'CLOCK_REALTIME_COURSE'?
 #define CLOCK_REALTIME_COURSE CLOCK_REALTIME

while using gem install agoo

I'm on

  • ruby 2.6
  • gem 3.06

Regards,


edit : maybe related to #14

@ohler55
Copy link
Owner

ohler55 commented Nov 6, 2019

That is odd. Was that the only error or were there complaints about missing header files as well?

@waghanza
Copy link
Contributor Author

waghanza commented Nov 6, 2019

This the only missing thing in the-benchmarker/web-frameworks#1968.

I have update the full log in https://gist.github.com/bedc4fb00ab91574fb91b53958214ba5

  • Alpine Linux 3.10
  • gcc (Alpine 8.3.0) 8.3.0

@ohler55
Copy link
Owner

ohler55 commented Nov 6, 2019

Thanks. Has something changed since the last time? It looks like the headers are no longer the same and no longer POSIX.

@waghanza
Copy link
Contributor Author

waghanza commented Nov 6, 2019

Yep, I've also had some issues on alpine, see the PR with https://github.com/criticalstack/libevhtp

@ohler55
Copy link
Owner

ohler55 commented Nov 6, 2019

Which PR was that. I saw 6 but didn't know which was relevant.

@ohler55
Copy link
Owner

ohler55 commented Nov 6, 2019

Doing a little research it looks like Alpine might need the use of either -D_POSIX_SOURCE or maybe a #define _POSIX_C_SOURCE 199506L I'll do some experimenting with docker.

Can you verify that you've done something like this:

RUN apk update
&& apk add --virtual build-dependencies
build-base

@waghanza
Copy link
Contributor Author

waghanza commented Nov 6, 2019

seems to be the same with the docker line you gave me

I also see the #define _POSIX_C_SOURCE 199506L source when searching around on stackoverflow, but I have no C skill to PR 😛

@ohler55
Copy link
Owner

ohler55 commented Nov 8, 2019

I pulled your branch and did a docker build with no errors. Of course the Dockerfile generated FROM ruby:2.6. What should I use to get the failure you are seeing?

@waghanza
Copy link
Contributor Author

waghanza commented Nov 9, 2019

Run

shards install
shards build
bin/make config

This should create a Dockerfile in ruby/agoo.

The idea is that this error occurred on bundle install. If you run into the container, (with this line and after commented), you will see the compilation error

@ohler55
Copy link
Owner

ohler55 commented Nov 9, 2019

okay, will try from in the container. I'll try Sunday. Traveling today.

@ohler55
Copy link
Owner

ohler55 commented Nov 11, 2019

I'm not sure what the difference is but even from in the container I don't see any build errors. The Dockerfile is using the ruby:2.6 image. Is that the same for you? I used the use_alpine branch but can't seem to make it fail.

@waghanza
Copy link
Contributor Author

Ah sorry, yes.

The official image use Debian but I want to switch to alpine since less heavy

@ohler55
Copy link
Owner

ohler55 commented Nov 11, 2019

Right, so where can I find the alpine images or get them hooked into the shard/neph build environment?

@ohler55
Copy link
Owner

ohler55 commented Nov 11, 2019

So, if I don't use the neph stuff and just go for a custom Dockerfile from ruby:2.6.5-alpine I do get errors indicating the build environment isn't there. If that is the correct starting point I'll see what has to be added to make it work.

@ohler55
Copy link
Owner

ohler55 commented Nov 11, 2019

This worked for me with a change in Agoo to put in two compile directives.

FROM ruby:2.6.5-alpine

WORKDIR /usr/src/app

COPY . ./

RUN apk add --update build-base

RUN bundle install --without development test

ENV AGOO_WORKER_COUNT $(nproc)

CMD ruby app.rb

I suspect Aggo-C will need the same directives.

I would like to update the apps for both as well to match some changes in the graphql-benchmarks. @waghanza , I put you as a reviewer. Anyway if you would like me to make the changes on your fork, let me know and I can branch as long as I am a collaborator..

@waghanza
Copy link
Contributor Author

Sure, go on. ❤️

@ohler55
Copy link
Owner

ohler55 commented Nov 13, 2019

PR is ready for you.

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

No branches or pull requests

2 participants