apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 365 forks source link

nginx 1.9.1 + clang compile centos 7.1 #976

Closed centminmod closed 9 years ago

centminmod commented 9 years ago

see from issue search ngx_pagespeed had a few clang related compile issues.

I tried clang for first time with nginx 1.9.1 and ngx_pagespeed and seems a few more errors

In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/gurl.h:14:
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/url_canon_stdstring.h:44:31: warning: 
      'override' keyword is a C++11 extension [-Wc++11-extensions]
  virtual void Resize(int sz) OVERRIDE;
                              ^
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/base/compiler_specific.h:143:18: note: expanded
      from macro 'OVERRIDE'
#define OVERRIDE override
                 ^
1 warning generated.

In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/gurl.h:14:
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/url_canon_stdstring.h:44:31: warning: 
      'override' keyword is a C++11 extension [-Wc++11-extensions]
  virtual void Resize(int sz) OVERRIDE;
                              ^
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/base/compiler_specific.h:143:18: note: expanded
      from macro 'OVERRIDE'
#define OVERRIDE override
                 ^
1 warning generated.

In file included from ../ngx_pagespeed-release-1.9.32.3-beta/src/ngx_server_context.cc:29:
In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/net/instaweb/rewriter/public/rewrite_driver.h:28:
In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/net/instaweb/htmlparse/public/html_parse.h:20:
In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/pagespeed/kernel/html/html_parse.h:41:
In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/pagespeed/kernel/http/google_url.h:31:
In file included from ../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/gurl.h:14:
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/url/url_canon_stdstring.h:44:31: warning: 
      'override' keyword is a C++11 extension [-Wc++11-extensions]
  virtual void Resize(int sz) OVERRIDE;
                              ^
../ngx_pagespeed-release-1.9.32.3-beta/psol/include/third_party/chromium/src/base/compiler_specific.h:143:18: note: expanded
      from macro 'OVERRIDE'
#define OVERRIDE override
                 ^
