> > "make shared" dies with 'missing .h files'
>
> More competent and/or Windows-savvy hands than mine are working on this as
> we speak.
I believe the proper term is stubbornly persistent. Attached is a patch to
fix up parrot shared-libraries, imcc, and perl6 all to work on win32.

It currently works on my version of MSVC with nmake and friends. A few
minutes ago, it worked on cygwin/GCC as well. Unfortunately, I broke
something, I'm not sure what, and it doesn't work on cygwin anymore. I'm
going to sleep now, and will probably pick up again on this tomorrow
night.

Is getting perl6 working on win32 a priority for 0.0.8? I wouldn't want to
commit code to fix known problems the night before 0.0.8 ships, since
there are some people who are adamantly against that.

This code will probably only work on unix/win32 when it is done. From what
I can tell, it only worked on unix to begin with (due to
shared-library/dynamic-loading usage), so I believe this is an
improvement. :)

Some of the steps taken in this patch could be deemed hacks. Some people
are of the opinion that this is okay if it gets perl6 working on win32 for
0.0.8. I'm rather unfamiliar with how cross-platform makefile weirdness
should be resolved, so I'd appreciate any advice on how to fix up some of
the issues. (see imcc.y MSC_VER ifdef's, root.in's LD_SHARED_FLAGS,
root.in's ${blib_lib_libparrot_a, and libparrot.def})

Any of the win32 folk out there want to try this patch and see if it
resolves any issues for you?

Thanks,
Mike Lambert
Index: config/gen/makefiles.pl

===================================================================

RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v

retrieving revision 1.2

diff -u -r1.2 makefiles.pl

--- config/gen/makefiles.pl     29 Jul 2002 04:41:24 -0000      1.2

+++ config/gen/makefiles.pl     26 Aug 2002 08:14:15 -0000

@@ -17,6 +17,7 @@

   genfile('config/gen/makefiles/miniperl.in',  'languages/miniperl/Makefile');

   genfile('config/gen/makefiles/scheme.in',    'languages/scheme/Makefile');

   genfile('config/gen/makefiles/perl6.in',     'languages/perl6/Makefile');

+  genfile('config/gen/makefiles/imcc.in',      'languages/imcc/Makefile');

 }

 

 1;

Index: config/gen/makefiles/root.in

===================================================================

RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v

retrieving revision 1.24

diff -u -r1.24 root.in

--- config/gen/makefiles/root.in        25 Aug 2002 23:39:15 -0000      1.24

+++ config/gen/makefiles/root.in        26 Aug 2002 08:14:16 -0000

@@ -1,12 +1,13 @@

 O = ${o}

-SO = .so

-A = .a

+SO = ${so}

+A = ${a}

 RM_F = ${rm_f}

 RM_RF = ${rm_rf}

 AR_CRS = ar crs

 LD = ${ld}

 LD_SHARED = ${ld_shared}

 LD_OUT = ${ld_out}

+LD_SHARED_FLAGS=${ld_shared_flags}

 

 INC=include/parrot

 

@@ -158,10 +159,6 @@

 

 mops : examples/assembly/mops${exe} examples/mops/mops${exe}

 

-# XXX Unix-only for now

-libparrot$(A) : $(O_DIRS) $(O_FILES)

-       $(AR_CRS) $@ $(O_FILES)

-

 $(TEST_PROG) : test_main$(O) $(GEN_HEADERS) $(O_DIRS) $(O_FILES) 
lib/Parrot/OpLib/core.pm lib/Parrot/PMC.pm

        $(LD) ${ld_out}$(TEST_PROG) $(LDFLAGS) $(O_FILES) test_main$(O) $(C_LIBS)

 

@@ -180,50 +177,60 @@

 #

 # Shared Library Targets:

 #

-# XXX This target is not portable to Win32

-#

 ###############################################################################

 

 blib :

-       mkdir -p blib

-

-blib_lib :

-       mkdir -p blib/lib

+       -mkdir blib

 

-shared : blib_lib blib/lib/libparrot$(SO) blib/lib/libcore_prederef$(SO) 
$(TEST_PROG_SO)

+blib_lib : blib

+       -mkdir blib${slash}lib

 

-blib/lib/libparrot$(SO).${VERSION} : blib_lib $(O_DIRS) $(O_FILES)

-       $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS) 
$(LD_OUT)blib/lib/libparrot$(SO).${VERSION} $(O_FILES)

+shared : blib_lib blib/lib/libparrot$(SO) ${blib_lib_libparrot_a} $(TEST_PROG_SO)

 

-blib/lib/libparrot$(SO).${MAJOR}.${MINOR} : blib/lib/libparrot$(SO).${VERSION}

