Source: mjpegtools
Version: 1:2.1.0+debian-3
Severity: important
Tags: patch

Hi,

your package configures with --disable-simd-accel but the upstream
code fails to fully disable all related functions, leading to some
asm code still being compiled, which fails on x32 due to its model.

The attached patch fully disables the (unused anyway!) code making
it buildable on x32. I tested on i386, where it still builds, too.

Please apply and forward upstream. Thanks!

-- System Information:
Debian Release: stretch/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: i386, amd64

Kernel: Linux 4.1.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)
diff -Nru mjpegtools-2.1.0+debian/debian/changelog mjpegtools-2.1.0+debian/debian/changelog
--- mjpegtools-2.1.0+debian/debian/changelog	2014-12-08 11:08:24.000000000 +0100
+++ mjpegtools-2.1.0+debian/debian/changelog	2015-08-28 10:37:41.000000000 +0200
@@ -1,3 +1,10 @@
+mjpegtools (1:2.1.0+debian-3+x32.1) unreleased; urgency=medium
+
+  * Non-maintainer upload.
+  * New patch to disable unused CPU detection
+
+ -- Thorsten Glaser <t.gla...@tarent.de>  Fri, 28 Aug 2015 10:37:14 +0200
+
 mjpegtools (1:2.1.0+debian-3) unstable; urgency=medium
 
   [ Alessio Treglia ]
diff -Nru mjpegtools-2.1.0+debian/debian/patches/18_no-simd.patch mjpegtools-2.1.0+debian/debian/patches/18_no-simd.patch
--- mjpegtools-2.1.0+debian/debian/patches/18_no-simd.patch	1970-01-01 01:00:00.000000000 +0100
+++ mjpegtools-2.1.0+debian/debian/patches/18_no-simd.patch	2015-08-28 10:37:06.000000000 +0200
@@ -0,0 +1,76 @@
+Description: Test for SIMD instructions at run-time only if configured.
+ Do not attempt to use e.g. CPU detection if the result does not matter
+ anyway; fixes FTBFS on architectures with slightly different asm, such
+ as x32.
+Author: Thorsten Glaser <t.gla...@tarent.de>
+Forwarded: no
+Bug-Debian: coming
+Last-Update: 2015-08-28
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -386,6 +386,8 @@ AC_SUBST(PROGRAM_NOPIC)
+ 
+ if test "$enable_simd_accel" != "false" -a "$enable_simd_accel" != "no"
+ then
++  AC_DEFINE(HAVE_SIMD_ACCEL, 1, [use SIMD multimedia instructions if possible])
++
+   if test x$have_x86cpu = xtrue
+   then
+       AC_MSG_CHECKING([if C compiler accepts inline MMX assembly])
+--- a/utils/cpu_accel.c
++++ b/utils/cpu_accel.c
+@@ -38,7 +38,7 @@
+ #include <malloc.h>
+ #endif
+ 
+-#ifdef HAVE_ALTIVEC
++#if defined(HAVE_SIMD_ACCEL) && defined(HAVE_ALTIVEC)
+ extern int altivec_copy_v0();
+ #endif
+ 
+@@ -77,7 +77,7 @@ extern int altivec_copy_v0();
+ 
+ static char *parse_next(char **, const char *);
+ 
+-#ifdef HAVE_X86CPU 
++#if defined(HAVE_SIMD_ACCEL) && defined(HAVE_X86CPU)
+ 
+ /* Some miscelaneous stuff to allow checking whether SSE instructions cause
+    illegal instruction errors.
+@@ -208,7 +208,7 @@ static int x86_accel (void)
+ #endif
+ 
+ 
+-#ifdef HAVE_ALTIVEC
++#if defined(HAVE_SIMD_ACCEL) && defined(HAVE_ALTIVEC)
+ /* AltiVec optimized library for MJPEG tools MPEG-1/2 Video Encoder
+  * Copyright (C) 2002  James Klicman <ja...@klicman.org>
+  *
+@@ -263,7 +263,7 @@ noAltiVec:
+ 
+ int32_t cpu_accel (void)
+ {
+-#ifdef HAVE_X86CPU 
++#if defined(HAVE_SIMD_ACCEL) && defined(HAVE_X86CPU)
+     static int got_accel = 0;
+     static int accel;
+ 
+@@ -273,7 +273,7 @@ int32_t cpu_accel (void)
+     }
+ 
+     return accel;
+-#elif defined(HAVE_ALTIVEC)
++#elif defined(HAVE_SIMD_ACCEL) && defined(HAVE_ALTIVEC)
+     return detect_altivec();
+ #else
+     return 0;
+@@ -356,7 +356,7 @@ void *bufalloc( size_t size )
+ 
+ 	if( !bufalloc_init )
+ 	{
+-#ifdef HAVE_X86CPU 
++#if defined(HAVE_SIMD_ACCEL) && defined(HAVE_X86CPU)
+ 		if( (cpu_accel() &  (ACCEL_X86_SSE|ACCEL_X86_3DNOW)) != 0 )
+ 		{
+ 			simd_alignment = 64;
diff -Nru mjpegtools-2.1.0+debian/debian/patches/series mjpegtools-2.1.0+debian/debian/patches/series
--- mjpegtools-2.1.0+debian/debian/patches/series	2014-12-08 09:30:45.000000000 +0100
+++ mjpegtools-2.1.0+debian/debian/patches/series	2015-08-28 10:35:06.000000000 +0200
@@ -11,3 +11,4 @@
 15_fix_qttoy4m_linking.diff
 16_fix_ftbfs_format_security.patch
 17_hurd.patch
+18_no-simd.patch

Reply via email to