Subject: | Does not compile on Ubuntu 16.04 |
On a Ubuntu 16.04 I get the following compilation & linker error:
cc -fstack-protector-strong -L/usr/local/lib keyedmutexd/keyedmutexd.c -o keyedmutexd/keyedmutexd
keyedmutexd/keyedmutexd.c: In function âloopâ:
keyedmutexd/keyedmutexd.c:186:18: warning: implicit declaration of function âtimeâ [-Wimplicit-function-declaration]
time_t now = time(NULL);
^
keyedmutexd/keyedmutexd.c: At top level:
keyedmutexd/keyedmutexd.c:147:3: warning: âconn_key_offsetsâ is static but used in inline function âsetup_connâ which is not static
conn_key_offsets[i] = 0;
^
keyedmutexd/keyedmutexd.c:146:3: warning: âconn_statesâ is static but used in inline function âsetup_connâ which is not static
conn_states[i] = CS_KEYREAD;
^
keyedmutexd/keyedmutexd.c:78:19: warning: âwrite_logâ is static but used in inline function âclose_connâ which is not static
if (! no_log) write_log((fd), (status), (key)); \
^
keyedmutexd/keyedmutexd.c:141:3: note: in expansion of macro âLOGâ
LOG(fd, "closed", NULL);
^
keyedmutexd/keyedmutexd.c:78:11: warning: âno_logâ is static but used in inline function âclose_connâ which is not static
if (! no_log) write_log((fd), (status), (key)); \
^
keyedmutexd/keyedmutexd.c:141:3: note: in expansion of macro âLOGâ
LOG(fd, "closed", NULL);
^
keyedmutexd/keyedmutexd.c:136:23: warning: âconns_lengthâ is static but used in inline function âclose_connâ which is not static
if (conn_states[conns_length - 1] != CS_NOCONN) {
^
keyedmutexd/keyedmutexd.c:136:11: warning: âconn_statesâ is static but used in inline function âclose_connâ which is not static
if (conn_states[conns_length - 1] != CS_NOCONN) {
^
keyedmutexd/keyedmutexd.c:135:48: warning: âconns_lengthâ is static but used in inline function âclose_connâ which is not static
for (conns_length -= 1; conns_length != 0; conns_length--) {
^
keyedmutexd/keyedmutexd.c:135:29: warning: âconns_lengthâ is static but used in inline function âclose_connâ which is not static
for (conns_length -= 1; conns_length != 0; conns_length--) {
^
keyedmutexd/keyedmutexd.c:135:10: warning: âconns_lengthâ is static but used in inline function âclose_connâ which is not static
for (conns_length -= 1; conns_length != 0; conns_length--) {
^
keyedmutexd/keyedmutexd.c:134:16: warning: âconns_lengthâ is static but used in inline function âclose_connâ which is not static
if (i + 1 == conns_length) {
^
keyedmutexd/keyedmutexd.c:133:3: warning: âconn_statesâ is static but used in inline function âclose_connâ which is not static
conn_states[i] = CS_NOCONN;
^
keyedmutexd/keyedmutexd.c:131:16: warning: âlisten_fdâ is static but used in inline function âclose_connâ which is not static
int fd = i + listen_fd + 1;
^
/var/tmp/cpansmoker-1002/2017011515/ccA7ndSU.o: In function `notify_nonowners':
keyedmutexd.c:(.text+0x203): undefined reference to `close_conn'
keyedmutexd.c:(.text+0x22c): undefined reference to `setup_conn'
/var/tmp/cpansmoker-1002/2017011515/ccA7ndSU.o: In function `loop':
keyedmutexd.c:(.text+0x51e): undefined reference to `nodelay'
keyedmutexd.c:(.text+0x5aa): undefined reference to `setup_conn'
keyedmutexd.c:(.text+0x72b): undefined reference to `close_conn'
keyedmutexd.c:(.text+0x78e): undefined reference to `key2i'
keyedmutexd.c:(.text+0x9bc): undefined reference to `close_conn'
keyedmutexd.c:(.text+0x9ce): undefined reference to `setup_conn'
keyedmutexd.c:(.text+0xa77): undefined reference to `close_conn'
keyedmutexd.c:(.text+0xaca): undefined reference to `close_conn'
/var/tmp/cpansmoker-1002/2017011515/ccA7ndSU.o: In function `main':
keyedmutexd.c:(.text+0xf38): undefined reference to `reuse_addr'
keyedmutexd.c:(.text+0xf4a): undefined reference to `nonblock'
keyedmutexd.c:(.text+0xfe0): undefined reference to `nonblock'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'keyedmutexd/keyedmutexd' failed
make: *** [keyedmutexd/keyedmutexd] Error 1
Maybe it's a problem of the newer compiler used here (gcc 5.4.0)?