NetBSD Problem Report #30366

From www@netbsd.org  Sun May 29 11:59:01 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id A144163B104; Sun, 29 May 2005 11:59:01 +0000 (UTC)
Message-Id: <20050529115901.A144163B104@narn.netbsd.org>
Date: Sun, 29 May 2005 11:59:01 +0000 (UTC)
From: geert.hendrickx@ua.ac.be
Reply-To: geert.hendrickx@ua.ac.be
To: gnats-bugs@netbsd.org
Subject: multimedia/mjpegtools fails to build with -march=pentium4
X-Send-Pr-Version: www-1.0

>Number:         30366
>Category:       pkg
>Synopsis:       multimedia/mjpegtools fails to build with -march=pentium4
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 29 12:00:01 +0000 2005
>Closed-Date:    Tue Jun 07 21:27:13 +0000 2005
>Last-Modified:  Tue Jun 07 22:48:02 +0000 2005
>Originator:     Geert Hendrickx
>Release:        netbsd-2
>Organization:
>Environment:
NetBSD mantis 2.0_STABLE NetBSD 2.0_STABLE (MANTIS) #2: Sat May 28 18:53:14 CEST 2005  geert@mantis:/usr/obj/src/sys/arch/i386/compile/MANTIS i386

>Description:
pkgsrc/multimedia/mjpegtools fails when built with -march=pentium4 in the CFLAGS.  It succeeds with any -march up to pentium3, but (!!), also succeeds with -march=pentium4 when -mcpu=pentium4 is added (however, this is automatically implied by gcc).  

The error comes from compiling some assembler code.  The ./configure script does some `uname -m' checking and accordingly sets a flag $have_cmov (unless $enable_cmov_extension == no).  However, on i386 (or better), NetBSD's "uname -m" _always_ returns i386 (luckily, otherwise binary packages built on a pentium2 bulk build machine wouldn't work on a lesser cpu).  
>How-To-Repeat:
Have CFLAGS+=-march=pentium4 without any -mcpu flag in /etc/mk.conf.  Then do make in pkgsrc/multimedia/mjpegtools: 

Making all in mpeg2enc
gmake[2]: Entering directory `/usr/obj/pkgsrc/multimedia/mjpegtools/work/mjpegtools-1.6.2/mpeg2enc'
if /bin/sh ../libtool --mode=compile cc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../utils  -I/usr/pkg/include -DGLX_GLXEXT_LEGACY -I/usr/include -I/usr/pkg/include/freetype2  -mcpu=i686 -march=i386 -O2 -pipe -march=pentium4 -I/usr/pkg/include -DGLX_GLXEXT_LEGACY -I/usr/include -I/usr/pkg/include/freetype2 -Wall -Wunused -MT quantize_x86.lo -MD -MP -MF ".deps/quantize_x86.Tpo" \
  -c -o quantize_x86.lo `test -f 'quantize_x86.c' || echo './'`quantize_x86.c; \
then mv -f ".deps/quantize_x86.Tpo" ".deps/quantize_x86.Plo"; \
else rm -f ".deps/quantize_x86.Tpo"; exit 1; \
fi
 cc -DHAVE_CONFIG_H -I. -I.. -I../utils -I/usr/obj/pkgsrc/multimedia/mjpegtools/work/.buildlink/include -DGLX_GLXEXT_LEGACY -I/usr/obj/pkgsrc/multimedia/mjpegtools/work/.buildlink/include/freetype2 -mcpu=i686 -march=i386 -O2 -pipe -march=pentium4 -Wall -Wunused -MT quantize_x86.lo -MD -MP -MF .deps/quantize_x86.Tpo -c quantize_x86.c  -fPIC -DPIC -o .libs/quantize_x86.o
{standard input}: Assembler messages:
{standard input}:67: Error: suffix or operands invalid for `movd'
{standard input}:69: Error: suffix or operands invalid for `movd'
{standard input}:77: Error: suffix or operands invalid for `movd'
{standard input}:223: Error: suffix or operands invalid for `movd'
{standard input}:225: Error: suffix or operands invalid for `movd'
{standard input}:233: Error: suffix or operands invalid for `movd'
gmake[2]: *** [quantize_x86.lo] Error 1
gmake[2]: Leaving directory `/usr/obj/pkgsrc/multimedia/mjpegtools/work/mjpegtools-1.6.2/mpeg2enc'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/obj/pkgsrc/multimedia/mjpegtools/work/mjpegtools-1.6.2'
gmake: *** [all] Error 2
*** Error code 2

Stop.
make: stopped in /usr/pkgsrc/multimedia/mjpegtools
===> 
===> There was an error during the ``build'' phase.
===> Please investigate the following for more information:
===>      * log of the build
===>      * /usr/obj/pkgsrc/multimedia/mjpegtools/work/.work.log
===> 
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/multimedia/mjpegtools

>Fix:
add -mcpu=pentium4 to the CFLAGS.  pkgsrc could copy any existing -march=$CPU flag to a -mcpu=$CPU flag to be sure, without breaking anything.  

>Release-Note:

>Audit-Trail:
From: Frederick Bruckman <fredb@immanent.net>
To: Geert Hendrickx <geert.hendrickx@ua.ac.be>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Sun, 29 May 2005 16:36:52 -0500 (CDT)

 In article <20050529120001.592AB63B116@narn.netbsd.org>,
 	geert.hendrickx@ua.ac.be writes:
 > pkgsrc/multimedia/mjpegtools fails when built with -march=pentium4 in the CFLAGS.  It succeeds with any -march up to pentium3, but (!!), also succeeds with -march=pentium4 when -mcpu=pentium4 is added (however, this is automatically implied by gcc).  
 > 
 > The error comes from compiling some assembler code.  The ./configure script does some `uname -m' checking and accordingly sets a flag $have_cmov (unless $enable_cmov_extension == no).  However, on i386 (or better), NetBSD's "uname -m" _always_ returns i386 (luckily, otherwise binary packages built on a pentium2 bulk build machine wouldn't work on a lesser cpu).  

 My money's on the hand-tuned assembler, over the gcc flag. I agree 
 with you, that it would bad to do that automatically.  The package 
 could grow an option, ${MJPEGTOOLS_USE_CMOV}, and a note in the 
 description in "defaults/mk.conf" not to set that unless you run 
 only hosts that support it.  (I guess the simplist way to tell, on 
 NetBSD, is "grep CMOV /var/run/dmesg.boot".)

 >>How-To-Repeat:
 > Have CFLAGS+=-march=pentium4 without any -mcpu flag in /etc/mk.conf.  Then do make in pkgsrc/multimedia/mjpegtools: 

 >  cc -DHAVE_CONFIG_H -I. -I.. -I../utils -I/usr/obj/pkgsrc/multimedia/mjpegtools/work/.buildlink/include -DGLX_GLXEXT_LEGACY -I/usr/obj/pkgsrc/multimedia/mjpegtools/work/.buildlink/include/freetype2 -mcpu=i686 -march=i386 -O2 -pipe -march=pentium4 -Wall -Wunused -MT quantize_x86.lo -MD -MP -MF .deps/quantize_x86.Tpo -c quantize_x86.c  -fPIC -DPIC -o .libs/quantize_x86.o

 Look at that command line.  On the principle that "later options 
 override earlier ones", it has "-mcpu=i686 -march=pentium4", which 
 isn't a configuration you would ever call for deliberately. 

 >>Fix:
 > add -mcpu=pentium4 to the CFLAGS.  pkgsrc could copy any existing -march=$CPU flag to a -mcpu=$CPU flag to be sure, without breaking anything.  

 I think it's a good idea, if you set one, to set the other, if 
 not necessarily to the same thing.  What you're asking for, though, 
 would open up a big can of worms.  What if the compiler isn't gcc? 
 Or suppose it's gcc, but arm rather than i386:  should pkgsrc set 
 "-mtune"?  Should it set "-mfpe"?


 Frederick

From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
To: Frederick Bruckman <fredb@immanent.net>
Cc: gnats-bugs@netbsd.org, tech-pkg@netbsd.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Tue, 7 Jun 2005 13:17:57 +0200

 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Sun, May 29, 2005 at 04:36:52PM -0500, Frederick Bruckman wrote:
 > In article <20050529120001.592AB63B116@narn.netbsd.org>,
 > 	geert.hendrickx@ua.ac.be writes:
 > > pkgsrc/multimedia/mjpegtools fails when built with -march=pentium4
 > > in the CFLAGS.  It succeeds with any -march up to pentium3, but
 > > (!!), also succeeds with -march=pentium4 when -mcpu=pentium4 is
 > > added (however, this is automatically implied by gcc).  
 > > 
 > > The error comes from compiling some assembler code.  The ./configure
 > > script does some `uname -m' checking and accordingly sets a flag
 > > $have_cmov (unless $enable_cmov_extension == no).  However, on i386
 > > (or better), NetBSD's "uname -m" _always_ returns i386 (luckily,
 > > otherwise binary packages built on a pentium2 bulk build machine
 > > wouldn't work on a lesser cpu).  
 > 
 > My money's on the hand-tuned assembler, over the gcc flag. I agree 
 > with you, that it would bad to do that automatically.  The package 
 > could grow an option, ${MJPEGTOOLS_USE_CMOV}, and a note in the 
 > description in "defaults/mk.conf" not to set that unless you run 
 > only hosts that support it.  (I guess the simplist way to tell, on 
 > NetBSD, is "grep CMOV /var/run/dmesg.boot".)

 The patch in attachment introduces a "cmov" option (using the OPTIONS
 framwork), which only exists on i386, and is unset by default.
 According to this option being set or unset, the ./configure flag
 --enable-cmov-extension or --disable-cmov-extension is added.  

 This solves the problem.  Only thing to be done is to document the
 option in mk/defaults/.  It may be worth mentioning that, on NetBSD,
 this extension can be checked with "dmesg | grep CMOV".  

 GH

 -- 
 :wq

 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="Makefile.diff"

 --- multimedia/mjpegtools/Makefile.orig	2005-06-07 12:47:36.000000000 +0200
 +++ multimedia/mjpegtools/Makefile	2005-06-07 13:09:21.000000000 +0200
 @@ -26,6 +26,18 @@

  INFO_FILES=		mjpeg-howto.info

 +.if ${MACHINE_ARCH} == "i386"
 +PKG_OPTIONS_VAR=	PKG_OPTIONS.mjpegtools
 +PKG_SUPPORTED_OPTIONS=	cmov
 +.  include "../../mk/bsd.options.mk"
 +
 +.  if !empty(PKG_OPTIONS:Mcmov)
 +CONFIGURE_ARGS+=	--enable-cmov-extension
 +.  else
 +CONFIGURE_ARGS+=	--disable-cmov-extension
 +.  endif
 +.endif
 +
  .include "../../audio/lame/buildlink3.mk"
  .include "../../devel/SDL/buildlink3.mk"
  .include "../../graphics/ImageMagick/buildlink3.mk"

 --vkogqOf2sHV7VnPd--

From: Thomas Klausner <wiz@NetBSD.org>
To: Geert Hendrickx <geert.hendrickx@ua.ac.be>
Cc: gnats-bugs@NetBSD.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Tue, 7 Jun 2005 13:26:57 +0200

 On Tue, Jun 07, 2005 at 11:19:02AM +0000, Geert Hendrickx wrote:
 >  This solves the problem.  Only thing to be done is to document the
 >  option in mk/defaults/.

 What would you propose as description for the option?

 As long as its mjpegtools-specific, it should have an 'mjpegtools-'
 prefix. Or do you expect other packages to provide such an option too?
 (If yes, which?)

 Cheers,
  Thomas

From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
To: Thomas Klausner <wiz@NetBSD.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Tue, 7 Jun 2005 13:55:10 +0200

 On Tue, Jun 07, 2005 at 01:26:57PM +0200, Thomas Klausner wrote:
 > What would you propose as description for the option?

 --- options.description.orig    2005-06-07 13:43:30.000000000 +0200
 +++ options.description 2005-06-07 13:44:21.000000000 +0200
 @@ -42,6 +42,7 @@
  chips
  chroot
  cirrus
 +cmov                   Enable CMOX instruction (i386 only; check with "grep CMOV /var/run/dmesg.boot")
  cups
  curl
  curses

 Could a similar note (check with ...) be added to mmx (and similar
 options)?  

 > As long as its mjpegtools-specific, it should have an 'mjpegtools-'
 > prefix. Or do you expect other packages to provide such an option too?
 > (If yes, which?)

 mjpegtools is the only package (that I know of) that has this.  But it's
 not mjpegtools-specific in the sense that other packages could as well
 have hand-optimized assembler code that uses of the CMOV instruction.

 GH

 -- 
 :wq

From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
To: Thomas Klausner <wiz@NetBSD.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Tue, 7 Jun 2005 14:08:58 +0200

 On Tue, Jun 07, 2005 at 01:55:10PM +0200, Geert Hendrickx wrote:
 > +cmov                   Enable CMOX instruction (i386 only; check with "grep CMOV /var/run/dmesg.boot")
                                     ^ should be CMOV ...

 GH

 -- 
 :wq

From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30366 CVS commit: pkgsrc/multimedia/mjpegtools
Date: Tue,  7 Jun 2005 21:23:04 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Tue Jun  7 21:23:04 UTC 2005

 Modified Files:
 	pkgsrc/multimedia/mjpegtools: Makefile
 Added Files:
 	pkgsrc/multimedia/mjpegtools: options.mk

 Log Message:
 Add option for enabling CMOV support, defaulting to off.
 This changes the default for this package, so bump PKGREVISION.

 From Geert Hendrickx in PR 30366.


 To generate a diff of this commit:
 cvs rdiff -r1.15 -r1.16 pkgsrc/multimedia/mjpegtools/Makefile
 cvs rdiff -r0 -r1.1 pkgsrc/multimedia/mjpegtools/options.mk

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

From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30366 CVS commit: pkgsrc/mk/defaults
Date: Tue,  7 Jun 2005 21:23:35 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Tue Jun  7 21:23:35 UTC 2005

 Modified Files:
 	pkgsrc/mk/defaults: options.description

 Log Message:
 Add description for mjpegtools-cmov, from Geert Hendrickx in PR 30366.


 To generate a diff of this commit:
 cvs rdiff -r1.26 -r1.27 pkgsrc/mk/defaults/options.description

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Tue, 07 Jun 2005 21:27:13 +0000
State-Changed-Why:
I added an option.mk file based on your diffs.
I named the option mjpegtools-cmov for now, we can easily rename it
if other packages want an cmov option too.

I don't think that options.descriptions is the right place for the
dmesg | grep foo tips, but I'm not quite sure where else to put
them. Any ideas?

Thanks for the PR!


From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
To: wiz@netbsd.org
Cc: pkg-manager@netbsd.org, pkgsrc-bugs@netbsd.org,
	gnats-admin@netbsd.org, tech-pkg@netbsd.org
Subject: Re: pkg/30366
Date: Wed, 8 Jun 2005 00:16:27 +0200

 On Tue, Jun 07, 2005 at 09:27:14PM +0000, wiz@netbsd.org wrote:
 > Synopsis: multimedia/mjpegtools fails to build with -march=pentium4
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: wiz@netbsd.org
 > State-Changed-When: Tue, 07 Jun 2005 21:27:13 +0000
 > State-Changed-Why:
 > I added an option.mk file based on your diffs.
 > I named the option mjpegtools-cmov for now, we can easily rename it
 > if other packages want an cmov option too.
 > 
 > I don't think that options.descriptions is the right place for the
 > dmesg | grep foo tips, but I'm not quite sure where else to put them.
 > Any ideas?
 > 
 > Thanks for the PR!

 Maybe add a section to pkgsrc documentation about "optimizing packages"?  

 GH

 -- 
 :wq

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.