develooper Front page | perl.perl5.porters | Postings from January 2006

[patch] s/ar ts/ar s/g

Thread Next
From:
Philippe M. Chiasson
Date:
January 25, 2006 13:36
Subject:
[patch] s/ar ts/ar s/g
Message ID:
43D7EF57.6010309@ActiveState.com
I've been playing with building a Universal Binary version of Perl on OSX and I ran
into this little bit of a problem.

Perl's Configure script uses 'ar ts' to generate an archive symbol table for
static libraries. The 't' flag only prints the contents of the archive, and
is not fully supported on universal static archives. This doesn't cause failures
when building Perl itself, but it does cause certain CPAN modules to fail building
against that Perl.

$> ar rc bar.a bar2.o bar1.o
$> ar ts bar.a || echo "Failed"
bar2.o
bar1.o
ranlib: archive library: bar.a will be fat and ar(1) will not be able to operate on it
$> file bar.a
bar.a: Mach-O fat file with 2 architectures
bar.a (for architecture ppc):   current ar archive
bar.a (for architecture i386):  current ar archive
$> ar ts bar.a || echo "Failed"
ar: bar.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: bar.a: Inappropriate file type or format
Failed

Unless I am unaware of a strange flavor of ar, the only flag required to generate
a symbol table with ar is 's', the 't' being effectively useless. So, this simple
patch to Configure does the trick for me.

--- Configure   2006-01-11 13:04:07.000000000 -0800
+++ Configure.new       2006-01-25 13:08:13.000000000 -0800
@@ -19271,12 +19271,12 @@
        if [ "X$ranlib" = "X" ]; then
            ranlib=":"
        fi
-elif $ar ts bar$_a >/dev/null 2>&1 &&
+elif $ar s bar$_a >/dev/null 2>&1 &&
        $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
-               echo "a table of contents needs to be added with '$ar ts'."
+               echo "a table of contents needs to be added with '$ar s'."
                orderlib=false
-               ranlib="$ar ts"
+               ranlib="$ar s"
 else
        case "$ranlib" in
        :) ranlib='';;

--------------------------------------------------------------------------------
Philippe M. Chiasson                  gozer@ActiveState.com GPG KeyID : 88C3A5A5
http://xrl.us/activegozer       F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About