incubator-pagespeed-ngx
incubator-pagespeed-ngx copied to clipboard
How to build in Alpine 3.10
The docker patch can not use in Alpine 3.10
Applying patch automatic_makefile
patching file pagespeed/automatic/Makefile
Applying patch libpng16
patching file net/instaweb/rewriter/image.cc
Possibly reversed hunk 1 at 1438
Hunk 1 FAILED 21/21.
#include <algorithm>
#include <cstddef>
+extern "C" {
+#ifdef USE_SYSTEM_ZLIB
+#include "zlib.h"
+#else
+#include "third_party/zlib/zlib.h"
+#endif
+} // extern "C"
+
#include "base/logging.h"
#include "net/instaweb/rewriter/cached_result.pb.h"
#include "net/instaweb/rewriter/public/image_data_lookup.h"
Hunk 1 FAILED 411/411.
png_uint_32 height = png_get_image_height(paletted_png_ptr,
paletted_info_ptr);
for (png_uint_32 row = 1; row < height; ++row) {
- memcpy(paletted_info_ptr->row_pointers[row],
- paletted_info_ptr->row_pointers[0],
+ memcpy(row_pointers[row],
+ row_pointers[0],
row_size);
}
Possibly reversed hunk 1 at 508
Hunk 1 FAILED 30/30.
#else
#include "third_party/libpng/src/png.h"
#endif
+
+#ifdef USE_SYSTEM_ZLIB
+#include "zlib.h"
+#else
+#include "third_party/zlib/zlib.h"
+#endif
} // extern "C"
#include "base/logging.h"
Possibly reversed hunk 1 at 1395
Hunk 1 FAILED 36/36.
#else
#include "third_party/libpng/src/png.h"
#endif
+
+#ifdef USE_SYSTEM_ZLIB
+#include "zlib.h"
+#else
+#include "third_party/zlib/zlib.h"
+#endif
}
namespace {
Hunk 1 FAILED 22/22.
'dependencies': [
'../zlib/zlib.gyp:zlib',
],
+ 'actions': [
+ {
+ 'action_name': 'copy_libpngconf_prebuilt',
+ 'inputs' : [],
+ 'outputs': [''],
+ 'action': [
+ 'cp',
+ '-f',
+ '<(DEPTH)/third_party/libpng/src/scripts/pnglibconf.h.prebuilt',
+ '<(DEPTH)/third_party/libpng/src/pnglibconf.h',
+ ],
+ },
+ ],
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
'sources': [
+ 'src/pngpriv.h',
'src/png.c',
'src/png.h',
'src/pngconf.h',
+ 'src/pngdebug.h',
'src/pngerror.c',
- 'src/pnggccrd.c',
'src/pngget.c',
+ 'src/pnginfo.h',
'src/pngmem.c',
patching file pagespeed/kernel/image/gif_reader.cc
patching file pagespeed/kernel/image/image_converter.cc
patching file pagespeed/kernel/image/png_optimizer_test.cc
patching file third_party/libpng/libpng.gyp
'src/pngpread.c',
'src/pngread.c',
The command '/bin/sh -c for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done' returned a non-zero code: 1
Maybe asking to @nberlee
OMG, It is too difficult.
@Vndroid I'm also struggling with this build error and spent my 5 days still no solution. I informed @oschaaf about this problem. We need to wait for release v1.14.36.1.
@Vndroid I'm also struggling with this build error and spent my 5 days still no solution. I informed @oschaaf about this problem. We need to wait for release v1.14.36.1.
Mee too, I spent seven days on it.
if I remove the libpng16.patch, then it builds fine now on Alpine 3.8 (with latest pagespeed-mod v1.14.36.1 release version) do we still need this patch? Ever since Alpine 3.9 moved to openssl 1.1, the build is broken on 3.9+, seems it is due to openssl 1.1 incompatible with google serf, apline3.8 was on openssl 1.0. So the issue here doesn't seems to specific to Alpine 3.10 but due to the libpng16.patch. It seems libpng1.6.patch now merged into the latest pagespeed-mod V.1.4 releases source and this patch is not needed anymore. See: https://github.com/apache/incubator-pagespeed-mod/commit/7ea8d5fc141c7067c54ffa2b9fbc552c15089ca6
Is there any progress on this? I would like to build this on Alpine 3.10 as well since 3.8 is EOL on 2020-05-01.
Perhaps an easier alternative is to keep the build process with alpine 3.8 and update only the alpine version in the final layer.
https://github.com/apache/incubator-pagespeed-ngx/blob/master/docker/alpine-3.8/nginx-mainline/Dockerfile#L199
Perhaps an easier alternative is to keep the build process with alpine 3.8 and update only the alpine version in the final layer.
https://github.com/apache/incubator-pagespeed-ngx/blob/master/docker/alpine-3.8/nginx-mainline/Dockerfile#L199
I was thinking the same thing and tried this a few weeks ago but it throws an error. I gave up on nginx and pagespeed on Alpine for now.
I actually manage to build it on Alpine 3.11 with Pagespeed v1.14.36.1 release versions. the trick is replace openssl 1.1.1 with alpine 3.8's openssl 1.0.2, the main issue now with pagespeed seems there is still dependency on old openssl pre 1.0.2 or equal version of libssl.
- replace openssl with 1.0.2 from alpine 3.8 repo. when building the PSOL
RUN apk add --no-cache \
apache2-dev \
apr-dev \
apr-util-dev \
build-base \
curl \
gettext-dev \
git \
gperf \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
pcre-dev \
py-setuptools \
zlib-dev && \
apk add --no-cache 'openssl-dev=1.0.2u-r0' --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/community --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/main \
;
when produce the final image
RUN apk --no-cache upgrade && \
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /usr/local/bin/envsubst \
| tr ',' '\n' \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| xargs apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/community --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/main
drive by comment: the freebsd port seems to build against openssl 1.1 these days: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234447
The specific patch by @mmokhi that ended up being used back then might be worth trying in the context of this issue: https://svnweb.freebsd.org/ports?view=revision&revision=490805
I get this error and it terminates my building process. I tried to build the image on Win 10 and Centos 8. Both gave the same error output.
Do you have any solution for applying patches?
The command '/bin/sh -c for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done' returned a non-zero code: 1
@akinmetin Maybe is related to this issue https://github.com/apache/incubator-pagespeed-ngx/issues/1666#issuecomment-611711608 The solution for that is in the next comment to this
@Lofesa thanks it solved, but now I get this error:
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: opngreduc.c:(.text.opng_reduce_image+0x6bf): undefined reference to png_set_IHDR
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: opngreduc.c:(.text.opng_reduce_image+0x8f1): undefined reference to png_free_data
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: opngreduc.c:(.text.opng_reduce_image+0x901): undefined reference to png_set_invalid
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: opngreduc.c:(.text.opng_reduce_image+0x921): undefined reference to png_get_rows
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:369: objs/nginx] Error 1
make: *** [Makefile:11: install] Error 2
The command '/bin/sh -c tar zxf ../nginx-${NGINX_VERSION}.tar.gz --strip-components=1 -C . && ./configure ${NGINX_BUILD_CONFIG} --add-module=/usr/src/ngxpagespeed --with-ld-opt="-Wl,-z,relro,--start-group -lapr-1 -laprutil-1 -licudata -licuuc -lpng -lturbojpeg -ljpeg" && make install -j nproc' returned a non-zero code: 2
Should I modify this line too?
I tried to remove -lpng
but still failing.
Seem that you don´t have some dep installed. Have you installed the libpng-dev package?
I'm able to build the image with removing libressl-dev
and adding apk add --no-cache 'openssl-dev=1.0.2u-r0' --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/community --repository http://dl-cdn.alpinelinux.org/alpine/v3.8/main \
into depencies of Nginx ans psol.