ngx-php icon indicating copy to clipboard operation
ngx-php copied to clipboard

docker build failed invalid option -fomit-frame-pointer

Open steinkel opened this issue 5 years ago • 3 comments

While testing the project using docker, following the readme I get to

./configure: error: invalid option "-fomit-frame-pointer'"

➜  ngx_php7 git:(master) # using commit id a7a0af416a0034580321b7ecdf17be65f6b9898e
➜  ngx_php7 git:(master) docker build -t nginx-php7 .                                                  
Sending build context to Docker daemon  1.161MB
Step 1/10 : FROM nginx:stable-alpine as ngx-php
 ---> aaad4724567b
Step 2/10 : COPY config /build/config
 ---> Using cache
 ---> 6aef7738475f
Step 3/10 : COPY src /build/src
 ---> Using cache
 ---> 8a7b9f8702e3
Step 4/10 : COPY third_party /build/third_party
 ---> Using cache
 ---> 895510b51acd
Step 5/10 : ENV PHP_LIB=/usr/lib
 ---> Using cache
 ---> 0dfa98a35f22
Step 6/10 : WORKDIR /build
 ---> Using cache
 ---> 51098db4bda6
Step 7/10 : RUN apk --no-cache add curl gcc g++ make musl-dev linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev openssl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev libedit-dev ncurses-dev php7-dev php7-embed  && NGINX_VERSION=$(nginx -v 2>&1 | sed 's/^[^0-9]*//')  && curl -sL -o nginx-${NGINX_VERSION}.tar.gz http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz  && tar -xf nginx-${NGINX_VERSION}.tar.gz  && cd nginx-${NGINX_VERSION}  && ./configure $(nginx -V 2>&1 | tail -1 | sed -e 's/configure arguments://' -e 's| --add-dynamic-module=[^ ]*||g') --with-ld-opt="-Wl,-rpath,${PHP_LIB}" --add-dynamic-module=../third_party/ngx_devel_kit --add-dynamic-module=..  && make  && mkdir -p /usr/lib/nginx/modules  && cp objs/ndk_http_module.so /usr/lib/nginx/modules  && cp objs/ngx_http_php_module.so /usr/lib/nginx/modules
 ---> Running in 24d95c1a030f
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/54) Upgrading libcrypto1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(2/54) Upgrading libssl1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(3/54) Installing ca-certificates (20190108-r0)
(4/54) Installing nghttp2-libs (1.39.2-r0)
(5/54) Installing libcurl (7.66.0-r0)
(6/54) Installing curl (7.66.0-r0)
(7/54) Installing libgcc (8.3.0-r0)
(8/54) Installing libstdc++ (8.3.0-r0)
(9/54) Installing binutils (2.32-r0)
(10/54) Installing gmp (6.1.2-r1)
(11/54) Installing isl (0.18-r0)
(12/54) Installing libgomp (8.3.0-r0)
(13/54) Installing libatomic (8.3.0-r0)
(14/54) Installing mpfr3 (3.1.5-r1)
(15/54) Installing mpc1 (1.1.0-r0)
(16/54) Installing gcc (8.3.0-r0)
(17/54) Installing musl-dev (1.1.22-r3)
(18/54) Installing libc-dev (0.7.1-r0)
(19/54) Installing g++ (8.3.0-r0)
(20/54) Installing gd (2.2.5-r2)
(21/54) Installing perl (5.28.2-r1)
(22/54) Installing pkgconf (1.6.1-r1)
(23/54) Installing gd-dev (2.2.5-r2)
(24/54) Installing geoip-dev (1.6.12-r1)
(25/54) Installing ncurses-dev (6.1_p20190518-r0)
(26/54) Installing libedit-dev (20190324.3.1-r0)
(27/54) Installing zlib-dev (1.2.11-r1)
(28/54) Upgrading libxml2 (2.9.9-r2 -> 2.9.9-r3)
(29/54) Installing libxml2-dev (2.9.9-r3)
(30/54) Upgrading libxslt (1.1.33-r1 -> 1.1.33-r3)
(31/54) Installing libxslt-dev (1.1.33-r3)
(32/54) Installing linux-headers (4.19.36-r0)
(33/54) Installing make (4.2.1-r2)
(34/54) Installing openssl-dev (1.1.1d-r2)
(35/54) Installing libattr (2.4.48-r0)
(36/54) Installing attr (2.4.48-r0)
(37/54) Installing paxmark (0.11-r1)
(38/54) Installing libpcre16 (8.43-r0)
(39/54) Installing libpcre32 (8.43-r0)
(40/54) Installing libpcrecpp (8.43-r0)
(41/54) Installing pcre-dev (8.43-r0)
(42/54) Installing perl-utils (5.28.2-r1)
(43/54) Installing perl-dev (5.28.2-r1)
(44/54) Installing php7-common (7.3.13-r0)
(45/54) Installing argon2-libs (20171227-r2)
(46/54) Installing pcre2 (10.33-r0)
(47/54) Installing php7 (7.3.13-r0)
(48/54) Installing m4 (1.4.18-r1)
(49/54) Installing autoconf (2.69-r2)
(50/54) Installing libpcre2-16 (10.33-r0)
(51/54) Installing libpcre2-32 (10.33-r0)
(52/54) Installing pcre2-dev (10.33-r0)
(53/54) Installing php7-dev (7.3.13-r0)
(54/54) Installing php7-embed (7.3.13-r0)
Executing busybox-1.30.1-r2.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 301 MiB in 87 packages
./configure: error: invalid option "-fomit-frame-pointer'"
The command '/bin/sh -c apk --no-cache add curl gcc g++ make musl-dev linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev openssl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev libedit-dev ncurses-dev php7-dev php7-embed  && NGINX_VERSION=$(nginx -v 2>&1 | sed 's/^[^0-9]*//')  && curl -sL -o nginx-${NGINX_VERSION}.tar.gz http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz  && tar -xf nginx-${NGINX_VERSION}.tar.gz  && cd nginx-${NGINX_VERSION}  && ./configure $(nginx -V 2>&1 | tail -1 | sed -e 's/configure arguments://' -e 's| --add-dynamic-module=[^ ]*||g') --with-ld-opt="-Wl,-rpath,${PHP_LIB}" --add-dynamic-module=../third_party/ngx_devel_kit --add-dynamic-module=..  && make  && mkdir -p /usr/lib/nginx/modules  && cp objs/ndk_http_module.so /usr/lib/nginx/modules  && cp objs/ngx_http_php_module.so /usr/lib/nginx/modules' returned a non-zero code: 1
➜  ngx_php7 git:(master) docker -v
Docker version 19.03.5, build 633a0ea838

steinkel avatar Jan 09 '20 18:01 steinkel

@steinkel Thanks for the feedback~

rryqszq4 avatar Jan 13 '20 10:01 rryqszq4

@steinkel and @rryqszq4

to resolve -fomit-frame-pointer replace line 16 in Dockerfile to:

&& ./configure $(nginx -V 2>&1 | tail -1 | sed -e 's/configure arguments://' -e "s/ --with-cc-opt='-Os -fomit-frame-pointer'//" -e 's| --add-dynamic-module=[^ ]*||g') --with-ld-opt="-Wl,-rpath,${PHP_LIB}" --add-dynamic-module=../third_party/ngx_devel_kit --add-dynamic-module=.. \

But other error from argon2 appears in the compilation, for this replace line 11 from Dockerfile to:

RUN apk --no-cache add argon2-dev argon2-libs curl gcc g++ make musl-dev linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev openssl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev libedit-dev ncurses-dev php7-dev php7-embed \

Dockerfile
     1	FROM nginx:stable-alpine as ngx-php
     2	
     3	COPY config /build/config
     4	COPY src /build/src
     5	COPY third_party /build/third_party
     6	
     7	ENV PHP_LIB=/usr/lib
     8	
     9	WORKDIR /build
    10	
    11	RUN apk --no-cache add argon2-dev argon2-libs curl gcc g++ make musl-dev linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev openssl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev libedit-dev ncurses-dev php7-dev php7-embed \
    12	 && NGINX_VERSION=$(nginx -v 2>&1 | sed 's/^[^0-9]*//') \
    13	 && curl -sL -o nginx-${NGINX_VERSION}.tar.gz http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
    14	 && tar -xf nginx-${NGINX_VERSION}.tar.gz \
    15	 && cd nginx-${NGINX_VERSION} \
    16	 && ./configure $(nginx -V 2>&1 | tail -1 | sed -e 's/configure arguments://' -e "s/ --with-cc-opt='-Os -fomit-frame-pointer'//" -e 's| --add-dynamic-module=[^ ]*||g') --with-ld-opt="-Wl,-rpath,${PHP_LIB}" --add-dynamic-module=../third_party/ngx_devel_kit --add-dynamic-module=.. \
    17	 && make \
    18	 && mkdir -p /usr/lib/nginx/modules \
    19	 && cp objs/ndk_http_module.so /usr/lib/nginx/modules \
    20	 && cp objs/ngx_http_php_module.so /usr/lib/nginx/modules
    21	
    22	
    23	FROM nginx:stable-alpine
    24	
    25	RUN apk --no-cache add php7-embed \
    26	 && sed -i "s|events {|include /etc/nginx/modules/\*.conf;\n\nevents {|" /etc/nginx/nginx.conf \
    27	 && echo -e "load_module \"/usr/lib/nginx/modules/ndk_http_module.so\";\nload_module \"/usr/lib/nginx/modules/ngx_http_php_module.so\";" > /etc/nginx/modules/php.conf
    28	
    29	COPY --from=ngx-php /usr/lib/nginx/modules/ /usr/lib/nginx/modules/

Attention, this change about -fomit-frame-pointer is for testing with Docker, not recommended for working in production

Now we can start playing with this module for nginx as if we were on the moon(Lua) :nerd_face:

RicardoSette avatar Jun 02 '20 03:06 RicardoSette

@RicardoSette Thanks for your solution~

rryqszq4 avatar Jun 02 '20 10:06 rryqszq4