Building the buildtools

Just a quick question, how does one continue where the build left off after making changes?, right now calling ./configure again results in the build starting all over again.

If the configure step finished successfully, you’ll generally need to call ‘make’ next.

Well, for the buildtools this is a bit different, when you run ./configure, “make” is ran automatically for you. But never mind, i’ve found how to do it, i wonder why i didn’t think of something so obvious right away?. just enter the generated.arch/cross-tools-arch-build/gcc directory and type make from there.
arch = the platform you’re building for.


I am trying to build a powerpc boot image with clang (the buildtools with gcc are broken), but clang gets confused at last step? and throws the below error.
Anyone has seen this error before or knows what it means?

BootLd objects/haiku/ppc/release/system/boot/openfirmware/boot_loader_openfirmware 
SetType1 objects/haiku/ppc/release/system/boot/openfirmware/boot_loader_openfirmware 
MimeSet1 objects/haiku/ppc/release/system/boot/openfirmware/boot_loader_openfirmware 
SetVersion1 objects/haiku/ppc/release/system/boot/openfirmware/boot_loader_openfirmware 
CopySetHaikuRevision1 objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware 
BuildCoffLoader objects/haiku/ppc/release/system/boot/openfirmware/haiku_loader.openfirmware 
llvm-objcopy: error: invalid output format: 'symbolsrec'

rm -f -f objects/haiku/ppc/release/system/boot/openfirmware/haiku_loader.openfirmware

llvm-objcopy -O symbolsrec objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware.syms
EP=`grep _coff_start objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware.syms | tr -d '\r' | cut -d'$' -f2`
rm -f -f objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware.syms

llvm-objcopy -O xcoff-powermac --set-start="0x${EP}" objects/haiku/ppc/release/system/boot/openfirmware/revisioned/boot_loader_openfirmware objects/haiku/ppc/release/system/boot/openfirmware/haiku_loader.openfirmware

objects/haiku_host/x86_64/release/tools/hack_coff/hack-coff objects/haiku/ppc/release/system/boot/openfirmware/haiku_loader.openfirmware

...failed BuildCoffLoader objects/haiku/ppc/release/system/boot/openfirmware/haiku_loader.openfirmware ...

...failed updating 1 target(s)...
...skipped 1 target(s)...
...updated 620 target(s)...

ps: forgot to mention how configured, is this correct when using clang?

../configure --use-clang ppc --use-gcc-pipe -j2 --cross-tools-source ../../buildtools --build-cross-tools ppc
HAIKU_REVISION="hrev57086" jam -q -j2 haiku-boot-cd

1 Like

No one has worked on the PowerPC port for about a decade, and no one has worked on the clang port also for about a decade. Trying to use both at the same time is a bold move!

During the build, we generate an openfirmware bootloader. This needs to be in a format that is accepted by the openfirmware on Apple machines. It seems llvm-objcopy does not know how to generate this format, while binutils objcopy does (or at least, did when that part of the buildsystem was written).

So you have two options:

  • Use the binutils objcopy at least for this specific step of the build
  • Investigate if llvm-objcopy is able to generate the executable in the format recognized by openfirmware. Maybe it needs a different output format name, or maybe a later version of llvm can do it?

The script can be changed a bit: the ned goal is to build something in XCOFF format, but that format isn’t supported by binutils objcopy directly, so we use an intermediate format (symbolsrec). Maybe with llvm objcopy this won’t be needed? So you can see if removing that build step in src/system/boot/Jamfile will help you (look for the part involving symbolsrec and hack-coff). Maybe @mmu_man can provide some details on what this piece of code is supposed to do?