evan / mongrel

Mongrel
http://rubygems.org/gems/mongrel
Other
144 stars 18 forks source link

'gem install mongrel' fails on RHEL 7.1 LE and Ubuntu 14.04 on ppc64le arch #28

Open SriramaSharma opened 9 years ago

SriramaSharma commented 9 years ago

'gem install mongrel' failed with below error on ppc64le architecture.

root# gem install mongrel
Building native extensions.  This could take a while...
ERROR:  Error installing mongrel:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
checking for main() in -lc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling http11.c
http11.c: In function âhttp_fieldâ:
http11.c:70:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
   ^
http11.c:71:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
   ^
http11.c:77:22: error: âstruct RStringâ has no member named âptrâ
   for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
                      ^
http11.c:77:50: error: âstruct RStringâ has no member named âlenâ
   for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
                                                  ^
http11.c: In function ârequest_uriâ:
http11.c:102:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(length, REQUEST_URI);
   ^
http11.c: In function âfragmentâ:
http11.c:113:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(length, FRAGMENT);
   ^
http11.c: In function ârequest_pathâ:
http11.c:124:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(length, REQUEST_PATH);
   ^
http11.c: In function âquery_stringâ:
http11.c:135:3: error: format not a string literal and no format arguments [-Werror=format-security]
   VALIDATE_MAX_LENGTH(length, QUERY_STRING);
   ^
In file included from /usr/include/string.h:635:0,
                 from /usr/include/ruby-2.1.0/ruby/defines.h:45,
                 from /usr/include/ruby-2.1.0/ruby/ruby.h:29,
                 from /usr/include/ruby-2.1.0/ruby.h:33,
                 from http11.c:5:
http11.c: In function âheader_doneâ:
http11.c:172:33: error: âstruct RStringâ has no member named âptrâ
     colon = strchr(RSTRING(temp)->ptr, ':');
                                 ^
http11.c:172:33: error: âstruct RStringâ has no member named âptrâ
     colon = strchr(RSTRING(temp)->ptr, ':');
                                 ^
http11.c:172:33: error: âstruct RStringâ has no member named âptrâ
     colon = strchr(RSTRING(temp)->ptr, ':');
                                 ^
http11.c:174:89: error: âstruct RStringâ has no member named âptrâ
       rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING(temp)->ptr));
                                                                                         ^
http11.c:176:52: error: âstruct RStringâ has no member named âptrâ
           rb_str_substr(temp, colon - RSTRING(temp)->ptr+1,
                                                    ^
    http11.c:177:26: error: âstruct RStringâ has no member named âlenâ
             RSTRING(temp)->len));
                          ^
http11.c: In function âHttpParser_executeâ:
http11.c:298:23: error: âstruct RStringâ has no member named âptrâ
   dptr = RSTRING(data)->ptr;
                       ^
http11.c:299:23: error: âstruct RStringâ has no member named âlenâ
   dlen = RSTRING(data)->len;
                       ^
http11.c:307:5: error: format not a string literal and no format arguments [-Werror=format-security]
     VALIDATE_MAX_LENGTH(http_parser_nread(http), HEADER);
     ^
cc1: some warnings being treated as errors
Makefile:224: recipe for target 'http11.o' failed
make: *** [http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.1.0/gems/mongrel-1.1.5 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/powerpc64le-linux/2.1.0/mongrel-1.1.5/gem_make.out
root#

From initial investigation it looks like the "-Werror=format-security" CFLAGS/CXXFLAGS in ext/http11/Makefile is exposing this error. Removing the same gets through the build. But that is not the right fix. The flag is default set in Ubuntu and RHEL build environments. Hence right fix would be to ensure actual code where the flag is reporting an error is rectified appropriately.

Here is short URL which has details on how to get LoP Hardware Access: https://ibm.biz/LoP_Access