vjzning / redis

Automatically exported from code.google.com/p/redis
https://code.google.com/p/redis/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Unable to compile on Mac OS X Leopard (running on a PowerPC G4) #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. git clone git://github.com/antirez/redis.git
2. cd redis
3. make

What is the expected output? What do you see instead?
anakin:redis jcouture$ make
cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdynamic -ggdb   adlist.c
cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdynamic -ggdb   ae.c
cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdynamic -ggdb   anet.c
cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdynamic -ggdb   dict.c
cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdynamic -ggdb   redis.c
redis.c: In function 'getMcontextEip':
redis.c:6226: error: 'struct __darwin_ppc_thread_state' has no member 
named '__eip'
make: *** [redis.o] Error 1

What version of the product are you using? On what operating system?
anakin:redis jcouture$ uname -a
Darwin anakin.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 
PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh

Please provide any additional information below.

Original issue reported on code.google.com by jcout...@gmail.com on 5 Dec 2009 at 8:59

GoogleCodeExporter commented 9 years ago
I am not a C programmer, but here is a temporary fix I came up with to compile 
Redis 
on Mac OS X 10.5 (PPC). I am not saying this is the best way to patch this 
problem, but 
it will do for now.

Original comment by jcout...@gmail.com on 8 Dec 2009 at 11:16

Attachments:

GoogleCodeExporter commented 9 years ago
I was also experiencing this problem when trying to install Redis 1.2.1 from 
MacPorts on a PowerMac G5 
running Mac OS X 10.5.8. Thankfully a solution (involving a one-line change to 
redis.c) exists: 
http://trac.macports.org/ticket/20295#comment:9

Original comment by arto.ben...@gmail.com on 5 Feb 2010 at 3:19

GoogleCodeExporter commented 9 years ago
the fix from arto.bendiken seems to work for me, mac mini, PowerPC G4, Mac OS X 
10.5 (Leopard)

Original comment by nunog...@gmail.com on 13 Mar 2010 at 9:12

GoogleCodeExporter commented 9 years ago
The underlying problem is that redis.c is mucking around with the thread 
context and CPU registers, which of course is CPU-specific.  Here is the fix 
for redis-2.0.0-rc4:

1. edit redis.c
2. go to line 10838.
3. Change the "#else" to "#elsif defined (__i386__)"
4. Below line 10839 add the following:
    #else
      return (void*) uc->uc_mcontext->__ss.__srr0;

The final version should look like this:

    #if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
      return (void*) uc->uc_mcontext->__ss.__rip;
    #elif defined (__i386__)
      return (void*) uc->uc_mcontext->__ss.__eip;
    #else
      return (void*) uc->uc_mcontext->__ss.__srr0;
    #endif

You should now be able to compile with the following command:

    CFLAGS='-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -arch ppc -sysroot=/Developer/SDKs/MacOSX10.5.sdk' make

Original comment by paho...@gmail.com on 2 Aug 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Attaching a diff based on comment 4.

Original comment by joshua.r...@gmail.com on 12 Nov 2010 at 5:00

Attachments:

GoogleCodeExporter commented 9 years ago
I've successfully compiled with this patch and

make OBJARCH="-arch ppc" ARCH="-arch ppc"

Original comment by ktoka...@smartlabs.tv on 31 Aug 2011 at 8:55

GoogleCodeExporter commented 9 years ago
Thanks for the patch, finally applied.

Original comment by anti...@gmail.com on 20 Sep 2011 at 9:00