On Oct 13, 2004, at 6:36 PM, Will Coleda (via RT) wrote:

# New Ticket Created by  Will Coleda
# Please include the string:  [perl #31978]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31978 >


One of the recent changes has broken:

cd dynclasses && make

Which did, in fact, work for all of one checkout for me. =-)

This is on a fresh checkout (not update), configure, make, cd dynclasses and...
...
/Users/coke/research/parrot2/include/parrot/interpreter.h:61: error: conflicting
types for `typedef struct Parrot_Interp*Parrot_Interp'
/Users/coke/research/parrot2/include/parrot/platform_interface.h:124: error: previous
declaration as `struct Parrot_Interp'

The below patch should fix this.

The problem is that ${ld} for Mac OS X became 'c++' because that's needed to link libparrot.dylib since ICU contains C++ code. But, dynclasses/build.pl tried to take a shortcut, and compile and link in one step. This caused a problem, because the c++ compiler was choking on an odd typedef of ours. So we need to build with just a C compiler. (We could probably link with one in this case too, but we don't have separate configs for linking the stuff in dynclasses, v. everything else.)

So the fix here is just to compile and link as separate steps, always, rather than only when we need to combine multiple .o files.

At the same time, I'm not sure why we need this construct in a header:

        struct Parrot_Interp;

        typedef struct Parrot_Interp *Parrot_Interp;

I'm not surprised that chokes a C++ compiler, but I don't know why a C compiler tolerates it either. Not sure why this is necessary--I wonder if we could do something a bit less tricky?

JEff

Index: config/gen/makefiles/dynclasses_pl.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses_pl.in,v
retrieving revision 1.2
diff -u -b -r1.2 dynclasses_pl.in
--- config/gen/makefiles/dynclasses_pl.in 8 Oct 2004 07:08:31 -0000 1.2
+++ config/gen/makefiles/dynclasses_pl.in 14 Oct 2004 06:08:27 -0000
@@ -13,14 +13,6 @@
our $PMC2C = "$PERL ${build_dir}${slash}classes${slash}pmc2c2.pl";


 # Actual commands
-sub compile_loadable_cmd {
-    my ($target, $source) = @_;
-    "$LD $CFLAGS $LDFLAGS $LD_LOAD_FLAGS " .
-    "${cc_o_out}" . $target . " " .
-    "-I${build_dir}${slash}include -I${build_dir}${slash}classes " .
-    $source;
-};
-
 sub compile_cmd {
     my ($target, $source) = @_;
     "$CC $CFLAGS " .
@@ -58,14 +50,8 @@
 } elsif ($mode eq 'compile') {
     my ($group_files, $pmc_group) = gather_groups(@pmcs);

-    my @grouped_pmcs = grep { exists $pmc_group->{$_} } @pmcs;
-    my @ungrouped_pmcs = grep { ! exists $pmc_group->{$_} } @pmcs;
-
-    # Convert X.c -> X.so for all non-grouped X.c
-    compile_loadable($_) foreach (@ungrouped_pmcs);
-
-    # Convert X.c -> X.o for all grouped X.c
-    compile($_) foreach (@grouped_pmcs);
+    # Convert X.c -> X.o for all X.c
+    compile($_) foreach (@pmcs);

     # lib-GROUP.c
     for my $group (keys %$group_files) {
@@ -80,6 +66,11 @@
         partial_link($group, "lib-$group", @$pmcs)
           or die "partial link of $group failed ($?)\n";
     }
+
+    # Link non-grouped PMCs individually
+    my @ungrouped_pmcs = grep { ! exists $pmc_group->{$_} } @pmcs;
+    partial_link($_, $_) foreach (@ungrouped_pmcs);
+
 } elsif ($mode eq 'copy') {
     # Copy *.so -> destination, where destination is the first
     # argument, given as --destination=DIRECTORY
@@ -166,17 +157,6 @@
     }
 }

-sub compile_loadable {
-    my ($src_stem, $dest_stem) = @_;
-    $dest_stem ||= $src_stem;
-    if (needs_build("$dest_stem$LOAD_EXT", "$src_stem.c")) {
-        run(compile_loadable_cmd("$dest_stem$LOAD_EXT", "$src_stem.c"))
-          or die "compile $src_stem.c failed ($?)\n";
-    } else {
-        print "$dest_stem$LOAD_EXT is up to date\n";
-    }
-}
-
 sub partial_link {
     my ($group, @stems) = @_;
     my @sources = map { "$_$O" } @stems;



Reply via email to