NetBSD Problem Report #43912

From www@NetBSD.org  Mon Sep 27 07:06:52 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id A35DA63B8DE
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 27 Sep 2010 07:06:52 +0000 (UTC)
Message-Id: <20100927070652.43AF763B8DB@www.NetBSD.org>
Date: Mon, 27 Sep 2010 07:06:52 +0000 (UTC)
From: schaecsn@gmx.net
Reply-To: schaecsn@gmx.net
To: gnats-bugs@NetBSD.org
Subject: lang/hugs fails to build on sparc64
X-Send-Pr-Version: www-1.0

>Number:         43912
>Category:       pkg
>Synopsis:       lang/hugs fails to build on sparc64
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 27 07:10:00 +0000 2010
>Closed-Date:    Thu Jan 07 15:14:48 +0000 2021
>Last-Modified:  Thu Jan 07 15:14:48 +0000 2021
>Originator:     Stefan
>Release:        NetBSD-5.0.2 on Sparc64
>Organization:
>Environment:
NetBSD-5.0.2 on Sparc64
>Description:
from the build phase:

:
:
configure: creating ./config.status
config.status: creating include/HsBaseConfig.h
config.status: include/HsBaseConfig.h is unchanged
Preprocessing library base-2.0...
../../libraries/tools/hsc2hs -D__HUGS__ -Iinclude -I../../ghc/includes -o System/CPUTime.hs System/CPUTime.hsc
../../libraries/tools/hsc2hs -D__HUGS__ -Iinclude -I../../ghc/includes -o System/Time.hs System/Time.hsc
[1]   Illegal instruction (core dumped) ${rootdir}/src/r...
../../packages/Cabal/examples/hapax.hs: got error code while preprocessing: System.Time
Skipping base package
:
:

This package is fundamental to hugs.


A small note: From lang/hugs Makefile:

# The default -O2 breaks the interpreter producing strange internal errors
# at run time.
.if !empty(CC_VERSION:Mgcc-4*)
CFLAGS+=    -O0
.endif


This does not work as expected. A line from the compilation phase:

gcc -c -DNDEBUG=1 -Wno-error -O2 -march=ultrasparc -pipe -I/usr/local/include -I/usr/include -O0  -O2 hugs.c



-O2 -march=ultrasparc -pipe comes from mk.conf. The final -O2 is set in various configure scripts as OPTFLAGS. I set OPTFLAGS to "" in these configure scripts, but I still get the illegal instruction. Hence, this does not seem to be the core of the problem.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Mon, 27 Sep 2010 16:23:37 +0900

 On Mon, 27 Sep 2010 16:10:00 +0900, <schaecsn@gmx.net> wrote:

 > A small note: From lang/hugs Makefile:
 >
 > # The default -O2 breaks the interpreter producing strange internal errors
 > # at run time.
 > .if !empty(CC_VERSION:Mgcc-4*)
 > CFLAGS+=    -O0
 > .endif

 How about replace "CFLAGS+=-O0" line with followings?

 BUILDLINK_TRANSFORM+= rename:-O*:-O0

 -- 
 OBATA Akio / obache@NetBSD.org

From: Stefan Schaeckeler <schaecsn@gmx.net>
To: gnats-bugs@NetBSD.org
Cc: "OBATA Akio" <obache@netbsd.org>
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Mon, 27 Sep 2010 08:52:00 -0700 (PDT)

 >  > A small note: From lang/hugs Makefile:
 >  >
 >  > # The default -O2 breaks the interpreter producing strange internal errors
 >  > # at run time.
 >  > .if !empty(CC_VERSION:Mgcc-4*)
 >  > CFLAGS+=    -O0
 >  > .endif
 >  
 >  How about replace "CFLAGS+=-O0" line with followings?
 >  
 >  BUILDLINK_TRANSFORM+= rename:-O*:-O0

 Suprisingly, that replaces nothing and results in

 cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c


 Nevertheless, the problem on NetBSD/Sparc64 seems to sit deeper as I get illegal instruction errors even when compiling hugs with -O0. Same problem with gcc34 on NetBSD/Sparc64. Hugs compiles fine with pkgsrc on intel/linux, though.

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Tue, 28 Sep 2010 10:05:44 +0900

 On Tue, 28 Sep 2010 00:55:02 +0900, Stefan Schaeckeler <schaecsn@gmx.net> wrote:

 >  >  BUILDLINK_TRANSFORM+= rename:-O*:-O0
 > Suprisingly, that replaces nothing and results in
 > cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c

 Oops, it should be "rename:-O[2-9]:-O0"

From: Stefan Schaeckeler <schaecsn@gmx.net>
To: gnats-bugs@NetBSD.org
Cc: 	pkg-manager@netbsd.org,gnats-admin@netbsd.org,pkgsrc-bugs@netbsd.org
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Mon, 27 Sep 2010 20:29:04 -0700 (PDT)

 >  >  >  BUILDLINK_TRANSFORM+= rename:-O*:-O0
 >  > Suprisingly, that replaces nothing and results in
 >  > cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c
 >  
 >  Oops, it should be "rename:-O[2-9]:-O0"

 Didn't work, either.

 How old is that remark in the Makefile, anway? I don't have any problems when hugs is compiled from pkgsrc on i386/linux. Maybe the transformation is not necessary on other platforms as well?


 Coming back to the netbsd/sparc64 issue. I compiled several older versions of hugs and non works on netbsd/sparc64. That problem must exist for a long time. 

 An unpatched hugs runs fine on freebsd/sparc64. So, I assume there is only a minor issue on netbsd/sparc64.

  Stefan

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Tue, 28 Sep 2010 13:49:53 +0900

 On Tue, 28 Sep 2010 12:30:09 +0900, Stefan Schaeckeler <schaecsn@gmx.net> wrote:

 >  >  >  >  BUILDLINK_TRANSFORM+= rename:-O*:-O0
 >  >  > Suprisingly, that replaces nothing and results in
 >  >  > cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c
 >  >
 >  >  Oops, it should be "rename:-O[2-9]:-O0"
 > Didn't work, either.

 You cannot see the replacement, it will be done internally.

 >  How old is that remark in the Makefile, anway? I don't have any problems when hugs is compiled from pkgsrc on i386/linux. Maybe the transformation is not necessary on other platforms as well?

 I can use without -O0 on NetBSD-5.0.2-i386.

 >  Coming back to the netbsd/sparc64 issue. I compiled several older versions of hugs and non works on netbsd/sparc64. That problem must exist for a long time.
 > An unpatched hugs runs fine on freebsd/sparc64. So, I assume there is only a minor issue on netbsd/sparc64.

 Hmm, then this issue is not related to gcc optimization, but NetBSD/sparc64 specific issue?

From: Stefan Schaeckeler <schaecsn@gmx.net>
To: gnats-bugs@NetBSD.org
Cc: 	pkg-manager@netbsd.org,gnats-admin@netbsd.org,pkgsrc-bugs@netbsd.org
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Tue, 28 Sep 2010 22:10:05 -0700 (PDT)

 >  >  >  >  >  BUILDLINK_TRANSFORM+= rename:-O*:-O0
 >  >  >  > Suprisingly, that replaces nothing and results in
 >  >  >  > cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c
 >  >  >
 >  >  >  Oops, it should be "rename:-O[2-9]:-O0"
 >  > Didn't work, either.
 >  
 >  You cannot see the replacement, it will be done internally.

 I see on the commandline the above call to gcc (spanned by make). You don't get what you see?


 >  >  How old is that remark in the Makefile, anway? I don't have any problems when hugs is compiled from pkgsrc on i386/linux. Maybe the transformation is not necessary on other platforms as well?
 >  
 >  I can use without -O0 on NetBSD-5.0.2-i386.

 I'm not in the position to make this decision, but how about removing that transformation? The hardcoded -O2 in the configure script should then be eliminated as well.


 >  >  Coming back to the netbsd/sparc64 issue. I compiled several older versions of hugs and non works on netbsd/sparc64. That problem must exist for a long time.
 >  > An unpatched hugs runs fine on freebsd/sparc64. So, I assume there is only a minor issue on netbsd/sparc64.
 >  
 >  Hmm, then this issue is not related to gcc optimization, but NetBSD/sparc64 specific issue?

 That's how it looks to me.

 Calls to gcc define netbsd and freebsd, respecively (-Dnetbsd or something like that). The sourcecode does not really make use of this define. So, same source code for either platform.


From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/43912: lang/hugs fails to build on sparc64
Date: Wed, 29 Sep 2010 14:17:38 +0900

 On Wed, 29 Sep 2010 14:10:06 +0900, Stefan Schaeckeler <schaecsn@gmx.net> wrote:

 >  >  >  >  >  >  BUILDLINK_TRANSFORM+= rename:-O*:-O0
 >  >  >  >  > Suprisingly, that replaces nothing and results in
 >  >  >  >  > cc -c -DNDEBUG=1 -O2 -mcpu=ultrasparc -pipe -I/usr/include  -O2 hugs.c
 >  >  >  >
 >  >  >  >  Oops, it should be "rename:-O[2-9]:-O0"
 >  >  > Didn't work, either.
 >  >
 >  >  You cannot see the replacement, it will be done internally.
 > I see on the commandline the above call to gcc (spanned by make). You don't get what you see?

 You must look at ${WRKDIR}/.work.log to see what was really happened
 (compiler options will be translated/reordered).

State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Fri, 18 Jan 2019 01:24:45 +0000
State-Changed-Why:
i was able to build this on -current sparc64.  can you check if it works for you?


State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 07 Jan 2021 15:14:48 +0000
State-Changed-Why:
Feedback timeout. mrg said it works for him, so assuming fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.