Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile on Solaris? #20

Closed
GoogleCodeExporter opened this issue Feb 13, 2016 · 16 comments
Closed

Compile on Solaris? #20

GoogleCodeExporter opened this issue Feb 13, 2016 · 16 comments

Comments

@GoogleCodeExporter
Copy link

Not sure what Im doing wrong here, would like to get this going for POC on
Solaris though (OS X local is fine) ... any ideas?

jon@ny-devbuild01% declare -x CC=gcc
jon@ny-devbuild01% /usr/sfw/bin/gmake 
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  adlist.c
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  ae.c
ae.c: In function `aeProcessEvents':
ae.c:210: warning: implicit declaration of function `memset'
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  anet.c
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  dict.c
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  redis.c
redis.c: In function `daemonize':
redis.c:2961: warning: int format, pid_t arg (arg 3)
redis.c: In function `loadDb':
redis.c:1520: warning: 'o' might be used uninitialized in this function
gcc -c -O2 -Wall -W -DSDS_ABORT_ON_OOM -g  sds.c
gcc -o redis-server -O2 -Wall -W -DSDS_ABORT_ON_OOM -g adlist.o ae.o anet.o
dict.o redis.o sds.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-server
collect2: ld returned 1 exit status
gmake: *** [redis-server] Error 1

Original issue reported on code.google.com by jonb...@gmail.com on 18 Mar 2009 at 7:57

@GoogleCodeExporter
Copy link
Author

Hello, I think you need something like -ldl -lnsl -lresolve and so on.
In SunOS this libs are not in the libc that is automatically linked against the
executable, so you need to specify this libs. Not an expert of Sun OS but hope 
this
helps.

Original comment by anti...@gmail.com on 18 Mar 2009 at 8:13

@GoogleCodeExporter
Copy link
Author

Leaving this issue open for other people reaching this page with the same 
Solaris
problem until we don't have documentation or different make targets

Original comment by anti...@gmail.com on 2 Apr 2009 at 7:58

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Compiling with this command: 

CC=/usr/sfw/bin/gcc CFLAGS="-pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM -ldl 
-lnsl -lsocket" gmake

Seems to work after the fix noted in issue 27. Compiling complains quite a bit 
though.

Also I'm getting a background saving error when running through tests. Speaking 
of tests Solaris fails when you 
run the test, so I'm running it from my OS X workstation.

Original comment by unilo...@gmail.com on 18 Apr 2009 at 8:41

@GoogleCodeExporter
Copy link
Author

See 
http://github.com/unilogic/redis/commit/bc18c02f958a45f868d345bd5afdb3893c874ca4
 for further 
patches regarding Solaris.

Original comment by unilo...@gmail.com on 19 Apr 2009 at 1:56

@GoogleCodeExporter
Copy link
Author

Tried to compile with 0.100 and hit some new problems.
First with pqsort, which has just been fixed by antirez (get latest from 
github).

Then pqsort.c still didn't compile, as "sys/cdefs.h" was not found on Solaris 
10.  I
just commented that include and then everything compiled (using unilogic's 
patches too).

But at startup redis-server core dumped:
signal BUS (invalid address alignment) in aeCreateEventLoop at line 49 in file 
"ae.c"
    49 eventLoop->timeEventNextId = 0;

I changed all "long long" to just "long" in ae.h and ae.c, and now redis-server
starts up without crashing.. don't know what the right solution is though.

Original comment by alan.har...@gmail.com on 28 May 2009 at 5:10

@GoogleCodeExporter
Copy link
Author

Tried the tests (found that they require tcl 8.4.. maybe mention that 
somewhere)..
several passed, then another crash:
signal BUS (invalid address alignment) in sortCommand at line 3451 in file 
"redis.c"
 3451                       vector[j].u.score = strtod(byval->ptr,NULL);

I changed the "double score" in redisSortObject to a float, and changed a couple
strtod calls to strtof.  Now all the tests pass.
(again, don't know what the "right" fix is... just reporting the problems I hit 
and
workarounds I found!)

Original comment by alan.har...@gmail.com on 28 May 2009 at 5:29

@GoogleCodeExporter
Copy link
Author

I worked on better fixes for compilation and word alignment problems:
http://github.com/alanharder/redis/commit/25091fb1996e3a18badb0e4a20fdeb4814d9f7
be
http://github.com/alanharder/redis/commit/f00df40f25c6e5d64d79357691a2c1afc9910b
5a

I submitted a "pull request" on github too (hopefully did it right).

Original comment by alan.har...@gmail.com on 11 Aug 2009 at 10:07

@GoogleCodeExporter
Copy link
Author

Salvatore, any chance we can get these fixes integrated? Solaris support is 
important
for us as we are a Solaris only shop.

Original comment by msemin...@gmail.com on 28 Sep 2009 at 3:28

@GoogleCodeExporter
Copy link
Author

I'm in the process of reviewing the patch in order to make sure it will not 
break any
other port. Thanks for submitting.

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

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Ok I reviewed this two patches:

http://github.com/alanharder/redis/commit/25091fb1996e3a18badb0e4a20fdeb48
14d9f7be
http://github.com/alanharder/redis/commit/f00df40f25c6e5d64d79357691a2c1afc
9910b5a

If this are all the changes needed I'll merge in five minutes. Just can try it 
myself as 
I've not accesso to Solaris. For the future in order to support Solaris better, 
if 
somebody may provide me with an ssh account in a Solaris box it will be really 
helpful.

Original comment by anti...@gmail.com on 26 Oct 2009 at 9:50

@GoogleCodeExporter
Copy link
Author

Ok patches merged. Thanks. Can you please verify the latest Redis from git is 
able to 
compile without issues on Solaris and passes the tests? Thanks.

Original comment by anti...@gmail.com on 26 Oct 2009 at 3:26

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

The fixes for issue with redis 1.001 look good.  Since then, one new issue.  
See:
http://lists.fourthought.com/pipermail/4suite/2005-August/007406.html
and the pages it links to:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19933
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02123.html

Ick, Solaris with isnan/isinf is not pretty.
I did get current git HEAD to compile and all tests pass by adding this to 
redis.c
just after include of <math.h>:

#if defined(__sun) && defined(__GNUC__)
#undef isnan
#define isnan(x) \
      __extension__({ __typeof (x) __x_a = (x); \
      __builtin_expect(__x_a != __x_a, 0); })

#undef isfinite
#define isfinite(x) \
      __extension__ ({ __typeof (x) __x_f = (x); \
      __builtin_expect(!isnan(__x_f - __x_f), 1); })

#undef isinf
#define isinf(x) \
      __extension__ ({ __typeof (x) __x_i = (x); \
      __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })
#endif

Original comment by alan.har...@gmail.com on 27 Oct 2009 at 5:06

@GoogleCodeExporter
Copy link
Author

Just pushed a fix for this, can you please try if it's working? Thanks.

p.s. now there is a solarisfixes.h where we can put this kind of fixes.

Original comment by anti...@gmail.com on 27 Oct 2009 at 5:40

@GoogleCodeExporter
Copy link
Author

Current git compiles fine and all tests pass, thanks!

Original comment by alan.har...@gmail.com on 29 Oct 2009 at 5:35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant