Subject: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <geert.hendrickx@ua.ac.be>
List: pkgsrc-bugs
Date: 05/29/2005 12:00:01
>Number:         30366
>Category:       pkg
>Synopsis:       multimedia/mjpegtools fails to build with -march=pentium4
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 29 12:00:01 +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.