On Fri, Jan 08, 2010 at 03:24:36AM +0100, Sedat Dilek wrote:
> Here is the build.log with applied mklib-smarter-extract.patch (only this 
> one).
> 
> Maybe you have a look at the build-log:
> ...
> mklib: Making Linux static library:  libmesa.a
> ar: ../../src/glsl/pp/libglslpp.a: No such file or directory
> ar: ../../src/glsl/pp/libglslpp.a: No such file or directory
> ar: ../../src/glsl/cl/libglslcl.a: No such file or directory
> ar: ../../src/glsl/cl/libglslcl.a: No such file or directory
> ar: creating libmesa.a
> ...
> running /usr/bin/makedepend
> ar: ../../src/glsl/pp/libglslpp.a: No such file or directory
> ar: ../../src/glsl/pp/libglslpp.a: No such file or directory
> ar: ../../src/glsl/cl/libglslcl.a: No such file or directory
> ar: ../../src/glsl/cl/libglslcl.a: No such file or directory
> ar: creating libmesagallium.a
> ...
> 
> $ grep sl_pp_context -r mesa/ | egrep 'libmesa|libglsl'
> Binary file mesa/src/glsl/cl/libglslcl.a matches
> Binary file mesa/src/glsl/pp/libglslpp.a matches
> Binary file mesa/src/mesa/libmesa.a matches
> Binary file mesa/src/mesa/libmesagallium.a matches
> 
> $ grep sl_pp_context.o -r mesa/ | egrep 'libmesa|libglsl'
> Binary file mesa/src/glsl/pp/libglslpp.a matches
> 
> Here I am not sure why the object file is only in libglslpp.a.
> 
> Many thanks for your fast replies, patches and the detailed explanations.

Oops, just a bug about changing directories and breaking relative paths.
Can you try this new version of the patch? I actually tested it this time,
and I think it does the right thing.

--
Dan

>From 59d8948fe55af2c783d8f7c5554ee44809e78bbd Mon Sep 17 00:00:00 2001
From: Dan Nicholson <dbn.li...@gmail.com>
Date: Thu, 7 Jan 2010 17:11:37 -0800
Subject: [PATCH] mklib: Extract archives into temporary directories

When static libraries are created from other archives, objects are
extracted and then deleted when the static library is done. This can
race when there are multiple static libraries being created from the
same archives as with libmesa.a and libmesagallium.a.

Should fix this issue with parallel jobs:

make[5]: *** No rule to make target
> `../../../../../../src/mesa/libmesagallium.a', needed by
> `radeon_dri.so'. Stop

Signed-off-by: Dan Nicholson <dbn.li...@gmail.com>
---
 bin/mklib |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 0acaeb9..652d6bd 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -28,15 +28,26 @@
 # Given a list of files, look for .a archives and unpack them.
 # Return the original list of files minus the .a files plus the unpacked files.
 expand_archives() {
+    DIR=$1
+    shift
     FILES=$@
     NEWFILES=""
+    ORIG_DIR=`pwd`
+    mkdir -p "$DIR"
+    cd "$DIR"
     for FILE in $FILES ; do
         case $FILE in
             *.a)
                 # extract the .o files from this .a archive
+                case $FILE in
+                    /*) ;;
+                    *)  FILE="$ORIG_DIR/$FILE" ;;
+                esac
                 MEMBERS=`ar t $FILE`
                 ar x $FILE
-                NEWFILES="$NEWFILES $MEMBERS"
+                for MEMBER in $MEMBERS ; do
+                    NEWFILES="$NEWFILES $DIR/$MEMBER"
+                done
                 ;;
             *)
                 # other file type, just add to list
@@ -44,6 +55,7 @@ expand_archives() {
                 ;;
         esac
     done
+    cd "$ORIG_DIR"
     echo $NEWFILES
 }
 
@@ -360,13 +372,13 @@ case $ARCH in
             fi
 
            # expand .a into .o files
-           NEW_OBJECTS=`expand_archives $OBJECTS`
+           NEW_OBJECTS=`expand_archives "${LIBNAME}.obj" $OBJECTS`
 
             # make static lib
            FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME} ${NEW_OBJECTS}`
 
            # remove temporary extracted .o files
-           rm -f `contents_of_archives $OBJECTS`
+           rm -rf "${LIBNAME}.obj"
         else
            # make dynamic library
            LIBNAME="lib${LIBNAME}"     # prefix with "lib"
@@ -553,12 +565,12 @@ case $ARCH in
            echo "mklib: Making FreeBSD static library: " ${STLIB}
 
            # expand .a into .o files
-           NEW_OBJECTS=`expand_archives $OBJECTS`
+           NEW_OBJECTS=`expand_archives "${STLIB}.obj" $OBJECTS`
 
            FINAL_LIBS=`make_ar_static_lib cq 1 ${STLIB} ${NEW_OBJECTS}`
 
            # remove temporary extracted .o files
-           rm -f `contents_of_archives $OBJECTS`
+           rm -rf "${STLIB}.obj"
        else
            # make dynamic library
            SHLIB="lib${LIBNAME}.so.${MAJOR}"
-- 
1.6.5.2

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to