Package: src:libffado
Version: 2.2.1-2
Severity: wishlist
Tags: patch
User: debian-...@lists.debian.org
Usertags: port-x32 ftbfs-x32

Hi!
I'm afraid libffado tries to use -m32 on x32 (instead of -mx32, or, better,
no such switch at all).  This is because of pretty bizarre platform
detection, which runs objdump on /bin/mount then looks for certain strings.
That will obviously break also for multiarch or cross-compilation.

The attached patch solves the x32 issue, without fixing detection otherwise.


Meow!
-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (600, 'unstable'), (500, 'unreleased'), (50, 'experimental')
Architecture: x32 (x86_64)

Kernel: Linux 3.19.0-x32 (SMP w/6 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Description: detect x32
 This patch fixes misdetection of x32 as i386, and makes it pass -mx32 instead
 of -m32 (what's the purpose of forcing this flag???).
 .
 Unlike detection of 32/64-bitness, it asks the configured compiler instead of
 objdumping /bin/mount.  If somehow you prefer that way instead, the string
 would be: "file format elf32-x86-64".
Author: Adam Borowski <kilob...@angband.pl>

--- libffado-2.2.1.orig/SConstruct
+++ libffado-2.2.1/SConstruct
@@ -659,6 +659,21 @@ def is_userspace_32bit(cpuinfo):
     return answer
 
 
+def is_userspace_x32():
+    """Check if the chosen compiler targets x32.
+    """
+    # Doing this instead of bizarre checks for /bin/mounts, this works
+    # in multiarch/multilib or crosscompiling scenarios.
+    cc = os.getenv('CC')
+    if cc == None:
+        cc = 'cc'
+    x = outputof(cc, '-dumpmachine')
+    for line in x.split('\n'):
+        if line.endswith('x32'):
+            return True
+    return None
+
+
 def cc_flags_x86(cpuinfo, enable_optimizations):
     """add certain gcc -m flags based on CPU features
     """
@@ -758,7 +773,11 @@ if cpuinfo.is_powerpc:
         machineflags = { 'CXXFLAGS' : ['-m64'] }
     env.MergeFlags( machineflags )
 elif cpuinfo.is_x86:
-    if m32:
+    if is_userspace_x32():
+        print "Doing an x32 %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
+        machineflags = { 'CXXFLAGS' : ['-mx32'] }
+        needs_fPIC = True
+    elif m32:
         print "Doing a 32-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
         machineflags = { 'CXXFLAGS' : ['-m32'] }
     else:
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to