Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Oct 2013 15:14:34 GMT
From:      Kevin Zheng <kevinz5000@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/183368: [patch] Add options to disable MMX/SSE for x11-toolkits/qt4-gui
Message-ID:  <201310271514.r9RFEYqR043861@oldred.freebsd.org>
Resent-Message-ID: <201310271520.r9RFK0ZZ011998@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         183368
>Category:       ports
>Synopsis:       [patch] Add options to disable MMX/SSE for x11-toolkits/qt4-gui
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 27 15:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Zheng
>Release:        9.2-RELEASE
>Organization:
>Environment:
FreeBSD sigma.local 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Fri Sep 27 03:52:52 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
The Qt4 configure script employs several checks for CPU-specific optimization routines, including the use of 3DNOW, MMX, SSE, SSE2, SSSE3, and SSE4. Usually this works quite well, but becomes problematic when using a package build machine.

If any of the above instructions are found on the package builder, they will be compiled into the package. The builder has no way of knowing whether the clients have these instructions or not. There is no compile-time error; machines with the package installed will simply raise SIGILL or SIGBUS at seemingly random times when run.

The solution is to add port options that disable MMX and SSE when building a package by default. Ideally, it should check that PACKAGE_BUILDING is set. If so, do not add any optimizations. This lets us get the best of both worlds.
>How-To-Repeat:
Build multimedia/vlc on a machine supporting a bunch of optimized routines. Then install the package on an older machine. VLC will be killed by SIGBUS whenever the user tries to scroll using the slider bar.
>Fix:
Apply the attached patch. A comprehensive solution will require more work, as every Qt4 port also uses the optimized routines by default. Perhaps a global Qt option defined in devel/qt4/files/Makefile.options is in order.

In addition, this patch does not include the desired PACKAGE_BUILDING check.

Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 331776)
+++ Makefile	(working copy)
@@ -51,6 +51,18 @@
 FONTSCALE=	${LOCALBASE}/lib/X11/fonts/TTF/luximb.ttf
 FONTENCOD=	${LOCALBASE}/lib/X11/fonts/encodings/encodings.dir
 
+OPTIONS_DEFINE=	MMX SSE
+
+.include <bsd.port.options.mk>
+
+.if !${PORT_OPTIONS:MMMX}
+CONFIGURE_ARGS+=	-no-mmx
+.endif
+
+.if !${PORT_OPTIONS:MSSE}
+CONFIGURE_ARGS+=	-no-sse -no-sse2
+.endif
+
 .include "${.CURDIR}/../../devel/qt4/files/Makefile.options"
 
 .if ${QT4_OPTIONS:MCUPS}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310271514.r9RFEYqR043861>