bi-arch on an amd64

Gabriel de Perthuis Gabriel.de-Perthuis at laPoste.net
Thu Jan 6 05:19:34 CST 2005


OK, it boils down to a regression between wine-20040914 and
wine-20040919: binaries won't run (wine: could not exec
hUlUhUlUp/bin/wine-pthread).
I suppose this problem is not new, since bleeding-edge hoary still
sticks to this release.

For the record, here is how to build wine from an amd64:
Use this patch (or fix include files to use signal.h
from /usr/include/i386-linux):
--- dlls/ntdll/signal_i386.c.orig       2005-01-06 10:41:12.000000000
+0100
+++ dlls/ntdll/signal_i386.c    2005-01-06 10:42:41.000000000 +0100
@@ -111,7 +111,7 @@
                           "int $0x80\n\t"
                           "popl %%ebx"
                           : "=a" (sig)
-                          : "0" (SYS_sigaction), "r" (sig), "c" (new),
"d" (old) );
+                          : "0" (SYS_rt_sigaction), "r" (sig),
"c" (new), "d" (old) );
     if (sig>=0) return 0;
     errno = -sig;
     return -1;


If wine is more recent than 20040919, patch Make.rules.in so that
WINEBUILD is passed --ld-cmd=$(LD) (quoted properly); otherwise there is no problem.

./configure --x-libraries=/usr/X11R6/lib32 LD='ld -m elf_i386'
AS will default to as --32, gcc to gcc -m32...; do not set AS to gcc
-m32, though I've seen it somewhere; LD is set properly only after wine-20040919


More detail below:

Le mercredi 05 janvier 2005 à 20:45 -0500, Vincent Béron a écrit :
> Le mer 05/01/2005 à 17:27, Gabriel de Perthuis a écrit :
> > Hello,
> > I'm trying to get wine cross compiled for my distrib, a 64-bit ubuntu.
> > I'm using:
> > a gcc-3.4 bi-arch toolchain (gcc built with --enable-multilib);
> > the wine-20041201 tarball;
> > this configure command (CC is ccache gcc-3.4):
> > AS="as --32" CC="$CC -m32" CXX="$CXX -m32" ./configure
> > --x-libraries=/usr/X11R6/lib32
> > note: with AS the same as CC, it gets stuck with
> > dlls/ntdll/relay32.s -> relay32.o
> > these two patches :
> > sed -i s/SYS_sigaction/SYS_rt_sigaction/g dlls/ntdll/signal_i386.c
> > replacing ld with ld -m elf_i386 in the ld_cmd definition in
> > tools/winebuild/main.c
> 
> What happens with straight ./configure? By default it'll use "gcc -m32"
> et al, as a native x86-64 Wine is not usable yet (I don't even know if
> it compiles as some asm (non-portable across archs) parts are probably
> non-existing yet. Not to mention some other things I'm sure I'm
> forgetting.
Let's see what I have changed from plain ./configure.
CC='ccache gcc-3.4' is because my gcc-3.3 wasn't built with
--enable-multilib; I add ccache so as to speed up make clean all, but
since it could conceivably create errors maybe I'll try without.

If I don't set AS it is set to "as --32" by default, which works. I did
set it explicitly because I had read somewhere that I should export AS
to gcc, which failed like this:
../../tools/winebuild/winebuild -D__WINESRC__  -D_KERNEL32_
-DETCDIR="\"/usr/local/etc\"" -D_REENTRANT -fPIC -o relay16asm.s
--relay16
gcc-3.4 -m32 -o relay16asm.o relay16asm.s
/usr/lib/gcc/x86_64-linux/3.4.4/../../../../lib32/crt1.o(.text+0x18): In
function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/tmp/ccJAqsbM.o(.text+0x3d): In function `__wine_call_from_16_word':
: undefined reference to `wine_ldt_copy'
/tmp/ccJAqsbM.o(.text+0x87): In function `__wine_call_from_16_word':
: undefined reference to `RELAY_DebugCallFrom16'
/tmp/ccJAqsbM.o(.text+0xa9): In function `__wine_call_from_16_word':
: undefined reference to `RELAY_DebugCallFrom16Ret'
/tmp/ccJAqsbM.o(.text+0x111): In function `__wine_call_from_16_long':
: undefined reference to `wine_ldt_copy'
/tmp/ccJAqsbM.o(.text+0x15b): In function `__wine_call_from_16_long':
: undefined reference to `RELAY_DebugCallFrom16'
/tmp/ccJAqsbM.o(.text+0x17d): In function `__wine_call_from_16_long':
: undefined reference to `RELAY_DebugCallFrom16Ret'
/tmp/ccJAqsbM.o(.text+0x1e9): In function `__wine_call_from_16_regs':
: undefined reference to `wine_ldt_copy'
/tmp/ccJAqsbM.o(.text+0x2e3): In function `__wine_call_from_16_regs':
: undefined reference to `RELAY_DebugCallFrom16'
/tmp/ccJAqsbM.o(.text+0x30a): In function `__wine_call_from_16_regs':
: undefined reference to `RELAY_DebugCallFrom16Ret'
/tmp/ccJAqsbM.o(.text+0x3d9): In function `__wine_call_from_16_thunk':
: undefined reference to `wine_ldt_copy'
/tmp/ccJAqsbM.o(.text+0x5de): In function `CALL32_CBClient':
: undefined reference to `wine_ldt_copy'
/tmp/ccJAqsbM.o(.text+0x66e): In function `CALL32_CBClientEx':
: undefined reference to `wine_ldt_copy'
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [relay16asm.o] Erreur 1
make[2]: quittant le répertoire
« /home/g2p/Construction/wine/wine-20041201.orig/dlls/kernel »
make[1]: *** [kernel] Erreur 2
make[1]: quittant le répertoire
« /home/g2p/Construction/wine/wine-20041201.orig/dlls »
make: *** [dlls] Erreur 2

A better solution is to change WINEBUILD in the makefiles to use
--ld-cmd=$(LD), which involves some quoting magic.

Finally, there must be a header problem that makes SYS_sigaction be
undefined (

> I'd first verify that they actually work on a 32-bit kernel (and 32-bit
> libs). Else, it's probably a build problem (so there's probably another
> problem lurking somewhere).
I've just installed the binaries into a 32-bit chroot (where default wine works fine).
Notice the slight difference :) :
wine: could not exec hUlUhUlUp/bin/wine-pthread

Now I have my chroot, I've built wine from it and I can compare the two
binaries.
In its 32-bit chroot, my clean wine still crashes.
So the problem with my binaries is finally amd64-unrelated. The fact
that the kernel is 64-bit is unimportant since I can run the distro's
i386 wine from the chroot.

gdb wine tells me that it's looking for wine in a variety of places, and
simply fails to find suitable binaries. The character corruption appears
only after all paths are searched.

After testing without ccache and with gcc-3.3 in the chroot, I see that
the problem is with wine-20041201 and wine-20041019, whereas
wine-20040914 works.




More information about the wine-devel mailing list