[Developers] cannot generate libthorn_CactusBindings.a on IBM SP5 because argument list is too long
Erik Schnetter
schnetter at cct.lsu.edu
Mon Dec 17 15:18:31 CST 2007
On Dec 14, 2007, at 18:10:22, Thomas Radke wrote:
> Tom Goodale wrote:
>> On Thu, 6 Dec 2007, Thomas Radke wrote:
>>> Erik Schnetter wrote:
>>>
>>>> Here is my file make.subdir, which contains the target "deps"
>>>
>>> Thanks, Erik !
>>>
>>> With this everything builds fine now. I have tested your patch
>>> also on three other machines to check whether it would break
>>> anything - it didn't.
>>>
>>> Okay to commit the patch ?
>> Not as it stands. There's some extra commented out lines in there
>> which I assume Erik has been using for experimentation. Also I
>> think the 'deps' stuff is not part of the patch needed for this
>> change. Please tidy it up and create the minimal necessary patch
>> before committing.
>
> Okay, here is a version which doesn't have the deps stuff in it
> anymore.
>
> I added a few more comments on the various methods how to create an
> archive.
> I also increased the threshold of switching from just copying to
> incrementally adding to the list of object files to be archived
> from 100 files to 1000. This works on the problematic IPM SP5.
I think the patch is fine and should be applied.
-erik
> Index: make.thornlib
> ===================================================================
> RCS file: /cactusdevcvs/Cactus/lib/make/make.thornlib,v
> retrieving revision 1.34
> diff -u -r1.34 make.thornlib
> --- make.thornlib 16 Aug 2005 17:26:48 -0000 1.34
> +++ make.thornlib 15 Dec 2007 00:03:52 -0000
> @@ -52,7 +52,7 @@
> LOCAL_SUBDIRS := . $(SUBDIRS)
>
> # Include all the make.code.defn files for the subdirectories
> -# These have to be wrapped to allow us to concatanate all the
> +# These have to be wrapped to allow us to concatenate all the
> # SRCS definitions, complete with subdirectory names.
> # Using -include to prevent warnings the first time the
> make.identity files
> # need to be made.
> @@ -77,9 +77,27 @@
>
> $(NAME): $(addsuffix /make.checked, $(SUBDIRS) $(THORNBINDINGS))
> if [ -r $(NAME) ] ; then echo Updating $(NAME) ; else echo
> Creating $(NAME) ; fi
> - if [ -r $@ ] ; then rm $@ ; fi
> - $(AR) $(ARFLAGS) $@ $(OBJS)
> + if [ -r $@ ] ; then rm -f $@ ; fi
> +### create an archive of the object files
> +#
> +## This naive method will fail on some machines (eg. IBM SP5)
> +## when there are too many object files to be passed on the
> command line.
> +# $(AR) $(ARFLAGS) $@ $(OBJS)
> +#
> +## This creates a list of all object files and incrementally
> archives them
> +## in batches not larger than $(OBJS-words-max) files at a time.
> + $(MAKE) -f $(MAKE_DIR)/make.thornlib $(NAME).objectlist
> + xargs -n $(OBJS-words-max) $(AR) $(ARFLAGS) $@ < $(NAME).objectlist
> + $(RM) $(NAME).objectlist
> +## Alternatively, we could create a single object file from the
> object
> +## files and put it into an archive.
> +# ld -r -o $@.o $(OBJS)
> +# $(AR) $(ARFLAGS) $@ $@.o
> if test "x$(USE_RANLIB)" = "xyes" ; then $(RANLIB) $(RANLIBFLAGS)
> $@ ; fi
> +## Or we could create a dynamic library the object files.
> +## to do: use a two-level namespace
> +## (this requires knowing the dependencies of each thorn library)
> +# libtool -dynamic -arch_only ppc -o $@ $(OBJS) -flat_namespace -
> undefined suppress -single_module
> @echo $(DIVIDER)
>
> # Extra stuff for allowing make to recurse into directories
> @@ -98,3 +116,44 @@
> $(addsuffix /make.identity, $(SUBDIRS) $(THORNBINDINGS)):
> if [ ! -d $(dir $@) ] ; then $(MKDIR) $(MKDIRFLAGS) $(dir $@) ; fi
> echo CCTK_THIS_SUBDIR := $(dir $@) > $@
> +
> +
> +
> +# Create a file containing the names of all object files.
> +
> +# Since the list may be too long to be passed to a shell, it is split
> +# into a set of rules which add lines to a file. This file can later
> +# be used via xargs.
> +
> +OBJS-words = $(words $(OBJS))
> +OBJS-words-max = 1000
> +
> +ifeq ($(shell test $(OBJS-words) -le $(OBJS-words-max) && echo 1), 1)
> +
> +# The list is short. Create the file directly, which is faster.
> +
> +.PHONY: $(NAME).objectlist
> +$(NAME).objectlist:
> + echo $(OBJS) > $(NAME).objectlist
> +
> +else
> +
> +# The list is long. Create the file via a set of rules, one rule per
> +# object file.
> +
> +OBJS-added = $(OBJS:%=%.added)
> +
> +.PHONY: $(NAME).objectlist
> +$(NAME).objectlist: $(OBJS-added)
> +
> +# Truncate the file
> +.PHONY: $(NAME).objectlist.create
> +$(NAME).objectlist.create:
> + : > $(NAME).objectlist
> +
> +# Add a line to the file
> +.PHONY: $(OBJS-added)
> +$(OBJS-added): $(NAME).objectlist.create
> + echo $(@:%.added=%) >> $(NAME).objectlist
> +
> +endif
> _______________________________________________
> Developers mailing list
> Developers at cactuscode.org
> http://www.cactuscode.org/mailman/listinfo/developers
--
Erik Schnetter <schnetter at cct.lsu.edu> http://www.cct.lsu.edu/
~eschnett/
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20071217/d79c7b77/attachment.bin
More information about the Developers
mailing list