2017년 3월 22일 수요일

CentOS 7.x mod_cband compile error

CentOS 7.x mod_cband compile error



# ./configure
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

# yum install gcc

# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
checking for apr_palloc in -laprutil... no
checking for an ANSI C-conforming const... yes
checking for apxs... no
checking for apxs2... no
configure: error: apxs missing

# yum install httpd-devel


# make

apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -Wall -DDST_CLASS=3  -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1054:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
               ^
src/mod_cband.c:1054:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
                                                 ^
src/mod_cband.c:1058:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
               ^
src/mod_cband.c:1058:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
                                                 ^
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1333:47: error: 'conn_rec' has no member named 'remote_ip'
     p.add.sin.s_addr = inet_addr(r->connection->remote_ip);
                                               ^
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1362:10: error: 'struct conn_rec' has no member named 'remote_i '
     if (c->remote_ip != NULL)
          ^
src/mod_cband.c:1363:20: error: 'struct conn_rec' has no member named 'remote_i '
  addr = inet_addr(c->remote_ip);
                    ^
src/mod_cband.c:1365:10: error: 'struct conn_rec' has no member named 'remote_addr'
  addr = c->remote_addr->sa.sin.sin_addr.s_addr;
          ^
src/mod_cband.c: In function 'mod_cband_update_speed':
src/mod_cband.c:1905:19: warning: variable 'time_last_request' set but not used [-Wunused-but-set-variable]
     unsigned long time_last_request;
                   ^
src/mod_cband.c: In function 'mod_cband_check_connections_speed':
src/mod_cband.c:2963:19: warning: variable 'time_now' set but not used [-Wunused-but-set-variable]
     unsigned long time_now;
                   ^
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1


# sed -i 's/remote_ip/client_ip/g' ./src/mod_cband.c
# sed -i 's/c->remote_addr/c->client_addr/g' ./src/mod_cband.c
# make
# make install