It doesn't work completely with FreeBSD's make it seems. Building 'parrot' works just fine, dynpmc stuff fails with this.

g++ -o ./parrot src/main.o blib/lib/libparrot.a -lpthread -lm -L/usr/local/lib -licuuc -licudata -lpthread -lm -lm -lcrypt -lutil -pthread -lreadline -Wl,-E -L/usr/local/lib -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE src/parrot_config.o g++ -o ./pbc_merge src/pbc_merge.o src/parrot_config.o blib/lib/libparrot.a -lpthread -lm -L/usr/local/lib -licuuc -licudata -lpthread -lm -lm -lcrypt -lutil -pthread -lreadline -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE -Wl,-E -L/usr/local/lib ./parrot -o runtime/parrot/library/CGI/QueryHash.pbc runtime/parrot/library/CGI/QueryHash.pir ./parrot -o runtime/parrot/library/Crow.pbc runtime/parrot/library/Crow.pir ./parrot -o runtime/parrot/library/config.pbc runtime/parrot/library/config.pir ./parrot -o runtime/parrot/library/Config/JSON.pbc runtime/parrot/library/Config/JSON.pir ./parrot -o runtime/parrot/library/Data/Dumper/Base.pbc runtime/parrot/library/Data/Dumper/Base.pir ./parrot -o runtime/parrot/library/Data/Dumper/Default.pbc runtime/parrot/library/Data/Dumper/Default.pir ./parrot -o runtime/parrot/library/Data/Dumper.pbc runtime/parrot/library/Data/Dumper.pir ./parrot -o runtime/parrot/library/Data/Escape.pbc runtime/parrot/library/Data/Escape.pir ./parrot -o runtime/parrot/library/Data/Sort.pbc runtime/parrot/library/Data/Sort.pir ./parrot -o runtime/parrot/library/Digest/MD5.pbc runtime/parrot/library/Digest/MD5.pir ./parrot -o runtime/parrot/library/dumper.pbc runtime/parrot/library/dumper.pir ./parrot -o runtime/parrot/library/Getopt/Obj.pbc runtime/parrot/library/Getopt/Obj.pir ./parrot -o runtime/parrot/library/JSON.pbc runtime/parrot/library/JSON.pir ./parrot -o runtime/parrot/library/MIME/Base64.pbc runtime/parrot/library/MIME/Base64.pir ./parrot -o runtime/parrot/library/ncurses.pbc runtime/parrot/library/ncurses.pir ./parrot -o runtime/parrot/library/parrotlib.pbc runtime/parrot/library/parrotlib.pir ./parrot -o runtime/parrot/library/pcre.pbc runtime/parrot/library/pcre.pir ./parrot -o runtime/parrot/library/Parrot/Capture_PIR.pbc runtime/parrot/library/Parrot/Capture_PIR.pir ./parrot -o runtime/parrot/library/Parrot/Coroutine.pbc runtime/parrot/library/Parrot/Coroutine.pir ./parrot -o runtime/parrot/library/Parrot/Exception.pbc runtime/parrot/library/Parrot/Exception.pir ./parrot -o runtime/parrot/library/Parrot/HLLCompiler.pbc runtime/parrot/library/Parrot/HLLCompiler.pir ./parrot -o runtime/parrot/library/PGE/Dumper.pbc runtime/parrot/library/PGE/Dumper.pir ./parrot -o runtime/parrot/library/PGE/Glob.pbc runtime/parrot/library/PGE/Glob.pir ./parrot -o runtime/parrot/library/PGE/P6Grammar.pbc runtime/parrot/library/PGE/P6Grammar.pir ./parrot -o runtime/parrot/library/PGE/Perl6Grammar.pbc runtime/parrot/library/PGE/Perl6Grammar.pir ./parrot -o runtime/parrot/library/PGE/Text.pbc runtime/parrot/library/PGE/Text.pir ./parrot -o runtime/parrot/library/PGE/Util.pbc runtime/parrot/library/PGE/Util.pir ./parrot -o runtime/parrot/library/Stream/Base.pbc runtime/parrot/library/Stream/Base.pir ./parrot -o runtime/parrot/library/Stream/Combiner.pbc runtime/parrot/library/Stream/Combiner.pir ./parrot -o runtime/parrot/library/Stream/Coroutine.pbc runtime/parrot/library/Stream/Coroutine.pir ./parrot -o runtime/parrot/library/Stream/Filter.pbc runtime/parrot/library/Stream/Filter.pir ./parrot -o runtime/parrot/library/Stream/Lines.pbc runtime/parrot/library/Stream/Lines.pir ./parrot -o runtime/parrot/library/Stream/ParrotIO.pbc runtime/parrot/library/Stream/ParrotIO.pir ./parrot -o runtime/parrot/library/Stream/Replay.pbc runtime/parrot/library/Stream/Replay.pir ./parrot -o runtime/parrot/library/Stream/Sub.pbc runtime/parrot/library/Stream/Sub.pir ./parrot -o runtime/parrot/library/Stream/Writer.pbc runtime/parrot/library/Stream/Writer.pir ./parrot -o runtime/parrot/library/String/Utils.pbc runtime/parrot/library/String/Utils.pir ./parrot -o runtime/parrot/library/Tcl/Glob.pbc runtime/parrot/library/Tcl/Glob.pir ./parrot -o runtime/parrot/library/YAML/Parser/Syck.pbc runtime/parrot/library/YAML/Parser/Syck.pir ./parrot -o runtime/parrot/library/STM.pbc runtime/parrot/library/STM.pir ./parrot -o runtime/parrot/library/libpcre.pbc runtime/parrot/library/libpcre.pir ./parrot -o runtime/parrot/library/Data/Replace.pbc runtime/parrot/library/Data/Replace.pir ./parrot -o runtime/parrot/library/postgres.pbc runtime/parrot/library/postgres.pir ./parrot -o runtime/parrot/include/parrotlib.pbc runtime/parrot/library/parrotlib.pir perl -e 'chdir shift @ARGV; system q{make}, @ARGV; exit $? >> 8;' src/dynpmc perl -e 'chdir shift @ARGV; system q{make}, @ARGV; exit $? >> 8;' src/dynoplibs perl -e 'chdir shift @ARGV; system q{make}, @ARGV; exit $? >> 8;' compilers/pge cd PGE/pmc && perl /usr/home/jisom/parrot/tools/build/dynpmc.pl generate codestring cd PGE/pmc && perl /usr/home/jisom/parrot/tools/build/dynpmc.pl compile codestring
cd: can't cd to PGE/pmc
cd PGE/pmc && perl /usr/home/jisom/parrot/tools/build/dynpmc.pl linklibs codestring
cd: can't cd to PGE/pmc
cd PGE/pmc && perl /usr/home/jisom/parrot/tools/build/dynpmc.pl copy --destination=/usr/home/jisom/parrot/runtime/parrot/dynext codestring
cd: can't cd to PGE/pmc
perl -MExtUtils::Command -e rm_rf PGE.pbc ../../runtime/parrot/library/PGE.pbc
*** Error code 2
perl -e "" >PGE/builtins_gen.pir
../../parrot -o PGE.pbc --output-pbc PGE.pir
../../parrot pgc.pir  --output=PGE/builtins_gen.pir PGE/builtins.pg
../../parrot -o PGE.pbc --output-pbc PGE.pir
1 error
*** Error code 2
1 error

A standard make after that succeeds just fine. It seems to be a problem with using -j, and using -j 4 -C as well, but setting MAKE to make -B -C works fine, it just makes it single threaded with those parts.

With a little bit of help with changing some commands around and such, I think I've found the issue. With -j, a single shell for the entire list of commands instead of a single shell for each line(which in and of itself would be faster by fewer process forks). So all the cd's for pge_group make it try to go further and further.

So there are a few options. Make MAKE actually be make -B -C on FreeBSD, change tools/build/dynpmc.pl to work in one pass, tell FreeBSD users to not use -j(using gmake doesn't work due to the perl method using make), or apply this patch, which is probably the cleanest approach available.

Index: config/gen/makefiles/pge.in
===================================================================
--- config/gen/makefiles/pge.in (revision 21620)
+++ config/gen/makefiles/pge.in (working copy)
@@ -47,10 +47,10 @@
        $(PARROT) -o PGE.pbc --output-pbc PGE.pir

 $(PMCDIR)/pge_group$(LOAD_EXT): $(PARROT) $(PMC_SOURCES)
-       cd $(PMCDIR) && $(BUILD) generate $(PMCS)
-       cd $(PMCDIR) && $(BUILD) compile $(PMCS)
-       cd $(PMCDIR) && $(BUILD) linklibs $(PMCS)
- cd $(PMCDIR) && $(BUILD) copy --destination=$(PARROT_DYNEXT) $(PMCS)
+       (cd $(PMCDIR) && $(BUILD) generate $(PMCS))
+       (cd $(PMCDIR) && $(BUILD) compile $(PMCS))
+       (cd $(PMCDIR) && $(BUILD) linklibs $(PMCS))
+ (cd $(PMCDIR) && $(BUILD) copy --destination=$(PARROT_DYNEXT) $(PMCS))

# This is a listing of all targets, that are meant to be called by users
 help:


On Sep 26, 2007, at 5:24 PM, chromatic wrote:

On Wednesday 26 September 2007 14:26:20 [EMAIL PROTECTED] wrote:

Author: coke
Date: Wed Sep 26 14:26:19 2007
New Revision: 21613

Modified:
   trunk/lib/Parrot/Configure/Messages.pm
   trunk/tools/build/c2str.pl

Log:
[build]

Update c2str.pl so that multiple copies running simultaneously no longer
step on each other's toes drunkenly with a jackhammer.

With this fix (Courtesy of jhorwitz++), 'make -j 2' now works, tested
on a variety of platforms.

It even works for make -j 9 for me (two cores, but I like to keep them busy).
However...

Modified: trunk/tools/build/c2str.pl
====================================================================== =====
=== --- trunk/tools/build/c2str.pl      (original)
+++ trunk/tools/build/c2str.pl  Wed Sep 26 14:26:19 2007
@@ -19,6 +19,21 @@

 my $outfile          = 'all_cstring.str';
 my $string_private_h = 'src/string_private_cstring.h';
+my $lockfile         = "$outfile.lck";
+my $max_lock_wait    = 120;
+
+my $start_time = time;
+while ( -e $lockfile ) {
+    sleep 1;
+    if ( time - $start_time > $max_lock_wait ) {
+ die "Lock still held after $max_lock_wait seconds -- something is
wrong!"; +    }
+}

... isn't there a race condition right here?

+open my $lock, '>', $lockfile or die "Can't write '$lockfile': $!";
+print $lock "$$\n";
+close $lock;
+
+$SIG{'__DIE__'} = sub { unlink $lockfile };

For what it's worth, I think this patch is safer. I did have some trouble with -j 3 and higher, but it's working for me on 32-bit x86 Linux now up
to -j 9.

-- c

<c2str_flock.patch>

Reply via email to