Skip to content

Compilation Error with GCC 8 #85

@panthomakos

Description

@panthomakos

Gem compiles fine with GCC 7 but fails with GCC 8 with this error. It is reproducible on Ruby 2.4 as well as 2.3:

make  2>&1
make  all-am
make[1]: Entering directory '$HOME/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/zookeeper-1.4.11/ext/zkc-3.4.5/c'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.  -I./include -I./tests -I./generated  -Wall -Werror  -g -O2 -D_GNU_SOURCE -c -o zookeeper.lo `test -f 'src/zookeeper.c' || echo './'`src/zookeeper.c
mkdir .libs
 gcc -DHAVE_CONFIG_H -I. -I. -I. -I./include -I./tests -I./generated -Wall -Werror -g -O2 -D_GNU_SOURCE -c src/zookeeper.c  -fPIC -DPIC -o .libs/zookeeper.o
src/zookeeper.c: In function 'format_endpoint_info':
src/zookeeper.c:3440:21: error: '%d' directive writing between 1 and 5 bytes into a region of size between 0 and 127 [-Werror=format-overflow=]
     sprintf(buf,"%s:%d",addrstr,ntohs(port));
                     ^~
src/zookeeper.c:3440:17: note: directive argument in the range [0, 65535]
     sprintf(buf,"%s:%d",addrstr,ntohs(port));
                 ^~~~~~~
src/zookeeper.c:3440:5: note: 'sprintf' output between 3 and 134 bytes into a destination of size 128
     sprintf(buf,"%s:%d",addrstr,ntohs(port));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:754: zookeeper.lo] Error 1
make[1]: Leaving directory '$HOME/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/zookeeper-1.4.11/ext/zkc-3.4.5/c'
make: *** [Makefile:468: all] Error 2
*** extconf.rb failed ***

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions