Ticket #387 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Can't compile an 32-bit build on 64-bit userspace

Reported by: richhering Assigned to:
Priority: major Milestone:
Component: generic Version: FFADO SVN (trunk)
Keywords: Cc:
The device the bug applies to:

Description

I'm working an an multilib-ebuild for gentoo an get following problem:

scons -j8 PREFIX=/usr MANDIR=/usr/share/man UDEVDIR=/lib/udev/udev/rules.d PYPKGDIR=/usr/lib32/python2.7/site-packages/libffado CUSTOM_ENV=True DEBUG=0 BUILD_TESTS=1 ENABLE_OPTIMIZATIONS=False ENABLE_BEBOB=1 ENABLE_FIREWORKS=0 ENABLE_OXFORD=0 ENABLE_MOTU=0 ENABLE_DICE=0 ENABLE_METRIC_HALO=0 ENABLE_RME=0 ENABLE_DIGIDESIGN=0 ENABLE_BOUNCE=0 DIST_TARGET=i686 LIBDIR=/usr/lib32
scons: Reading SConscript files ...

 * Usage of additional flags is not supported by the ffado-devs.
 * Use at own risk!
 *
 * Flags in use:
 *   CC = x86_64-pc-linux-gnu-gcc -m32
 *   CXX = x86_64-pc-linux-gnu-g++ -m32
 *   CFLAGS = -O2 -march=core-avx-i -mno-avx -mno-aes -mno-rdrnd -pipe -fomit-frame-pointer
 *   CXXFLAGS = -O2 -pipe
 *   LDFLAGS = -Wl,-O1 -Wl,--as-needed

[…]

User space is 64-bit
Doing a 64-bit x86_64 build for Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz

When I set DIST_TARGET to a 32-bit CPU, is_userspace_32bit function should return True. Then I'm able to compile a 32-bit version:

# diff SConstruct SConstruct.orig 
781,783d780
< if env['DIST_TARGET'] == 'i686':
<     m32 = True   
<
scons -j8 PREFIX=/usr MANDIR=/usr/share/man UDEVDIR=/lib/udev/udev/rules.d PYPKGDIR=/usr/lib32/python2.7/site-packages/libffado CUSTOM_ENV=True DEBUG=0 BUILD_TESTS=1 ENABLE_OPTIMIZATIONS=False ENABLE_BEBOB=1 ENABLE_FIREWORKS=0 ENABLE_OXFORD=0 ENABLE_MOTU=0 ENABLE_DICE=0 ENABLE_METRIC_HALO=0 ENABLE_RME=0 ENABLE_DIGIDESIGN=0 ENABLE_BOUNCE=0 DIST_TARGET=i686 LIBDIR=/usr/lib32
scons: Reading SConscript files ...

[…]

User space is 32-bit
Doing a 32-bit x86_64 build for Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz

Change History

01/18/15 02:13:52 changed by jwoithe

Compiling the 32-bit variant in a multilib environment is very similar to a cross compile. There has been little testing of this to date so it's not surprising that this gives trouble. The problem is that on a multilib system the underlying system is 64-bit and this is what is picked up by the is_userspace_32bit() function.

I am somewhat surprised that a simple override of m32 is all that is required for a separate build. My immediate thought is that system library paths would also have to be altered to suit. Evidently scons is taking care of this semi-transparently.

A correct fix is possibly to reference DIST_TARGET in is_userspace_32bit(): if it's i686 then return True regardless of the CPU type:

@@ -659,6 +659,12 @@
     # note that having a 64-bit CPU means nothing for these purposes. You could
     # run a completely 32-bit system on a 64-bit capable CPU.
     answer = None
+
+    # If setting DIST_TARGET to i686 on a 64-bit CPU to facilitate 
+    # compilation of a multilib environment, force 32-bit.
+    if env['DIST_TARGET'] == 'i686':
+        return True
+
     # Debian ppc64 returns machine 'ppc64', but userspace might be 32-bit
     # We'll make an educated guess by examining a known executable
     exe = '/bin/mount'

Does this provide the functionality you are requiring?

02/06/15 21:08:44 changed by richhering

Yes it does:

User space is 32-bit
Doing a 32-bit x86_64 build for Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Insufficient rights to install the system-wide dbus service file.

02/16/15 00:21:22 changed by jwoithe

  • status changed from new to closed.
  • resolution set to fixed.

Thanks for confirming. Patch applied as r2581.