Ubuntu 16.04 compilation error ' ./configure: error: invalid option "-O2" '

1,215 views
Skip to first unread message

petter....@gmail.com

unread,
Oct 3, 2016, 7:58:11 PM10/3/16
to ngx-pagespeed-discuss
I'm trying to install pagespeed to my existing nxinx installation under ubuntu 16.04 x64 - gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2)

To get the args, I doo : nginx -V


 nginx -V
nginx version
: nginx/1.10.0 (Ubuntu)
built
with OpenSSL 1.0.2g-fips  1 Mar 2016 (running with OpenSSL 1.0.2g  1 Mar 2016)
TLS SNI support enabled
configure arguments
: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

To ensure that Nginx binary lives in the same location as before, I also add
--sbin-path=/usr/sbin/nginx

Then I run 
bash <(curl -f -L -sS https://ngxpagespeed.com/install) \
     
--ngx-pagespeed-version latest-beta --nginx-version latest

and gives the full arguments to the compilation:
 --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

Next
Does this look right? [Y/n] y

Pressing enter and the compilation fails with :
./configure: error: invalid option "-O2"
Failure running ./configure --add-module=/root/ngx_pagespeed-latest-beta --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads, exiting.

For extra info:
 gcc -v
Using built-in specs.
COLLECT_GCC
=gcc
COLLECT_LTO_WRAPPER
=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version
5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2)

My goal is to replace the version of nginx installed in ubuntu with apt-get to get page speed built in to try to optimize my install of prestashop. Any help is greatly appreciated.


Jeff Kaufman

unread,
Oct 4, 2016, 6:43:00 AM10/4/16
to ngx-pagesp...@googlegroups.com
Thanks for the detailed bug report! I'm able to repro this, and I'm
working on it now.
> --
> You received this message because you are subscribed to the Google Groups
> "ngx-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ngx-pagespeed-di...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
> For more options, visit https://groups.google.com/d/optout.

Jeff Kaufman

unread,
Oct 4, 2016, 8:09:11 AM10/4/16
to ngx-pagesp...@googlegroups.com
I have a draft change: https://github.com/pagespeed/ngx_pagespeed/pull/1286

You can test it as:

bash <(curl -f -L -sS
https://raw.githubusercontent.com/pagespeed/ngx_pagespeed/ca37858cf06d8cc6f3e07ff47e136ff09b10a2a5/scripts/build_ngx_pagespeed.sh)
--ngx-pagespeed-version latest-beta --nginx-version latest

petter....@gmail.com

unread,
Oct 4, 2016, 8:55:35 AM10/4/16
to ngx-pagespeed-discuss
Yes, now install went just fine.  Thank you for fantastic assistance ;-)   

 Had to edit the

etc/nginx/sites-available/my_domain
since the install added all the default settings in double in additional to existing settings.  Another question, when running pagespeed insights now, I get some new  warnings:

Optimize CSS Delivery of the following:

Leverage browser caching

Setting
 an expiry date
or a maximum age in the HTTP headers for static
resources instructs the browser to load previously downloaded resources
from local disk rather than over the network.
Leverage browser caching for the following cacheable resources:


Any tips to configure pagespeed to optimize this ??

Jeff Kaufman

unread,
Oct 4, 2016, 9:43:53 AM10/4/16
to ngx-pagesp...@googlegroups.com
On Tue, Oct 4, 2016 at 8:55 AM, <petter....@gmail.com> wrote:
>
> Optimize CSS Delivery of the following:
>
> http://mship.no/…d896_all.css.pagespeed.cf.RISeJSrIV5.css
> http://fonts.googleapis.com/…Open+Sans:300,600&subset=latin,latin-ext
>

Testing, if I enable the prioritize_critical_css filter that fixes the
first problem:

pagespeed EnableFilters prioritize_critical_css;

inline_google_font_css should fix the second problem, but testing it
doesn't seem to. It looks like the problem is that the filter is
willing to inline css that's up to 3k, but this css file is a bit over
4k even after minification. One way to fix this would be to set:

pagespeed EnableFilters inline_google_font_css;
pagespeed GoogleFontCssInlineMaxBytes 6000;

While this should fix the warning it would be inlining more css, and
so might not speed your page up on balance.

>
> http://mship.no/…efault2x.jpg.pagespeed.ic.iAjDl8z6q9.jpg (5 minutes)
> http://mship.no/…efault2x.jpg.pagespeed.ic.Zo7Vxzv7Mr.jpg (5 minutes)
> http://mship.no/…efault2x.jpg.pagespeed.ic.J1VDgMiWxw.jpg (5 minutes)
> http://mship.no/…efault2x.jpg.pagespeed.ic.RXiAGEN_a-.jpg (5 minutes)
> http://mship.no/…efault2x.jpg.pagespeed.ic.w4kmqLZFxN.jpg (5 minutes)
>

I'm not sure why these are showing low cache lifetimes in PageSpeed
insights; I can't reproduce it manually. For example, the first url
is http://mship.no/img/p/2/6/x26-home_default.jpg.pagespeed.ic.iAjDl8z6q9.jpg
but when I fetch it manually I see it is properly longcached.

Jeff

petter....@gmail.com

unread,
Oct 4, 2016, 11:26:26 AM10/4/16
to ngx-pagespeed-discuss
No, in fact it seems to slow down load times considerable.  Before loading pagespeed, I got a score of 87/95 in pagespeed insights, after enabling, I get a score of 78/91   , all values after " priming the site first" and then running insights.

----------

Xhanging the setting to:

pagespeed on;
pagespeed
EnableFilters prioritize_critical_css;
pagespeed
EnableFilters inline_google_font_css;
#pagespeed GoogleFontCssInlineMaxBytes 6000;


# Needs to exist and be writable by nginx.  Use tmpfs for best performance.
pagespeed
FileCachePath /var/ngx_pagespeed_cache;

# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location
~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
  add_header
"" "";
}
location
~ "^/pagespeed_static/" { }
location
~ "^/ngx_pagespeed_beacon$" { }
     
     location
~*  \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
        expires
30d;
   
}

and the score is 92/97, but in 'mobile view, cache expiry is
http://mship.no/…efault2x.jpg.pagespeed.ic.iAjDl8z6q9.jpg (5 minutes)

in 'Desktop' view, cache is as expected.  If I wait for 5 minutes so the cache will expire, the score is 78/97. The reason is related to pagespeed, since the 5 min cache expiery was introduced when installing pagespeed.


/Petter
desktop-insights.jpg
mobile-insights.jpg
Reply all
Reply to author
Forward
0 new messages