[haiku-bugs] Re: [Haiku] #10815: Haiku x86_64 cannot build itself

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Sun, 14 Aug 2016 08:07:44 -0000

#10815: Haiku x86_64 cannot build itself
----------------------------+----------------------------
   Reporter:  Luposian      |      Owner:  jessicah
       Type:  bug           |     Status:  assigned
   Priority:  normal        |  Milestone:  Unscheduled
  Component:  Build System  |    Version:  R1/Development
 Resolution:                |   Keywords:
 Blocked By:                |   Blocking:  12910
Has a Patch:  0             |   Platform:  x86-64
----------------------------+----------------------------

Comment (by pulkomandy):

 The problem is the lack of a "multilib" compiler running on Haiku.

 On most Linux and other systems, the compiler can build both 32-bit and
 64-bit executables (using the -m32 and -m64 command line switches). This
 is currently not available in Haiku. In theory, it would just be a matter
 of passing --enable-multilib when configuring GCC, however, we have some
 tricks later in the compiler build process that don't play so well with
 that (we are moving the libraries around manually, IIRC). The fix is not
 very complex, just reviewing our build scripts to handle the changed paths
 in the multilib case.

 This is required currently, because the 64-bit Haiku boots from the BIOS,
 which is still a 32-bit thing (and even 16-bit at the early start). So,
 what happens when you boot is:
 - The BIOS itself starts in 16-bit, 80286 compatible mode,
 - The boot loader switches to 32-bit, 80386 compatible mode,
 - The bootloader switches to 64-bit, Athlon64 compatible mode,
 - Finally, the 64bit kernel is started.

 This means most of the bootloader is actually 32bit. To compile the
 bootloader, you then need a compiler that generates 32-bit executables.
 The small 16-bit part is written in assembler, so fortunately we don't
 need a 16-bit C or C++ compiler.

 There is another solution to avoid this: switch to a fully 64-bit
 environment, with UEFI used instead of the legacy BIOS. In that case, even
 the bootloader runs in 64-bit mode and there are no such problems. There
 has been some progress on this, but it requires some work, still. IIRC,
 the last status update is that we need to replace the VESA driver (which
 is part of the BIOS and not available in UEFI), and there is a crash that
 is yet unexplained during boot.

 As far as I know, building an x86-64 Haiku from within Haiku has never
 been possible because of the mentionned problem with gcc. Unless you had a
 multilib gcc available at some point, in which case it would be very
 interesting to know how you compiled it.

--
Ticket URL: <https://dev.haiku-os.org/ticket/10815#comment:9>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: