develooper Front page | perl.perl6.internals | Postings from April 2008

[perl #53452] [BUG] ar can't read libparrot.a on Mac OS 10.5.2

Thread Previous
From:
Allison Randal
Date:
April 28, 2008 14:17
Subject:
[perl #53452] [BUG] ar can't read libparrot.a on Mac OS 10.5.2
Message ID:
rt-3.6.HEAD-20841-1209398826-500.53452-72-0@perl.org
# New Ticket Created by  Allison Randal 
# Please include the string:  [perl #53452]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=53452 >


I've just upgraded my laptop to Mac OS 10.5.2 (from 10.4). I'm using 
Apple's build of gcc, 4.0.1.

Since the upgrade, when I change a core PMC (even just adding a comment) 
and then try to run 'make' or 'perl Configure.pl && make' on a checkout 
that's been built before, I get an error when I hit this stage of the 
compile:
---
perl -MExtUtils::Command -e mkpath blib/lib
ar cr blib/lib/libparrot.a  src/string.o src/ops/core_ops.o [...]
---

The error is:
---
ar: blib/lib/libparrot.a is a fat file (use libtool(1) or lipo(1) and 
ar(1) on it)
ar: blib/lib/libparrot.a: Inappropriate file type or format
make: *** [blib/lib/libparrot.a] Error 1
---

If I run 'make realclean' then libparrot.a and several other related 
files are deleted, and I can build again.

Also relevant, when I run a fresh 'make' after 'realclean', ranlib warns:
---
ranlib: archive library: blib/lib/libparrot.a will be fat and ar(1) will 
not be able to operate on it
---

That part of the Makefile is generated from the following two lines in 
config/gen/makefiles/root.in:

Part of "BUILD TOOLS CONFIGURATIONS":
---
AR_CR            = @ar@ @ar_flags@
---

And part of the "$(LIBPARROT_STATIC)" target:
---
   $(AR_CR) @ar_out@$@ @ar_extra@ $(O_FILES)
---

Partial solution -- based on the documentation in 'man libtool':
---
Libtool with -static is intended to replace ar(5) and ranlib.
---

I modified config/gen/makefiles/root.in, changing:
---
$(LIBPARROT_STATIC) : $(O_FILES)
         $(MKPATH) @blib_dir@
         $(AR_CR) @ar_out@$@ @ar_extra@ $(O_FILES)
         $(RANLIB) $@
---

to:
---
$(LIBPARROT_STATIC) : $(O_FILES)
         $(MKPATH) @blib_dir@
         libtool -static -o @ar_out@$@ @ar_extra@ $(O_FILES)
---

And it compiles fine, passes 'make test', and recompiles fine after 
modifying a core PMC. But, I suspect this is a modification local to 
Apple's GCC, so what works here won't work anywhere else. I need a way 
to alter the "LIBPARROT_STATIC" target from config/init/hints/darwin.pm 
so it uses 'libtool -static' instead of 'ar' and 'ranlib'.

That's as far as I had time to work on it today, so I'll raise the 
question to the group (especially to those who have been working on the 
configure and build systems): What's the best way to allow these more 
extensive modifications to the build instructions for particular 
platforms/compilers?

Allison

Thread Previous


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