Haiku

From WineHQ Wiki
Jump to: navigation, search

Haiku

Haiku is an open source operating system inspired by the Be Operating System. Haiku is fast, simple to use, easy to learn and yet very powerful.

Problems

The first problem you'll run into is missing libpthread, libc and libm. However, they aren't missing, they are just one lib, libroot. AJ won't fix Wine to support libroot, understandable as it would lead to some ugly checks in winegcc/winebuild. Haiku won't add dummy libs because the POSIX Standard doesn't force them to have those libs and it's the nature of Haiku to only have libroot.

Also note that LD_LIBRARY_PATH is not supported, so you need to modify LIBRARY_PATH.

Build

To get around these problems, do:

ln -s /system/lib/libroot.so /system/lib/libpthread.so
ln -s /system/lib/libroot.so /system/lib/libc.so
ln -s /system/lib/libroot.so /system/lib/libm.so
ln -s /system/lib/libroot.so /boot/develop/abi/x86/gcc2/tools/gcc-2.95.3-haiku-100818/lib/libpthread.so
ln -s /system/lib/libroot.so /boot/develop/abi/x86/gcc2/tools/gcc-2.95.3-haiku-100818/lib/libc.so
ln -s /system/lib/libroot.so /boot/develop/abi/x86/gcc2/tools/gcc-2.95.3-haiku-100818/lib/libm.so
./configure --without-x --without-freetype --disable-tests
LIBRARY_PATH=$LIBRARY_PATH:/path/to/buildtree/libs/wine make

You will have other problems, such as missing ELF structures and compiler crashes.

Running

If you worked around all of the problems while compiling you can close all open applications and try to run Wine:

LIBRARY_PATH=$LIBRARY_PATH:/path/to/buildtree/libs/wine ./wine cmd

It won't work and your system will become unstable, you need to reboot. The reason is that Wine expects for most mmap calls to succeed, but also that mmap returns the requested memory address. Haiku doesn't mmap 0x7ffe0000 for us with errorcode 0x80000000 (B_NO_MEMORY). This ends in an nearly endless loop of Wine trying to map memory. You can see this with:

LIBRARY_PATH=$LIBRARY_PATH:/path/to/buildtree/libs/wine strace ./loader/wine cmd

With gdb I analysed which part of the Wine code does that:

LIBRARY_PATH=$LIBRARY_PATH:/path/to/buildtree/libs/wine gdb ./loader/wine

It is reserve_area in libs/wine/mmap.c that tries to halve the size of the mapping until it succeeds, which will never happen.

What Wine needs from Haiku

  • in general: LDT support, m(un)lock, pthread_attr_setstack, a fix for the Address Space Layout problem
  • dbghelp: Elf32_Ehdr, Elf32_Shdr, Elf32_Phdr, Elf32_Dyn, DT_DEBUG, DT_NULL, SHT_NULL, SHT_NOBITS, SHT_SYMTAB, SHT_DYNSYM, SHT_DYNAMIC, STT_NOTYPE, STT_FILE, STT_OBJECT, STT_FUNC, SHN_UNDEF, STB_LOCAL, ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, EI_CLASS, ELFCLASS32, ELFCLASS64, PT_LOAD
  • network related: ESOCKTNOSUPPORT, ETOOMANYREFS
  • ntdll: SIGIO, an improved ucontext_t

See also

Thread on haiku-development mailing list from June 2014

Patchseries: configure.ac: fix libpthread detection on Haiku

older Patch

Bug 20116

Bug 4606 at Haiku

Bug 7502 at Haiku (missing LDT table)

Bug 9205 at Haiku (needed mmap improvements)