-       $(RM_F) $@

-       cd blib/lib; ln -s libparrot$(SO).${VERSION} libparrot$(SO).${MAJOR}.${MINOR}

-

-blib/lib/libparrot$(SO).${MAJOR} : blib/lib/libparrot$(SO).${MAJOR}.${MINOR}

-       $(RM_F) $@

-       cd blib/lib; ln -s libparrot$(SO).${MAJOR}.${MINOR} libparrot$(SO).${MAJOR}

-

-blib/lib/libparrot$(SO) : blib/lib/libparrot$(SO).${MAJOR}

-       $(RM_F) $@

-       cd blib/lib; ln -s libparrot$(SO).${MAJOR} libparrot$(SO)

-

-blib/lib/libcore_prederef$(SO).${VERSION} : blib_lib core_ops_prederef$(O)

-       $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS) 
$(LD_OUT)blib/lib/libcore_prederef$(SO).${VERSION} core_ops_prederef$(O)

+# XXX Unix-only for now

+blib/lib/libparrot$(A) : $(O_DIRS) $(O_FILES)

+       $(AR_CRS) $@ $(O_FILES)

 

-blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR} : 
blib/lib/libcore_prederef$(SO).${VERSION}

-       $(RM_F) $@

-       cd blib/lib; ln -s libcore_prederef$(SO).${VERSION} 
libcore_prederef$(SO).${MAJOR}.${MINOR}

+blib/lib/libparrot$(SO) : blib_lib $(O_DIRS) $(O_FILES)

+       $(LD) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS) 
+$(LD_OUT)blib/lib/libparrot$(SO) $(O_FILES) $(C_LIBS)

 

-blib/lib/libcore_prederef$(SO).${MAJOR} : 
blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR}

-       $(RM_F) $@

-       cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR}.${MINOR} 
libcore_prederef$(SO).${MAJOR}

+$(TEST_PROG_SO) : test_main$(O) blib/lib/libparrot$(SO) lib/Parrot/OpLib/core.pm 
+lib/Parrot/PMC.pm

+       $(LD) $(LD_OUT)$(TEST_PROG) test_main$(O) blib/lib/libparrot$(A) $(LDFLAGS) 
+$(C_LIBS)

 

-blib/lib/libcore_prederef$(SO) : blib/lib/libcore_prederef$(SO).${MAJOR}

-       $(RM_F) $@

-       cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR} libcore_prederef$(SO)

+# XXX The dependancies on SO.MAJOR.MINOR and SO.VERSION are removed 

+#     because those should be done at "make install" and not "make shared"

+#     It also makes the task of getting this working on win32 much easier. :)

+#

+#blib/lib/libparrot$(SO).${VERSION} : blib_lib $(O_DIRS) $(O_FILES)

+#      $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS) 
+$(LD_OUT)blib/lib/libparrot$(SO).${VERSION} $(O_FILES)

+#

+#blib/lib/libparrot$(SO).${MAJOR}.${MINOR} : blib/lib/libparrot$(SO).${VERSION}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libparrot$(SO).${VERSION} libparrot$(SO).${MAJOR}.${MINOR}

+#

+#blib/lib/libparrot$(SO).${MAJOR} : blib/lib/libparrot$(SO).${MAJOR}.${MINOR}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libparrot$(SO).${MAJOR}.${MINOR} libparrot$(SO).${MAJOR}

+#

+#blib/lib/libparrot$(SO) : blib/lib/libparrot$(SO).${MAJOR}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libparrot$(SO).${MAJOR} libparrot$(SO)

+#

+#blib/lib/libcore_prederef$(SO).${VERSION} : blib_lib core_ops_prederef$(O)

+#      $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS) 
+$(LD_OUT)blib/lib/libcore_prederef$(SO).${VERSION} core_ops_prederef$(O)

+#

+#blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR} : 
+blib/lib/libcore_prederef$(SO).${VERSION}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libcore_prederef$(SO).${VERSION} 
+libcore_prederef$(SO).${MAJOR}.${MINOR}

+#

+#blib/lib/libcore_prederef$(SO).${MAJOR} : 
+blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR}.${MINOR} 
+libcore_prederef$(SO).${MAJOR}

+#

+#blib/lib/libcore_prederef$(SO) : blib/lib/libcore_prederef$(SO).${MAJOR}

+#      $(RM_F) $@

+#      cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR} libcore_prederef$(SO)

 

-$(TEST_PROG_SO) : test_main$(O) blib/lib/libparrot$(SO) lib/Parrot/OpLib/core.pm 
lib/Parrot/PMC.pm

-       $(LD) $(LD_OUT)$(TEST_PROG) test_main$(O) $(LDFLAGS) $(C_LIBS) -L blib/lib 
-lparrot

 

 #

 # Parrot Debugger

Index: config/init/data.pl

===================================================================

RCS file: /cvs/public/parrot/config/init/data.pl,v

retrieving revision 1.3

diff -u -r1.3 data.pl

--- config/init/data.pl 22 Aug 2002 21:55:41 -0000      1.3

+++ config/init/data.pl 26 Aug 2002 08:14:16 -0000

@@ -29,6 +29,8 @@

     cc_debug      => '-g',

     cc_warn       => '',

     o             => '.o',                # object files extension

+    so            => '.so',               # dynamic link library or shared object 
+extension

+    a             => '.a',                # library or archive extension

     exe           => $Config{_exe},       # executable files extension

     cc_o_out      => '-o ',               # cc object output file

     cc_exe_out    => '-o ',               # cc executable output file (different on 
Win32)

@@ -38,6 +40,10 @@

     ld_out        => '-o ',               # ld output file

     ld_debug      => '',                  # include debug info in executable

     ld_shared     => '-shared',

+    ld_shared_flags=> '-Wl,-soname,libparrot$(SO)',

+

+    # should we have a dependancy upon arc to generate .a's?

+    blib_lib_libparrot_a => 'blib/lib/libparrot$(A)',

     

     perl          => $^X,

     test_prog     => 'parrot',

Index: config/init/hints/mswin32.pl

===================================================================

RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v

retrieving revision 1.1

diff -u -r1.1 mswin32.pl

--- config/init/hints/mswin32.pl        24 May 2002 06:24:27 -0000      1.1

+++ config/init/hints/mswin32.pl        26 Aug 2002 08:14:16 -0000

@@ -20,6 +20,8 @@

                $ccflags =~ s/-O1 // if $cc_output =~ m/Standard/;

 

                Configure::Data->set(

+      so         => '.dll',

+      a          => '.lib',

                        o          => '.obj',

                        cc_o_out   => '-Fo',

                        cc_exe_out => '-Fe',

@@ -27,7 +29,9 @@

                        cc_debug   => '-Zi',

                        ld_debug   => '-debug',

                        ld_shared  => '-dll',

+      ld_shared_flags=> '-def:libparrot.def',

                        ld_out     => '-out:',

+      blib_lib_libparrot_a => '',

                        cp         => 'copy',

                        slash      => '\\',

                        ccflags    => $ccflags

@@ -46,7 +50,7 @@

                        ld_out => '-e',

                        cc_ldflags => '',

                        ld_debug => '-v',

-                       ld_shard => '-WD',

+                       ld_shared => '-WD',

                        libs => 'import32.lib cw32.lib',

                        

                        cp => 'copy',

Index: languages/imcc/anyop.c

===================================================================

RCS file: /cvs/public/parrot/languages/imcc/anyop.c,v

retrieving revision 1.1

diff -u -r1.1 anyop.c

--- languages/imcc/anyop.c      25 Aug 2002 15:18:53 -0000      1.1

+++ languages/imcc/anyop.c      26 Aug 2002 08:14:20 -0000

@@ -1,4 +1,12 @@

-#include <sysexits.h>

+#ifndef _MSC_VER

+#  include <sysexits.h>

+#else

+#  define EX_DATAERR 1

+#  define EX_SOFTWARE 1

+#  define EX_NOINPUT 1

+#  define EX_IOERR 1

+#  define EX_UNAVAILABLE 1

+#endif

 #include <stdarg.h>

 

 #include "anyop.h"

Index: languages/imcc/imcc.l

===================================================================

RCS file: /cvs/public/parrot/languages/imcc/imcc.l,v

retrieving revision 1.7

diff -u -r1.7 imcc.l

--- languages/imcc/imcc.l       24 Aug 2002 23:29:50 -0000      1.7

+++ languages/imcc/imcc.l       26 Aug 2002 08:14:21 -0000

@@ -72,10 +72,10 @@

 "goto"          return(GOTO);

 "if"            return(IF);

 "unless"        return(UNLESS);

-"int"           return(INT);

+"int"           return(INTV);

 "inc"           return(INC);

 "dec"           return(DEC);

-"float"         return(FLOAT);

+"float"         return(FLOATV);

 "new"           return(NEW);

 "defined"       return(DEFINED);

 "addr"          return(ADDR);

Index: languages/imcc/imcc.y

===================================================================

RCS file: /cvs/public/parrot/languages/imcc/imcc.y,v

retrieving revision 1.14

diff -u -r1.14 imcc.y

--- languages/imcc/imcc.y       24 Aug 2002 23:29:50 -0000      1.14

+++ languages/imcc/imcc.y       26 Aug 2002 08:14:21 -0000

@@ -12,7 +12,15 @@

 #include <string.h>

 #include <stdio.h>

 #include <stdlib.h> 

-#include <sysexits.h>

+#ifndef _MSC_VER

+#  include <sysexits.h>

+#else

+#  define EX_DATAERR 1

+#  define EX_SOFTWARE 1

+#  define EX_NOINPUT 1

+#  define EX_IOERR 1

+#  define EX_UNAVAILABLE 1

+#endif

 #include <assert.h>

 #include "imc.h"

 #include "anyop.h"

@@ -467,7 +475,7 @@

 

 %token <i> CALL GOTO BRANCH ARG RET PRINT IF UNLESS NEW END SAVEALL RESTOREALL

 %token <i> SUB NAMESPACE CLASS ENDCLASS SYM LOCAL PARAM PUSH POP INC DEC

-%token <i> SHIFT_LEFT SHIFT_RIGHT INT FLOAT STRINGV DEFINED LOG_XOR

+%token <i> SHIFT_LEFT SHIFT_RIGHT INTV FLOATV STRINGV DEFINED LOG_XOR

 %token <i> RELOP_EQ RELOP_NE RELOP_GT RELOP_GTE RELOP_LT RELOP_LTE

 %token <i> GLOBAL ADDR CLONE RESULT RETURN POW

 %token <i> COMMA

@@ -558,8 +566,8 @@

     ;

 

 type:

-        INT { $$ = 'I'; }

-    |   FLOAT { $$ = 'N'; }

+        INTV { $$ = 'I'; }

+    |   FLOATV { $$ = 'N'; }

     |   STRINGV { $$ = 'S'; }

     |   classname { $$ = 'P'; }

     ;

@@ -702,8 +710,13 @@

    

     if (IMCC_DEBUG)

        fprintf(stderr, "loading libs...");

+#ifdef _MSC_VER

+    op_load_file("../../blib/lib/libparrot.dll");

+#else

     op_load_file("../../blib/lib/libparrot.so");

-    op_load_lib("core", 0, 0, 7);

+#endif

+    op_load_lib("core", PARROT_MAJOR_VERSION, PARROT_MINOR_VERSION,

+                        PARROT_PATCH_VERSION);

     if (IMCC_DEBUG)

        fprintf(stderr, "done\n");

 

LIBRARY libparrot

DESCRIPTION 'Parrot Interpreter'

EXPORTS

        Parrot_new

        Parrot_init

        Parrot_setflag

        Parrot_setwarnings

        Parrot_readbc

        Parrot_loadbc

        Parrot_runcode

        Parrot_destroy

        Parrot_debug

        Parrot_disassemble

        Parrot_DynOp_core_0_0_7
O = ${o}

RM_F = ${rm_f}



INC=../../include/parrot



H_FILES = $(INC)/parrot.h imc.h imcparser.h stacks.h cfg.h \

        instructions.h cfg.h debug.h sets.h anyop.h





O_FILES = imcparser$(O) imclexer$(O) imc$(O) stacks$(O) symreg$(O) \

        instructions$(O) cfg$(O) sets$(O) debug$(O) anyop$(O) \

        ../../platform$(O)



#DO NOT ADD C COMPILER FLAGS HERE

#Add them in Configure.pl--look for the

#comment 'ADD C COMPILER FLAGS HERE'

CFLAGS = ${ccflags} -I../../include



C_LIBS = ${libs}



CC = ${cc}

PERL = ${perl}

MAKE_F=${make}

YACC = bison -v -y

LEX = flex



LD = ${ld}

LD_SHARED = ${ld_shared}

LD_OUT = ${ld_out}



all : imcc

        cd ../.. && $(MAKE) shared && $(RM_F) parrot${exe} && $(MAKE)



imcparser.c imcparser.h : imcc.y

        $(YACC) -d -o imcparser.c imcc.y



imclexer.c : imcc.l $(HEADERS)

        $(LEX) imcc.l



.c$(O):

        $(CC) $(CFLAGS) ${cc_exe_out}$@ -c $<



clean:

        $(RM_F) core

        $(RM_F) $(O_FILES)

        $(RM_F) imcparser.output

        $(RM_F) imcc



realclean: clean

        $(RM_F) a.pasm

        $(RM_F) imcparser.*

        $(RM_F) imclexer.*



imcc: $(O_FILES)

        $(LD) $(LD_OUT)imcc $(LDFLAGS) $(O_FILES) $(C_LIBS)

Reply via email to