pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/32697 patch for Mac OS X crt1.o ordering in wrappers



The following reply was made to PR pkg/32697; it has been noted by GNATS.

From: Tom Yu <tlyu%MIT.EDU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/32697 patch for Mac OS X crt1.o ordering in wrappers
Date: Sun, 18 Feb 2007 13:58:55 -0500

 I encountered a related problem with pkgsrc on Mac OS X 10.4.8 which
 appears to be this bug moved to the the wrappers subsystem.  One
 directory where I encountered it was devel/bison, where a test program
 run by configure coredumped due to incorrect crt1.o ordering.  This
 caused the configure script to guess incorrectly about the presence of
 strndup (causing link failure later in the build) because it
 incorrectly assumed it was cross-compiling.
 
 I have included a patch which creates a new buildcmd script,
 buildcmd-darwin-ld, and uses it to special-case the "-lcrt1.o"
 argument so that it gets treated as a normal argument instead of
 getting incorporated into $libs.  I considered the original suggestion
 of changing cmd-sink-ld but decided that buildcmd was a better place
 for this logic.  Please let me know if using a cmd-sink script would
 be a more stylistically acceptable approach.
 
 For reasons not yet clear to me, I only encountered this problem when
 doing bulk builds, not when running "bmake build" in individual
 package directories.  It may have something to do with differences in
 how PATH gets set in the wrappers.
 
 Index: bsd.wrapper.mk
 ===================================================================
 RCS file: /cvsroot/pkgsrc/mk/wrapper/bsd.wrapper.mk,v
 retrieving revision 1.63
 diff -u -r1.63 bsd.wrapper.mk
 --- bsd.wrapper.mk     6 Feb 2007 20:33:50 -0000       1.63
 +++ bsd.wrapper.mk     18 Feb 2007 18:36:26 -0000
 @@ -311,6 +311,7 @@
  _WRAP_ARG_PP.CC=      ${WRAPPER_TMPDIR}/arg-pp-darwin-gcc
  _WRAP_ARG_PP.CXX=     ${_WRAP_ARG_PP.CC}
  _WRAP_ARG_PP.LD=      ${_WRAP_ARG_PP.CC}
 +_WRAP_BUILDCMD.LD=    ${WRAPPER_TMPDIR}/buildcmd-darwin-ld
  .elif ${OPSYS} == "UnixWare"
  _WRAP_CMD_SINK.CC=    ${WRAPPER_TMPDIR}/cmd-sink-unixware-gcc
  _WRAP_CMD_SINK.CXX=   ${_WRAP_CMD_SINK.CC}
 @@ -461,6 +462,7 @@
        arg-pp-darwin-gcc \
        arg-pp-mipspro-cc \
        arg-pp-sunpro-cxx \
 +      buildcmd-darwin-ld \
        cmd-sink-aix-cc \
        cmd-sink-aix-ld \
        cmd-sink-aix-xlc \
 Index: buildcmd-darwin-ld
 ===================================================================
 RCS file: buildcmd-darwin-ld
 diff -N buildcmd-darwin-ld
 --- /dev/null  1 Jan 1970 00:00:00 -0000
 +++ buildcmd-darwin-ld 18 Feb 2007 18:36:28 -0000
 @@ -0,0 +1,83 @@
 +# $NetBSD: buildcmd,v 1.1 2004/09/21 15:01:41 jlam Exp $
 +#
 +# Copyright (c) 2004 The NetBSD Foundation, Inc.
 +# All rights reserved.
 +#
 +# This code is derived from software contributed to The NetBSD Foundation
 +# by Johnny C. Lam.
 +#
 +# Redistribution and use in source and binary forms, with or without
 +# modification, are permitted provided that the following conditions
 +# are met:
 +# 1. Redistributions of source code must retain the above copyright
 +#    notice, this list of conditions and the following disclaimer.
 +# 2. Redistributions in binary form must reproduce the above copyright
 +#    notice, this list of conditions and the following disclaimer in the
 +#    documentation and/or other materials provided with the distribution.
 +# 3. All advertising materials mentioning features or use of this software
 +#    must display the following acknowledgement:
 +#        This product includes software developed by the NetBSD
 +#        Foundation, Inc. and its contributors.
 +# 4. Neither the name of The NetBSD Foundation nor the names of its
 +#    contributors may be used to endorse or promote products derived
 +#    from this software without specific prior written permission.
 +#
 +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 +# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 +# POSSIBILITY OF SUCH DAMAGE.
 +
 +case $arg in
 +######################################################################
 +# Don't append empty arguments to the command line.
 +######################################################################
 +"")
 +      ;;
 +######################################################################
 +# Reduce command length by not appending options that we've already
 +# seen.  We also ensure that all of the -l options come after the -L
 +# options, and suppress consecutive repeated libraries.
 +######################################################################
 +-[DILR]*|-Wl,-R*|-Wl,-*,/*)
 +      case $cmd in
 +      *" "$arg|*" "$arg" "*)
 +              ;;
 +      *)
 +              shquote "$arg"; arg="$shquoted"
 +              cmd="$cmd $arg"
 +              ;;
 +      esac
 +      ;;
 +######################################################################
 +# Don't add "-lcrt1.o" to $libs; treat it as a normal argument.
 +# This avoids producing executables that coredump in startup.
 +######################################################################
 +-lcrt1.o)
 +      shquote "$arg"; arg="$shquoted"
 +      cmd="$cmd $arg"
 +      ;;
 +-l*)
 +      case $libs in
 +      *" "$arg)
 +              ;;
 +      *)
 +              shquote "$arg"; arg="$shquoted"
 +              libs="$libs $arg"
 +              ;;
 +      esac
 +      ;;
 +######################################################################
 +# Append $arg to $cmd to build up the command line to be executed.
 +######################################################################
 +*)
 +      shquote "$arg"; arg="$shquoted"
 +      cmd="$cmd $arg"
 +      ;;
 +esac
 



Home | Main Index | Thread Index | Old Index