coolexp / redis

Automatically exported from code.google.com/p/redis
0 stars 0 forks source link

anet.c compile on solaris, resource.h incomplete type #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
another solaris build issue, doesn't appear to be related to the previous - i'm 
getting hung up in anet.c on 
what appears to be a header conflict.

% uname -a
SunOS madrone 5.11 snv_67 i86pc i386 i86pc
% gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% export CC=gcc && make
rm -rf redis-server redis-benchmark redis-cli *.o
gcc -c    adlist.c
gcc -c    ae.c
gcc -c    anet.c
In file included from /usr/include/sys/vnode.h:50,
                 from /usr/include/sys/stream.h:39,
                 from /usr/include/netinet/in.h:66,
                 from /usr/include/sys/socket.h:52,
                 from anet.c:34:
/usr/include/sys/resource.h:172: error: field `ru_utime' has incomplete type
/usr/include/sys/resource.h:173: error: field `ru_stime' has incomplete type
*** Error code 1
make: Fatal error: Command failed for target `anet.o'
% gmake
gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  anet.c
In file included from 
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/sys/types.h:44,
                 from anet.c:33:
/usr/include/sys/feature_tests.h:353:2: #error "Compiler or options invalid for 
pre-UNIX 03 X/Open 
applications    
and pre-2001 POSIX applications"
In file included from /usr/include/sys/vnode.h:50,
                 from /usr/include/sys/stream.h:39,
                 from /usr/include/netinet/in.h:66,
                 from /usr/include/sys/socket.h:52,
                 from anet.c:34:
/usr/include/sys/resource.h:172: error: field `ru_utime' has incomplete type
/usr/include/sys/resource.h:173: error: field `ru_stime' has incomplete type
gmake: *** [anet.o] Error 1

Original issue reported on code.google.com by jeanpie...@gmail.com on 9 Apr 2009 at 12:58

GoogleCodeExporter commented 8 years ago
Adding #define __EXTENSIONS__ to redis.c and anet.c seems to fix this. Not sure 
if this is correct though.

Original comment by unilo...@gmail.com on 18 Apr 2009 at 7:26

GoogleCodeExporter commented 8 years ago
cheers, your fork on github builds and runs for me on solaris, though it fails 
to build on mac os x:
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  adlist.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  ae.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  anet.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  dict.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  redis.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  sds.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  zmalloc.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  lzf_c.c
cc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 -g  lzf_d.c
cc -o redis-server -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-ldl -lnsl -lsocket -g 
adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o
ld: library not found for -lnsl
collect2: ld returned 1 exit status
make: *** [redis-server] Error 1

antirez - any chance you could integrate the changes into the mainline, needed 
for solaris support?

Original comment by jeanpie...@gmail.com on 25 Apr 2009 at 4:07

GoogleCodeExporter commented 8 years ago
applying bc18c02f:
  http://github.com/unilogic/redis/commit/bc18c02f958a45f868d345bd5afdb3893c874ca4
onto mainline git HEAD, redis-server and benchmark build and run but redis-cli 
does not and there are several perhaps 
concerning warnings

% CC=/usr/sfw/bin/gcc gmake
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  adlist.c
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  ae.c
ae.c: In function `aeProcessEvents':
ae.c:211: warning: implicit declaration of function `memset'
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  anet.c
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  dict.c
dict.c: In function `dictGetRandomKey':
dict.c:382: warning: implicit declaration of function `random'
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  redis.c
redis.c: In function `daemonize':
redis.c:3781: warning: int format, pid_t arg (arg 3)
redis.c: In function `rdbLoad':
redis.c:2033: warning: 'o' might be used uninitialized in this function
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  sds.c
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  zmalloc.c
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  lzf_c.c
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  lzf_d.c
/usr/sfw/bin/gcc -o redis-server -std=c99 -pedantic -O2 -Wall -W 
-DSDS_ABORT_ON_OOM -D_XPG6 -ldl -lnsl -lsocket -
g adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o

Hint: To run the test-redis.tcl script is a good idea.
Launch the redis server with ./redis-server, then in another
terminal window enter this directory and run 'make test'.

/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  benchmark.c
/usr/sfw/bin/gcc -o redis-benchmark -std=c99 -pedantic -O2 -Wall -W 
-DSDS_ABORT_ON_OOM -D_XPG6 -ldl -lnsl -
lsocket -g ae.o anet.o benchmark.o sds.o adlist.o zmalloc.o
/usr/sfw/bin/gcc -c -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -D_XPG6 
-g  redis-cli.c
redis-cli.c: In function `lookupCommand':
redis-cli.c:116: warning: implicit declaration of function `strcasecmp'
/usr/sfw/bin/gcc -o redis-cli -std=c99 -pedantic -O2 -Wall -W 
-DSDS_ABORT_ON_OOM -D_XPG6 -g anet.o sds.o adlist.o 
redis-cli.o zmalloc.o
Undefined                       first referenced
 symbol                             in file
bind                                anet.o
accept                              anet.o
listen                              anet.o
gethostbyname                       anet.o
socket                              anet.o
setsockopt                          anet.o
connect                             anet.o
inet_aton                           anet.o
inet_ntoa                           anet.o
ld: fatal: Symbol referencing errors. No output written to redis-cli
collect2: ld returned 1 exit status
gmake: *** [redis-cli] Error 1

Original comment by jeanpie...@gmail.com on 25 Apr 2009 at 4:19

GoogleCodeExporter commented 8 years ago
there is already an open issue for this problems.

Original comment by anti...@gmail.com on 23 Oct 2009 at 12:43