NetBSD Problem Report #46779

From fukachan@fml.org  Tue Aug  7 12:09:47 2012
Return-Path: <fukachan@fml.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id D1CCD63B85F
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  7 Aug 2012 12:09:47 +0000 (UTC)
Message-Id: <20120807105206.8815F61769C@elena.home.fml.org>
Date: Tue,  7 Aug 2012 19:52:06 +0900 (JST)
From: fukachan@fml.org
To: gnats-bugs@gnats.NetBSD.org
Subject: heimdal 1.5.2nb2 compilation failure on PC's due to a gcc error
X-Send-Pr-Version: 3.95

>Number:         46779
>Category:       pkg
>Synopsis:       pkgsrc/security/heimdal 1.5.2nb2 compilation failure on PC's
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 07 12:10:00 +0000 2012
>Closed-Date:    Sat May 20 19:25:25 +0000 2017
>Last-Modified:  Sat May 20 19:25:25 +0000 2017
>Originator:     Ken'ichi Fukamachi
>Release:        NetBSD 5.1.2
>Organization:
NSRG.FML.ORG
>Environment:

		System: NetBSD fml.org 5.1.2 NetBSD 5.1.2 (HOME_SERVER) #0: Sat Feb 18 21:03:22 JST 2012 fukachan@fml.org:/usr/src/sys/arch/i386/compile/HOME_SERVER i386
		Architecture: i386
		Machine: i386

>Description:

We cannot comile pkgsrc/security/heimdal 1.5.2nb2 on PC's since the proper CFLAGS is not given to GCC.

We can see the following errors on several PCs:

   pkgsrc/security/heimdal/work/heimdal-1.5.2/base/.libs/libheimbase.so: undefined reference to `__sync_add_and_fetch_4'
   *** Error code 1

For example, NetBSD 5.1.2/i386 (and 5.1.2_PATCH taken and built from
anoncvs) reveals this problem but NetBSD 6.0_BETA/i386 and NetBSD
6.0_BETA/i386 on KVM (with a kvm hack) NOT.

The patch attached below resolves it on the following limited environments:
(1) using GCC on Intel CPU,
(2) pkgsrc/devel/cpuflags works well,
and
(3) maybe NetBSD 5.x.y/i386.

The more smart solution is that pkgsrc/mk framework should be changed
to use cpuflags.mk by default.


Also, the following quick hacks found in pkgsrc may be or should be
changed to cpuflags.mk framework:

  .if ${MACHINE_ARCH} == "i386"
    CFLAGS+=        -march=i486
    CXXFLAGS+=      -march=i486
  .endif


>How-To-Repeat:

	build pkgsrc/security/heimdal on NetBSD 5.x.y/i386

>Fix:


diff --exclude=CVS -ubr security/heimdal/Makefile nsrg/heimdal/Makefile
--- security/heimdal/Makefile	2012-08-07 15:53:13.000000000 +0900
+++ nsrg/heimdal/Makefile	2012-08-07 15:18:55.000000000 +0900
@@ -24,6 +24,12 @@
 PKGCONFIG_OVERRIDE+=	tools/heimdal-gssapi.pc.in
 MAKE_ENV+=		INSTALL_CATPAGES=no

+# check cpu types
+.if ${MACHINE_ARCH} == "i386"
+BUILD_DEPENDS+=		cpuflags-[0-9]*:../../devel/cpuflags
+.endif  
+
+
 .include "../../mk/bsd.prefs.mk"
 .include "options.mk"

@@ -91,6 +97,11 @@
 pre-build:
 	${TOUCH} ${WRKSRC}/po/localefiles

+# check cpu types
+.if exists(${LOCALBASE}/share/mk/cpuflags.mk)
+.   include "${LOCALBASE}/share/mk/cpuflags.mk"
+.endif
+
 .include "../../databases/sqlite3/buildlink3.mk"
 .include "../../devel/readline/buildlink3.mk"
 .include "../../security/openssl/buildlink3.mk"

>Release-Note:

>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46779 CVS commit: pkgsrc/security/heimdal
Date: Tue, 7 Aug 2012 13:54:22 +0000

 Module Name:	pkgsrc
 Committed By:	obache
 Date:		Tue Aug  7 13:54:22 UTC 2012

 Modified Files:
 	pkgsrc/security/heimdal: distinfo
 	pkgsrc/security/heimdal/patches: patch-ad

 Log Message:
 Improve detection of __sync_add_and_fetch, avoid compiler optimization.

 Fixes PR 46779.


 To generate a diff of this commit:
 cvs rdiff -u -r1.34 -r1.35 pkgsrc/security/heimdal/distinfo
 cvs rdiff -u -r1.10 -r1.11 pkgsrc/security/heimdal/patches/patch-ad

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: obache@NetBSD.org
State-Changed-When: Tue, 07 Aug 2012 13:56:51 +0000
State-Changed-Why:
Should be fixed with different way.
Please feedback whether it is acceptable for you or not.


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 20 May 2017 19:25:25 +0000
State-Changed-Why:
almost-5-year feedback timeout


>Unformatted:
 		since the proper CFLAGS is not given to GCC.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.