[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#947828: freedv FTBFS on most architectures, unconditionally uses x86 asm for avx detection.



Package: freedv
Version: 1.4-1
Severity: serious
Tags: patch

Freedv 1.4 added support for the 2020 codec.  This feature is only enabled if avx support is detected. Comments in the source code claim that this is because without avx support it will not be processed fast enough for realtime operation. I have not dug into the question of if the 2020 code benefits from avx specifically or if avx is just being used as a proxy for general CPU performance.

Unfortunately the avx detection code is i386/amd64 specific inline assembler, so it causes a compile failure on everything else.

The attached debdiff puts the asm behind architecture ifdefs and uses a stub that always returns false on other architectures.

I may or may not NMU this later.

diff -Nru freedv-1.4/debian/changelog freedv-1.4/debian/changelog
--- freedv-1.4/debian/changelog	2019-11-18 03:32:07.000000000 +0000
+++ freedv-1.4/debian/changelog	2019-12-31 10:20:26.000000000 +0000
@@ -1,3 +1,10 @@
+freedv (1.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Put x86 specific code behind ifdefs.
+
+ -- Peter Michael Green <plugwash@debian.org>  Tue, 31 Dec 2019 10:20:26 +0000
+
 freedv (1.4-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru freedv-1.4/debian/patches/put-x86-specific-code-behind-ifdefs freedv-1.4/debian/patches/put-x86-specific-code-behind-ifdefs
--- freedv-1.4/debian/patches/put-x86-specific-code-behind-ifdefs	1970-01-01 00:00:00.000000000 +0000
+++ freedv-1.4/debian/patches/put-x86-specific-code-behind-ifdefs	2019-12-31 10:20:26.000000000 +0000
@@ -0,0 +1,27 @@
+Description: Put x86 specific code behind ifdefs.
+Author: Peter Michael Green <plugwash@debian.org>
+
+--- freedv-1.4.orig/src/fdmdv2_main.cpp
++++ freedv-1.4/src/fdmdv2_main.cpp
+@@ -4496,6 +4496,8 @@ void MainFrame::CloseSerialPort(void)
+ // Tests the underlying platform for AVX support.  2020 needs AVX support to run
+ // in real-time, and old processors do not offer AVX support
+ //
++#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
++
+ void __cpuid(int* cpuinfo, int info)
+ {
+     __asm__ __volatile__(
+@@ -4538,6 +4540,12 @@ void MainFrame::checkAvxSupport(void)
+ 
+     isAvxPresent = avxSupported;
+ }
++#else
++void MainFrame::checkAvxSupport(void)
++{
++    isAvxPresent = false;
++}
++#endif
+ 
+ #ifdef __UDP_SUPPORT__
+ 
diff -Nru freedv-1.4/debian/patches/series freedv-1.4/debian/patches/series
--- freedv-1.4/debian/patches/series	2019-11-18 03:32:07.000000000 +0000
+++ freedv-1.4/debian/patches/series	2019-12-31 10:20:26.000000000 +0000
@@ -2,3 +2,4 @@
 HID-PTT
 debian-version
 optional-lpcnetfreedv
+put-x86-specific-code-behind-ifdefs

Reply to: