On Fri, Jun 27, 2008 at 8:17 AM, Russ Cox <r...@swtch.com> wrote:

> if you make clean
> and then edit the top-level src/Makefrag file to add -m32
> to the HOST_CFLAGS and then make 9vx/9vx
> you are likely to get a working binary.

I'm just trying this now. I was missing stubs-32.h on FC9.
I had to do this:

sudo yum install compat-gcc-34 compat-gcc-34-c++

It's a very important file; it has stuff like this in it :-)

#ifdef _LIBC
 #error Applications may not define the macro _LIBC
#endif

#define __stub___kernel_cosl
#define __stub___kernel_sinl
#define __stub___kernel_tanl
#define __stub_chflags
#define __stub_fattach
#define __stub_fchflags
#define __stub_fdetach
#define __stub_gtty
#define __stub_lchmod
#define __stub_revoke
#define __stub_setlogin
#define __stub_sigreturn
#define __stub_sstk
#define __stub_stty

Pretty!

I also had to do this:
diff -r a18e9872164b src/9vx/Makefrag
--- a/src/9vx/Makefrag  Wed Dec 10 03:29:15 2008 -0800
+++ b/src/9vx/Makefrag  Mon Apr 27 22:02:37 2009 -0700
@@ -124,7 +124,8 @@
                x11-kernel.o \
                x11-keysym2rune.o \
        )
-PLAN9_x11_LIBS = -L/usr/X11R6/lib -L/usr/local/lib -lX11
+#PLAN9_x11_LIBS = -L/usr/X11R6/lib -L/usr/local/lib -L/usr/lib -lX11
+PLAN9_x11_LIBS =  /usr/lib/libX11.so.6

 PLAN9_osx_OBJS =\
        $(addprefix 9vx/osx/, \
@@ -148,7 +149,7 @@
        libvx32/libvx32.a \

 9vx/9vx: $(PLAN9_DEPS)
-       $(HOST_CC) -o $@ $(PLAN9_DEPS) $(PLAN9_GUI_LIBS) -lpthread
+       $(HOST_CC) $(HOST_LDFLAGS) -o $@ $(PLAN9_DEPS) $(PLAN9_GUI_LIBS) 
-lpthread

 9vx/a/%.o: 9vx/a/%.c
        $(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall
-Wno-missing-braces -c -o $@ $<
diff -r a18e9872164b src/Makefrag
--- a/src/Makefrag      Wed Dec 10 03:29:15 2008 -0800
+++ b/src/Makefrag      Mon Apr 27 22:02:37 2009 -0700
@@ -1,9 +1,9 @@
 # Main top-level makefile fragment for the vx32 virtual machine.

 # Compiler flags common to both host and VX32 environment files.
-COMMON_CFLAGS = -g -O3 -MD -std=gnu99 -I. $(CFLAGS)
+COMMON_CFLAGS = -g -O3 -MD -std=gnu99 -I. $(CFLAGS) -m32
 #COMMON_CFLAGS = -g -MD -std=gnu99 -I. $(CFLAGS)
-COMMON_LDFLAGS = -g -L. $(LDFLAGS)
+COMMON_LDFLAGS = -g -L. $(LDFLAGS) -m32

 # Host environment compiler options
 HOST_CC                := $(CC)

Comments:
1. No, it can't find -lX11 even with a little hand-holding -L/usr/lib
to help it. Don't know, don't care...
2. It really seems to need HOST_LDFLAGS to work correctly on the
9vx/9vx link step.
3. It didn't work well for me unless I put -m32 on the COMMON_CFLAGS
4. I think what I'm doing with LDFLAGS is wrong wrong wrong

And, well, it builds. But it dies.

 9vx panic: user fault: signo=11 addr=0 [useraddr=28054000] read=1
eip=80c222a esp=d724cd5c
aborting, to dump core.

which is:
0x080c2228 <vxrun+24>:  mov    %eax,%es
0x080c222a <vxrun+26>:  mov    %eax,%ss

which makes sense I guess.

Anyway, I figure I'll go back and look some more. Probably reset my
changes first.

ron

Reply via email to