../ngx_pagespeed-release-1.9.32.3-beta/src/ngx_server_context.cc:59:7: warning: variable 'local_port' is used uninitialized
      whenever 'if' condition is false [-Wsometimes-uninitialized]
  if (!port_set) {
      ^~~~~~~~~
../ngx_pagespeed-release-1.9.32.3-beta/src/ngx_server_context.cc:76:35: note: uninitialized use occurs here
                                  local_port,
                                  ^~~~~~~~~~
../ngx_pagespeed-release-1.9.32.3-beta/src/ngx_server_context.cc:59:3: note: remove the 'if' if its condition is always true
  if (!port_set) {
  ^~~~~~~~~~~~~~~
../ngx_pagespeed-release-1.9.32.3-beta/src/ngx_server_context.cc:51:17: note: initialize the variable 'local_port' to silence
      this warning
  int local_port;
                ^
                 = 0
2 warnings generated.

compiled fine if i disabled some of the warnings but not sure if that's the right thing to do ?

./configure --with-ld-opt='-ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-error -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module-0.25 --add-module=../nginx-accesskey-2.0.3 --add-module=../nginx-http-concat-master --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.3 --add-module=../openresty-memc-nginx-module-1518da4 --add-module=../openresty-srcache-nginx-module-ffa9ab7 --add-module=../ngx_devel_kit-0.2.19 --add-module=../set-misc-nginx-module-0.28 --add-module=../echo-nginx-module-0.57 --add-module=../lua-nginx-module-0.9.16rc1 --add-module=../lua-upstream-nginx-module-0.02 --add-module=../lua-upstream-cache-nginx-module-0.1.1 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-module-vts --with-openssl=../openssl-1.0.2a --with-libatomic --with-threads --with-stream --with-stream_ssl_module --with-pcre=../pcre-8.37 --with-pcre-jit --with-http_spdy_module --add-module=../ngx_pagespeed-release-1.9.32.3-beta  
jeffkaufman commented 9 years ago

See #950. Some of these warnings were fixed with #951, which isn't out in a release yet, but once you have that you'll still need -Wno-c++11-extensions.

Disabling the warnings to get the current version to build with clang is fine for now.

centminmod commented 9 years ago

thanks @jeffkaufman i updated my compile options for as well

however one of my centmin mod nginx users reported issues with PSOL while i don't have any, difference is he's on 32bit CentOS 6.6 while I am on 64bit CentOS 6.6, are there any 32bit vs 64bit clang related psol issues known ? errors posted at https://community.centminmod.com/posts/14633/ and full gist of /svr-setup/nginx-1.9.1/objs/autoconf.err at https://gist.githubusercontent.com/RoldanLT/b6f132a8143950296293/raw/gistfile1.txt

on front end error during compile all he sees is with CentOS 6.6 32bit

checking for psol ... not found
./configure: error: module ngx_pagespeed requires the pagespeed optimization library.
Look in objs/autoconf.err for more details.
*************************************************

Wed Jun 10 01:12:30 PHT 2015
Error: 1, Nginx configure failed

my working clang + nginx 1.9.1 + ngx_pagespeed on CentOS 6.6 64bit

nginx -V nginx version: nginx/1.9.1 built by clang 3.4.2 (tags/RELEASE_34/dot2-final) built with LibreSSL 2.1.6 TLS SNI support enabled configure arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module-0.25 --add-module=../nginx-accesskey-2.0.3 --add-module=../nginx-http-concat-master --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.3 --add-module=../openresty-memc-nginx-module-1518da4 --add-module=../openresty-srcache-nginx-module-ffa9ab7 --add-module=../ngx_devel_kit-0.2.19 --add-module=../set-misc-nginx-module-0.28 --add-module=../echo-nginx-module-0.57 --add-module=../lua-nginx-module-0.9.16rc1 --add-module=../lua-upstream-nginx-module-0.02 --add-module=../lua-upstream-cache-nginx-module-0.1.1 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-module-vts --with-openssl=../portable-2.1.6 --with-libatomic --with-threads --with-stream --with-stream_ssl_module --with-pcre=../pcre-8.37 --with-pcre-jit --with-http_spdy_module --add-module=../ngx_pagespeed-release-1.9.32.3-beta

crowell commented 9 years ago

@centminmod taking a look now.

crowell commented 9 years ago

@centminmod what version of clang fails? you say that 3.4.2 works on 64 bit, is it the same one on 32 bit that fails?

draft1 commented 9 years ago

@crowell, I'm the one who test on CentOS 32 bit and yes we have the same code/compiler and version of clang.

crowell commented 9 years ago

@RoldanLT @centminmod I just tried building with clang 3.4.2 installed from epel6 on a centos 6.6.

CC=clang CXX=clang++ CFLAGS="-Wno-c++11-extensions" ./configure --add-module=${HOME}/ngx_pagespeed-release-${NPS_VERSION}-beta

and everything built/linked properly on a 32 bit centos 66.

crowell commented 9 years ago

also, maybe silly question, @RoldanLT, but is the psol folder in your ngx_pagespeed folder?

draft1 commented 9 years ago

I think @centminmod is using Clang from source compiled. Not from epel6 if that matters.

draft1 commented 9 years ago

When @centminmod Eva come back, please correct my assumptions :|

draft1 commented 9 years ago

Yes it's there:

ls -lah

total 108M drwxr-xr-x 7 root root 4.0K Jun 10 02:29 . drwxr-xr-x. 18 root root 4.0K Jun 10 02:29 .. -rw-r--r-- 1 root root 108M Jan 7 06:00 1.9.32.3.tar.gz -rw-r--r-- 1 root root 7.2K Jun 10 02:28 config -rw-r--r-- 1 root root 2.9K Jun 10 02:28 cpp_feature -rw-r--r-- 1 root root 44 Jun 10 02:28 .gitignore -rw-r--r-- 1 root root 12K Jun 10 02:28 LICENSE drwxr-xr-x 5 root root 4.0K Jun 10 02:29 ngx_pagespeed-master drwxr-x--- 4 245878 5000 4.0K Dec 22 23:03 psol -rw-r--r-- 1 root root 1.5K Jun 10 02:28 README.md drwxr-xr-x 2 root root 4.0K Jun 10 02:28 scripts drwxr-xr-x 2 root root 4.0K Jun 10 02:28 src drwxr-xr-x 2 root root 4.0K Jun 10 02:28 test

draft1 commented 9 years ago

SS image

crowell commented 9 years ago

@RoldanLT are you doing --add-module to the ngx_pagespeed-master dir or the ngx_pagespeed-release-1.9.32.3-beta one?

draft1 commented 9 years ago

That, Eva can answer correctly as he is the one created centminmod. Let's wait for @centminmod .

centminmod commented 9 years ago

Okay i'll fill in the blanks

for @RoldanLT and my installs clang is installed via EPEL YUM repo not source and 3.4.2 is the clang version

Centmin Mod LEMP stack's Nginx has an option to either install from ngx_pagespeed master branch OR from version tagged 1.9.32.3-beta. For my working install it's from version tagged 1.9.232.3-beta

ls -lah /svr-setup/ngx_pagespeed-release-1.9.32.3-beta/
total 108M
drwxrwxr-x  6 root   root 4.0K Jun 10 00:13 .
drwxr-xr-x 60 root   root  12K Jun 10 00:20 ..
-rw-rw-r--  1 root   root   30 Dec 22 15:10 .gitignore
-rw-r--r--  1 root   root 108M Jan  6 22:00 1.9.32.3.tar.gz
-rw-rw-r--  1 root   root  12K Dec 22 15:10 LICENSE
-rw-rw-r--  1 root   root 1.5K Dec 22 15:10 README.md
-rw-rw-r--  1 root   root 7.2K Dec 22 15:10 config
-rw-rw-r--  1 root   root 2.9K Dec 22 15:10 cpp_feature
drwxr-x---  4 245878 5000 4.0K Dec 22 15:03 psol
drwxrwxr-x  2 root   root 4.0K Dec 22 15:10 scripts
drwxrwxr-x  2 root   root 4.0K Dec 22 15:10 src
drwxrwxr-x  2 root   root 4.0K Dec 22 15:10 test

Looks like @RoldanLT you're using master branch ? Centmin Mod.08 beta 03 defaults to tagged version now with centmin.sh defined variable NGINX_PAGESPEEDGITMASTER=n https://github.com/centminmod/centminmod/blob/123.08beta03/centmin.sh#L253. So if you have set NGINX_PAGESPEEDGITMASTER=n in centmin.sh and removed all previous downloaded sources

rm -rf /svr-setup/ngx_pagespeed-release*
rm -rf /svr-setup/release-1.9.32*

then recompile nginx via centmin.sh menu option 4, it should work.

crowell commented 9 years ago

@centminmod so we're all set, no bug? if that's not the case, @RoldanLT can you open up a new bug with reproducable steps? I'm not familiar with centmin.

draft1 commented 9 years ago

I'm confident this is not a bug with ngx_pagespeed but with Clang and 32 bit OS.

centminmod commented 9 years ago

@crowell seems problem could of been with @RoldanLT centmin mod code base being outdated + previously used ngx_pagespeed master code looks like it's fixed now https://community.centminmod.com/posts/14788/

nginx -V nginx version: nginx/1.9.1 built by clang 3.4.2 (tags/RELEASE_34/dot2-final) built with LibreSSL 2.1.6 TLS SNI support enabled configure arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m32 -mtune=generic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module-0.25 --add-module=../nginx-accesskey-2.0.3 --add-module=../nginx-http-concat-master --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.3 --add-module=../openresty-memc-nginx-module-1518da4 --add-module=../openresty-srcache-nginx-module-ffa9ab7 --add-module=../ngx_devel_kit-0.2.19 --add-module=../set-misc-nginx-module-0.28 --add-module=../echo-nginx-module-0.57 --add-module=../lua-nginx-module-0.9.16rc1 --add-module=../lua-upstream-nginx-module-0.02 --add-module=../lua-upstream-cache-nginx-module-0.1.1 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-module-vts --with-openssl=../portable-2.1.6 --with-libatomic --with-threads --with-stream --with-stream_ssl_module --with-pcre=../pcre-8.37 --with-pcre-jit --with-http_spdy_module --add-module=../ngx_pagespeed-release-1.9.32.3-beta