I am trying to compile Nginx with Pagespeed from source and I am having a hard time trying to resolve the not found
errors I am seeing when I add the configure settings. This is my configure settings:
I am using CentOS 7 - 64 bit
Configure Settings:
sudo ./configure --add-module=/nginx-compile/modules/ngx_pagespeed-release-1.9.32.1-beta \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_spdy_module \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector \
--param=ssp-buffer-size=4 -m64 -mtune=generic' \
--user=nginx \
--group=nginx
When I add the above in ssh, I am getting the following not found
errors and no supported file AIO was found
error. Here is the list I get:
Errors after executing Configure:
checking for OS
+ Linux 3.10.0-123.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... not found
checking for C99 variadic macros ... not found
checking for gcc variadic macros ... not found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... not found
checking for O_PATH ... not found
checking for sendfile() ... not found
checking for sendfile64() ... not found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... not found
checking for sched_setaffinity() ... not found
checking for crypt_r() ... not found
checking for sys/vfs.h ... found
checking for poll() ... not found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... not found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... not found
checking for O_DIRECT ... not found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... not found
checking for statvfs() ... not found
checking for dlopen() ... not found
checking for dlopen() in libdl ... not found
checking for sched_yield() ... not found
checking for sched_yield() in librt ... not found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... not found
checking for TCP_KEEPIDLE ... not found
checking for TCP_FASTOPEN ... not found
checking for TCP_INFO ... not found
checking for accept4() ... not found
checking for kqueue AIO support ... not found
checking for Linux AIO support ... not found
./configure: no supported file AIO was found
Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only
I also installed the following dependencies before I added the configure settings:
sudo yum install gcc gcc-c++ pcre-devel zlib-devel make unzip openssl-devel
The configuration I used is similar to the configuration settings that comes when I install Nginx using centos inbuilt repo except it has the pagespeed module added.
UPDATE:
The actual problem was the way I've split the line when passing the --params
to the configure call which is incorrect and was causing the errors. Thanks to @XavierLucas answer below, the error was resolved once I added --with-cc-opt
and --params
in 1 line.
EXTENDING:
While the above was the cause for error, I also learnt that its good to have the following libraries installed too in order for Nginx to make the most out of its core features and while having pagespeed module installed:
gcc
gcc-c++
pcre-devel
zlib-devel
make
unzip
openssl-devel
libaio-devel
glibc
glibc-devel
glibc-headers
libevent
linux-vdso.so.1
libpthread.so.0
libcrypt.so.1
libstdc++.so.6
librt.so.1
libm.so.6
libpcre.so.0
libssl.so.10
libcrypto.so.10
libdl.so.2
libz.so.1
libgcc_s.so.1
libc.so.6
/lib64/ld-linux-x86-64.so.2
libfreebl3.so
libgssapi_krb5.so.2
libkrb5.so.3
libcom_err.so.2
libk5crypto.so.3
libkrb5support.so.0
libkeyutils.so.1
libresolv.so.2
libselinux.so.1
And
yum groupinstall 'Development Tools'
To stop a bit the looong chat going on, here's the C/C++ libraries you need for a compiled version of nginx with pagespeed on CentOS:
Check with
yum whatprovides <library>
in which package it is available and make sure you have all installed.Edit : Your options are important. For example ssp will limit stackoverflow attacks and has a security purpose. The other options will optimize the binary so it works best for your target arch.
After taking a step back, it seemed weird to me that it would crash on an external library by changing these options. Anyway that's good that you followed the previous steps we discussed so you have the required librairies to get the best performance out of nginx (remember, it's event driven so libevent is a must have !).
Your actual problem comes from the way you pass
--params
to the configure call. You are trying to split on a new line inside the string itself.Should be :
And then be prepared for the wall of text :)
This is how to compile nginx 1.10.2 with pagespeed 1.11.33.4 in CentOS 7
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
go to this page in order to find the latest version
-beta does not mean not stable version, 1.11.33.4 is stable version
common configuration (nginx installed from repo + pagespeed)
Then
Make file and paste the code:
Check that /var/ngx_pagespeed_cache folder is created by nginx
edit /etc/nginx/your-domain.conf ### and place your settings
Test cofiguration
Warning! Disable your repo to prevent nginx update!
Try this to install our basic dependencies, run:
RedHat, CentOS, or Fedora
sudo yum install gcc-c++ pcre-devel zlib-devel make unzip libuuid-devel
Ubuntu or Debian
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip uuid-dev
Ref: https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source
Not work here for Centos 7, nginx 1.16.1:
....