Bug 179643

Summary: devel/valgrind: looking at the build host when building the package for enabling 64-bit support on AMD64; is a REALLY bad idea
Product: Ports & Packages Reporter: Enji Cooper <ngie>
Component: Individual Port(s)Assignee: Bryan Drewery <bdrewery>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
valgrind.txt
none
valgrind.txt none

Description Enji Cooper freebsd_committer freebsd_triage 2013-06-17 19:40:00 UTC
The devel/valgrind port is wonky when it goes and decides that it needs to build 32-bit vs 64-bit, as it looks for /usr/lib32 on the build host:

. if !exists(/usr/lib32/libc.so)
CONFIGURE_ARGS+=        --enable-only64bit
PLIST_SUB+=     X86="@comment "

This really needs to be turned into a proper option that defaults to on that a user can override and the path that should be checked should be in DESTDIR, not /usr/lib32 .
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-06-17 19:40:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->bdrewery

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2013-06-17 23:45:22 UTC
Hi Garret,

Thank you for pointing this out. I tookover this port some time ago and
had not considered this logic much. I will take another look at it.

-- 
Regards,
Bryan Drewery
Comment 3 r4721@tormail.org 2013-06-23 15:27:46 UTC
simple patch is attached. building on amd64 host with WITHOUT_LIB32 keeps
functioning, and building into a DESTDIR with lib32 also worked. (only
building was tested)

the desired option is not much understood, unless it is just to have the
ability to turn off 32-bit ability even when lib32 is present.

could the goal of the option be more clearly stated?

without lib32 it cannot build unless --enable-only64bit is given:

cc -m64 -fomit-frame-pointer -O2 -g -Wall -Wmissing-prototypes -Wshadow
-Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
-Wno-format-zero-length -fno-strict-aliasing -fno-builtin -fpic -O -g
-fno-omit-frame-pointer -fno-strict-aliasing -fno-builtin -Wno-long-long
-O2 -pipe -fno-strict-aliasing -Wno-pointer-sign -fno-stack-protector
-nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst -m64  -o
vgpreload_core-amd64-freebsd.so
vgpreload_core_amd64_freebsd_so-vg_preloaded.o
cc -m64 -fomit-frame-pointer -O2 -g -Wall -Wmissing-prototypes -Wshadow
-Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
-Wno-format-zero-length -fno-strict-aliasing -fno-builtin  -Wno-long-long
-O2 -pipe -fno-strict-aliasing -Wno-pointer-sign -fno-stack-protector -m64
-fomit-frame-pointer -O2 -g -Wall -Wmissing-prototypes -Wshadow
-Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
-Wno-format-zero-length -fno-strict-aliasing -fno-builtin   -o vgdb
vgdb-vgdb.o -lpthread
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crti.o' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crtbeginS.o'
is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crtendS.o'
is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crtn.o' is
incompatible with i386 output
ranlib libcoregrind-x86-freebsd.a
ranlib libcoregrind-amd64-freebsd.a
cc: Internal error: Segmentation fault: 11 (program ld)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Enji Cooper freebsd_committer freebsd_triage 2013-06-25 02:22:36 UTC
1. This is a dupe of ports/174563 (didn't see that PR before I filed
this issue).
2. There needs to be an override because the one implemented here has
issues with the directory as well (the patch attached to ports/174563
is a wee bit smarter, but still we need an override).
I'll try and see if I can figure out an equivalent flag in OptionsNG
or catch bapt@ on IRC about this item.
Thanks!
-Garrett
Comment 5 r4721@tormail.org 2013-06-25 12:21:16 UTC
please check attached patch for if acceptable.
Comment 6 Bryan Drewery freebsd_committer freebsd_triage 2013-07-04 17:57:51 UTC
State Changed
From-To: open->closed

Option 32BIT and LIB32_PATH added.
Comment 7 dfilter service freebsd_committer freebsd_triage 2013-07-04 17:57:53 UTC
Author: bdrewery
Date: Thu Jul  4 16:57:39 2013
New Revision: 322282
URL: http://svnweb.freebsd.org/changeset/ports/322282

Log:
  - Add 32BIT option to enable/disable 32bit compat
  - Add LIB32_PATH to allow overriding where 32bit
    libs are installed, default to DESTDIR/usr/lib32/libc.so
  
  PR:		ports/179643
  Reported by:	Garrett Cooper <yaneurabeya@gmail.com>
  Submitted by:	r4721@tormail.org (based on)

Modified:
  head/devel/valgrind-snapshot/Makefile
  head/devel/valgrind/Makefile

Modified: head/devel/valgrind-snapshot/Makefile
==============================================================================
--- head/devel/valgrind-snapshot/Makefile	Thu Jul  4 16:50:06 2013	(r322281)
+++ head/devel/valgrind-snapshot/Makefile	Thu Jul  4 16:57:39 2013	(r322282)
@@ -9,7 +9,6 @@ MASTER_SITES=	http://cdn.bitbucket.org/s
 		http://mirror.shatow.net/freebsd/${PORTNAME}/
 PKGNAMESUFFIX=	-snapshot
 DISTNAME=	${PORTNAME}-freebsd-${PORTVERSION}
-DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	bdrewery@FreeBSD.org
 COMMENT=	Memory debugging and profiling tool
@@ -27,7 +26,14 @@ MAN1=		callgrind_control.1 \
 		ms_print.1 \
 		cg_annotate.1
 
-OPTIONS_DEFINE=	MPI
+LIB32_PATH?=	${DESTDIR}/usr/lib32/libc.so
+
+OPTIONS_DEFINE=		MPI
+OPTIONS_DEFINE_amd64=	32BIT
+.if exists(${LIB32_PATH})
+OPTIONS_DEFAULT_amd64=	32BIT
+.endif
+32BIT_DESC=	Enable debugging of 32-bit programs (requires lib32)
 MPI_DESC=	Enable build of MPI wrappers
 
 MPI_LIB_DEPENDS=	mpich:${PORTSDIR}/net/mpich2
@@ -48,10 +54,14 @@ WRKSRC=		${WRKDIR}/${DISTNAME}
 
 .if ${ARCH} == "amd64"
 PLIST_SUB+=	AMD64="" ARCH=amd64
-. if !exists(/usr/lib32/libc.so)
+. if !${PORT_OPTIONS:M32BIT}
 CONFIGURE_ARGS+=	--enable-only64bit
 PLIST_SUB+=	X86="@comment "
 . else
+.  if !exists(${LIB32_PATH})
+IGNORE=The lib32 distribution was not found. Please install the lib32\
+distribution or run 'make config' and uncheck 32BIT option
+.  endif
 PLIST_SUB+=	X86=""
 . endif
 .else

Modified: head/devel/valgrind/Makefile
==============================================================================
--- head/devel/valgrind/Makefile	Thu Jul  4 16:50:06 2013	(r322281)
+++ head/devel/valgrind/Makefile	Thu Jul  4 16:57:39 2013	(r322282)
@@ -8,7 +8,6 @@ CATEGORIES=	devel
 MASTER_SITES=	http://cdn.bitbucket.org/stass/valgrind-freebsd/downloads/ \
 		http://mirror.shatow.net/freebsd/${PORTNAME}/
 DISTNAME=	${PORTNAME}-freebsd-${PORTVERSION}
-DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	bdrewery@FreeBSD.org
 COMMENT=	Memory debugging and profiling tool
@@ -25,7 +24,14 @@ MAN1=		callgrind_control.1 \
 		ms_print.1 \
 		cg_annotate.1
 
-OPTIONS_DEFINE=	MPI
+LIB32_PATH?=	${DESTDIR}/usr/lib32/libc.so
+
+OPTIONS_DEFINE=		MPI
+OPTIONS_DEFINE_amd64=	32BIT
+.if exists(${LIB32_PATH})
+OPTIONS_DEFAULT_amd64=	32BIT
+.endif
+32BIT_DESC=	Enable debugging of 32-bit programs (requires lib32)
 MPI_DESC=	Enable build of MPI wrappers
 
 MPI_LIB_DEPENDS=	mpich:${PORTSDIR}/net/mpich2
@@ -46,10 +52,14 @@ WRKSRC=		${WRKDIR}/${DISTNAME}
 
 .if ${ARCH} == "amd64"
 PLIST_SUB+=	AMD64="" ARCH=amd64
-. if !exists(/usr/lib32/libc.so)
+. if !${PORT_OPTIONS:M32BIT}
 CONFIGURE_ARGS+=	--enable-only64bit
 PLIST_SUB+=	X86="@comment "
 . else
+.  if !exists(${LIB32_PATH})
+IGNORE=The lib32 distribution was not found. Please install the lib32\
+distribution or run 'make config' and uncheck 32BIT option
+.  endif
 PLIST_SUB+=	X86=""
 . endif
 .else
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"