From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Apr 28 08:10:06 2007 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A638016A407 for ; Sat, 28 Apr 2007 08:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2CF13C44C for ; Sat, 28 Apr 2007 08:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l3S8A6IN008959 for ; Sat, 28 Apr 2007 08:10:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l3S8A6gD008958; Sat, 28 Apr 2007 08:10:06 GMT (envelope-from gnats) Resent-Date: Sat, 28 Apr 2007 08:10:06 GMT Resent-Message-Id: <200704280810.l3S8A6gD008958@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Scot Hetzel Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FA5B16A402 for ; Sat, 28 Apr 2007 08:04:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 54F1613C455 for ; Sat, 28 Apr 2007 08:04:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l3S846Jm015243 for ; Sat, 28 Apr 2007 08:04:06 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l3S7x4dL014303; Sat, 28 Apr 2007 07:59:05 GMT (envelope-from nobody) Message-Id: <200704280759.l3S7x4dL014303@www.freebsd.org> Date: Sat, 28 Apr 2007 07:59:05 GMT From: Scot Hetzel To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: ports/112203: Mk/bsd.port.mk - Fix detection of 32bit libraries on FreeBSD/amd64, ia64 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2007 08:10:06 -0000 >Number: 112203 >Category: ports >Synopsis: Mk/bsd.port.mk - Fix detection of 32bit libraries on FreeBSD/amd64, ia64 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Apr 28 08:10:05 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Scot Hetzel >Release: FreeBSD/amd64 7.0-CURRENT >Organization: Ye Old Computer >Environment: FreeBSD hp010.hetzel.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Fri Apr 27 00:26:19 CDT 2007 swhetzel@hp010.hetzel.org:/usr/src/7x/sys-p4/amd64/compile/GENERIC.debug amd64 >Description: When a port installs a 32bit binary program on FreeBSD/amd64 or FreeBSD/ia64 and it depends on a port that supplies 32bit libraries, the detection fails to detect that the dependency is already installed and attempts to reinstall the dependency. Also, if the 32bit library is not installed, but a 64bit library matches what is found in LIB_DEPENDS, it will not install the dependency on the 32bit library port. The cause of this behavior is that the library detection is only looking for the 64bit libraries, as ldconfig is not given the -32 flag when checking library dependencies. >How-To-Repeat: On a FreeBSD/amd64 system do the following: Install misc/compat4x cd /usr/ports/misc/compat4x make install chflags noschg work/var/empty make clean Then install security/vscan cd /usr/ports/security/vscan Edit the Makefile, and remove 'LDCONFIG= ldconfig -32' as it is a hack to get proper detection of it's library dependencies. make install : ===> Patching for uvscan-5.10e_2 ===> uvscan-5.10e_3 depends on shared library: m.2 - not found ===> Verifying install for m.2 in /usr/ports/misc/compat4x ===> Extracting for compat4x-i386-5.3_9 : : ===> Returning to build of uvscan-5.10e_2 Error: shared library "m.2" does not exist *** Error code 1 Stop in /usr/ports/security/vscan. >Fix: Apply the attached patch. - moves the IA32_BINARY_PORT check from the pre-makefile section into the post-makefile section of bsd.port.mk. - defines LIB32DIR as lib32 on amd64/ia64 and as lib on i386 - adds LIB32DIR to PLIST_SUB - fixes detection of 32bit libraries on amd64/ia64 systems After this patch and the security/vscan PR ports/112202 are applied, the security/vscan port can be modified as follows: Remove LIB32DIR=, LDCONFIG=, PLIST_SUB+= from security/vscan/Makefile Patch attached with submission follows: Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.565 diff -u -r1.565 bsd.port.mk --- bsd.port.mk 7 Apr 2007 12:51:47 -0000 1.565 +++ bsd.port.mk 7 Apr 2007 18:22:55 -0000 @@ -1208,29 +1208,6 @@ MASTER_PORT?= .endif -# Check the compatibility layer for amd64/ia64 - -.if ${ARCH} == "amd64" || ${ARCH} =="ia64" -.if exists(/usr/lib32) -HAVE_COMPAT_IA32_LIBS?= YES -.endif -.if !defined(HAVE_COMPAT_IA32_KERN) -HAVE_COMPAT_IA32_KERN!= if ${SYSCTL} -a compat.ia32.maxvmem >/dev/null 2>&1; then echo YES; fi -.endif -.endif - -.if defined(IA32_BINARY_PORT) && ${ARCH} != "i386" -.if ${ARCH} == "amd64" || ${ARCH} == "ia64" -.if !defined(HAVE_COMPAT_IA32_KERN) -IGNORE= you need a kernel with compiled-in IA32 compatibility to use this port. -.elif !defined(HAVE_COMPAT_IA32_LIBS) -IGNORE= you need the 32-bit libraries installed under /usr/lib32 to use this port. -.endif -.else -IGNORE= you have to use i386 (or compatible) platform to use this port. -.endif -.endif - # If they exist, include Makefile.inc, then architecture/operating # system specific Makefiles, then local Makefile.local. @@ -1672,6 +1649,34 @@ .endif .endif +# Check the compatibility layer for amd64/ia64 + +.if ${ARCH} == "amd64" || ${ARCH} =="ia64" +.if exists(/usr/lib32) +HAVE_COMPAT_IA32_LIBS?= YES +.endif +.if !defined(HAVE_COMPAT_IA32_KERN) +HAVE_COMPAT_IA32_KERN!= if ${SYSCTL} -a compat.ia32.maxvmem >/dev/null 2>&1; then echo YES; fi +.endif +.endif + +.if defined(IA32_BINARY_PORT) && ${ARCH} != "i386" +.if ${ARCH} == "amd64" || ${ARCH} == "ia64" +.if !defined(HAVE_COMPAT_IA32_KERN) +IGNORE= you need a kernel with compiled-in IA32 compatibility to use this port. +.elif !defined(HAVE_COMPAT_IA32_LIBS) +IGNORE= you need the 32-bit libraries installed under /usr/lib32 to use this port. +.endif +_LDCONFIG_FLAGS=-32 +LIB32DIR= lib32 +.else +IGNORE= you have to use i386 (or compatible) platform to use this port. +.endif +.else +LIB32DIR= lib +.endif +PLIST_SUB+= LIB32DIR=${LIB32DIR} + .if defined(USE_ZIP) EXTRACT_DEPENDS+= unzip:${PORTSDIR}/archivers/unzip .endif @@ -3908,6 +3913,12 @@ .endif # This can be removed once all ports have been converted to USE_LDCONFIG. .if defined(INSTALLS_SHLIB) +.if defined(USE_LDCONFIG) + @${ECHO_MSG} "===> INSTALLS_SHLIB and USE_LDCONFIG both defined." +.endif +.if defined(USE_LDCONFIG32) + @${ECHO_MSG} "===> INSTALLS_SHLIB and USE_LDCONFIG32 both defined." +.endif .if !defined(INSTALL_AS_USER) .if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig" @@ -4901,7 +4912,7 @@ fi; \ if [ -z "${DESTDIR}" ] ; then \ ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ - if ${LDCONFIG} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ + if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ ${ECHO_MSG} " - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ ${ECHO_MSG} " (but building it anyway)"; \ >Release-Note: >Audit-Trail: >Unformatted: