On Feb 26, 8:20 pm, olegf...@gmail.com (Oleg Finkelshteyn) wrote:
> > I am trying to get 9vx compiled on SnowLeopard 10.6.2
>
> Andre has some problems posting to 9fans, but he says this should fix
> your problem:http://qcx.be/attic/9vx-osx-fix.patch
>
> -Oleg

Thanks for the patch,
I had to comment out some more stuff to get it working.. for anyone
interested following is the patch. This patch doesn't do much
otherthan making everything to compile as a 32-bit. This however only
solves the compilation part. 9vx crashes while launching acme,
resizing window etc (i.e nearly unusable). and this is true for the
9vx.OSX.gz binary in the mercurial repository.

=============diff -r c7e9b5edb8d4 src/9vx/Makefrag
--- a/src/9vx/Makefrag  Sun Dec 27 09:49:22 2009 -0800
+++ b/src/9vx/Makefrag  Sun Feb 28 11:43:12 2010 +0530
@@ -132,7 +132,7 @@
                screen.o \
                draw.o \
        )
-PLAN9_osx_LIBS = -ggdb -framework Carbon -framework QuickTime
+PLAN9_osx_LIBS = -m32 -ggdb -framework Carbon -framework QuickTime


 PLAN9_GUI_OBJS = $(PLAN9_$(PLAN9GUI)_OBJS)
diff -r c7e9b5edb8d4 src/9vx/a/dat.h
--- a/src/9vx/a/dat.h   Sun Dec 27 09:49:22 2009 -0800
+++ b/src/9vx/a/dat.h   Sun Feb 28 11:43:12 2010 +0530
@@ -1,3 +1,6 @@
+#if defined(__APPLE__)
+#define _XOPEN_SOURCE
+#endif
 #include <ucontext.h>
 #include "libvx32/vx32.h"

diff -r c7e9b5edb8d4 src/Makefrag
--- a/src/Makefrag      Sun Dec 27 09:49:22 2009 -0800
+++ b/src/Makefrag      Sun Feb 28 11:43:12 2010 +0530
@@ -5,6 +5,10 @@
 #COMMON_CFLAGS = -g -MD -std=gnu99 -I. $(CFLAGS)
 COMMON_LDFLAGS = -g -L. $(LDFLAGS)

+ifeq ($(OS),darwin)
+COMMON_CFLAGS := -m32 $(COMMON_CFLAGS)
+endif
+
 # Host environment compiler options
 HOST_CC                := $(CC) -fno-inline
 HOST_LD                := $(LD)
@@ -52,15 +56,24 @@


 # Include Makefrags for subdirectories
+# Don't try to build libvxc,vxrun,vxlinux,vxa,hash,micro or test on
darwin. It's broken beyond repair currently.
+
+ifneq ($(OS),darwin)
 include libvxc/Makefrag
+endif
+
 include libvx32/Makefrag
+ifneq ($(OS),darwin)
 include vxrun/Makefrag
 include vxlinux/Makefrag
 include vxa/Makefrag           # VXA decoders
 include hash/Makefrag          # cryptographic hash algorithms
 include micro/Makefrag         # microbenchmarks
+endif
 include 9vx/Makefrag   # Plan 9 VX
+ifneq ($(OS),darwin)
 include test/Makefrag          # vx32 tests
+endif

 DEPS_FILES := $(wildcard */*.d */*/*.d */*/*/*.d)
 CLEAN_FILES += .deps $(DEPS_FILES)
diff -r c7e9b5edb8d4 src/libvx32/Makefrag
--- a/src/libvx32/Makefrag      Sun Dec 27 09:49:22 2009 -0800
+++ b/src/libvx32/Makefrag      Sun Feb 28 11:43:12 2010 +0530
@@ -1,8 +1,8 @@
-ifeq ($(ARCH),x86_64)
-VX32_RUN = run64.o
-else
+#ifeq ($(ARCH),x86_64)
+#VX32_RUN = run64.o
+#else
 VX32_RUN = run32.o
-endif
+#endif

 ifeq ($(OS),darwin)
 VX32_RUN := $(VX32_RUN) darwin-asm.o
diff -r c7e9b5edb8d4 src/libvx32/darwin.c
--- a/src/libvx32/darwin.c      Sun Dec 27 09:49:22 2009 -0800
+++ b/src/libvx32/darwin.c      Sun Feb 28 11:43:12 2010 +0530
@@ -7,6 +7,9 @@
 #include <string.h>
 #include <signal.h>
 #include <assert.h>
+#if defined(__APPLE__)
+#define _XOPEN_SOURCE
+#endif
 #include <ucontext.h>
 #include <ucontext.h>
 #include <architecture/i386/table.h>
diff -r c7e9b5edb8d4 src/libvx32/sig.c
--- a/src/libvx32/sig.c Sun Dec 27 09:49:22 2009 -0800
+++ b/src/libvx32/sig.c Sun Feb 28 11:43:12 2010 +0530
@@ -1,4 +1,7 @@
 #include <sys/signal.h>
+#if defined(__APPLE__)
+#define _XOPEN_SOURCE
+#endif
 #include <ucontext.h>
 #include <stdio.h>
 #include <stdlib.h>
diff -r c7e9b5edb8d4 src/libvx32/vx32impl.h
--- a/src/libvx32/vx32impl.h    Sun Dec 27 09:49:22 2009 -0800
+++ b/src/libvx32/vx32impl.h    Sun Feb 28 11:43:12 2010 +0530
@@ -1,6 +1,10 @@
 #ifndef VX32_IMPL_H
 #define VX32_IMPL_H

+#if defined (__APPLE__) && !defined (_XOPEN_SOURCE)
+#define _XOPEN_SOURCE
+#endif
+
 #include <setjmp.h>
 #include <sys/signal.h>
 #include <ucontext.h>
=======================

Reply via email to