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

Building release v2.2.1 from tarball always fails #465

Closed
polamjag opened this issue Jun 13, 2020 · 3 comments · Fixed by #466
Closed

Building release v2.2.1 from tarball always fails #465

polamjag opened this issue Jun 13, 2020 · 3 comments · Fixed by #466

Comments

@polamjag
Copy link

polamjag commented Jun 13, 2020

TL;DR: Building ngx_mruby v2.2.1 from release tarball fails because build_mruby target in Makefile.in tries to look at .git and .mruby-version but both of them are not included in the tarball.

ngx_mruby/Makefile.in

Lines 75 to 86 in 7a3198c

build_mruby: $(MRUBY_BUILD_DEPEND_TARGETS)
@if [ -f .mruby_version ]; then \
built_version=`cat .mruby_version`; \
current_version=`git log -1 --format="%H" mruby`; \
if [ $$built_version != $$current_version ]; then \
echo $$current_version > .mruby_version; \
(cd $(MRUBY_ROOT) && rm -rf build); \
fi; \
else \
git log -1 --format="%H" mruby > .mruby_version; \
fi
(cd $(MRUBY_ROOT) && $(RAKE) MRUBY_CONFIG=$(NGX_MRUBY_ROOT)/build_config.rb NGX_MRUBY_CFLAGS="$(NGX_MRUBY_CFLAGS)" NGX_MRUBY_LDFLAGS="$(NGX_MRUBY_LDFLAGS)")

This is minimal Dockerfile to reproduce this problem:

FROM alpine

RUN apk add make ruby ruby-rake bison openssl gcc build-base curl tar nginx git

RUN curl -L http://nginx.org/download/nginx-1.18.0.tar.gz -o nginx.tar.gz
RUN tar xzvf nginx.tar.gz

RUN curl -L https://github.com/matsumotory/ngx_mruby/archive/v2.2.1.tar.gz -o ngx_mruby.tar.gz
RUN tar xzvf ngx_mruby.tar.gz

WORKDIR /ngx_mruby-2.2.1/

RUN ./configure --with-ngx-src-root=/nginx/
RUN make

This is the output I can get when building this Dockerfile:

% docker build .
(snip)
Step 9/9 : RUN make
 ---> Running in af5c6975ab1b
fatal: not a git repository (or any of the parent directories): .git
make: *** [Makefile:76: build_mruby] Error 128

I think this problem is related to #453.

@matsumotory
Copy link
Owner

Thank you for your report. I'll investigate it later. I also think mruby/ doesn't have /git by default because mruby/ was created by git subtree. We will fix this bug.

@yyamano
Copy link
Collaborator

yyamano commented Jun 13, 2020

I don't have enough time for testing it, but the following change should fix the issue.

diff --git a/Makefile.in b/Makefile.in
index 1ad3de4..135b542 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -73,6 +73,7 @@ clobber: clean_mruby clean
 # mruby
 #
 build_mruby: $(MRUBY_BUILD_DEPEND_TARGETS)
+       # Only for ngx_mruby developers getting source code from git.
        @if [ -f .mruby_version ]; then \
                built_version=`cat .mruby_version`; \
                current_version=`git log -1 --format="%H" mruby`; \
@@ -80,7 +81,7 @@ build_mruby: $(MRUBY_BUILD_DEPEND_TARGETS)
                        echo $$current_version > .mruby_version; \
                        (cd $(MRUBY_ROOT) && rm -rf build); \
                fi; \
-       else \
+       elif [ -d .git ]; then \
                git log -1 --format="%H" mruby > .mruby_version; \
        fi
        (cd $(MRUBY_ROOT) && $(RAKE) MRUBY_CONFIG=$(NGX_MRUBY_ROOT)/build_config.rb NGX_MRUBY_CFLAGS="$(NGX_MRUBY_CFLAGS)" NGX_MRUBY_LDFLAGS="$(NGX_MRUBY_LDFLAGS)")

@polamjag
Copy link
Author

Thanks for fixing! 👍👍👍

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 a pull request may close this issue.

3 participants