Haiku Build on macOS

Hi guys,

I’m on a M5 chip macbook with macOS 26.1 and I have created a case-sensitive filesystem on my mac. I got this error when I run jam -q -j2 @nightly-raw, I have tried compiling the build tools for x86_64 and arm64 as well but this step still failed with the same error:

generated.x86_64 git:(master) jam -q -j2 @nightly-rawnightly-raw

Starting build of type regular …

Building Haiku Nightly

AddHaikuImagePackages: package mawk not available!

Asked for bios_ia32 target boot platform

Unknown path to handle adding to image

Asked for pxe_ia32 target boot platform

Unknown path to handle adding to image

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…patience…

…found 104676 target(s)…

…updating 15995 target(s)…

InitScript1 haiku.image-init-vars

AssembleNasm objects/haiku/x86_64/release/system/boot/platform/bios_ia32/stage1.bin

AddTargetVariableToScript1 <unique!target>_target_081

AddTargetVariableToScript1 <unique!target>_target_181

Link objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable

AddTargetVariableToScript1 <unique!target>_target_281

AddTargetVariableToScript1 <unique!target>_target_381

AddTargetVariableToScript1 <unique!target>_target_481

InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-init-vars

AddTargetVariableToScript1 <unique!target>_target_06

AddTargetVariableToScript1 <unique!target>_target_16

AddTargetVariableToScript1 <unique!target>_target_26

AddTargetVariableToScript1 <unique!target>_target_36

AddTargetVariableToScript1 <unique!target>_target_46

AddTargetVariableToScript1 <unique!target>_target_56

AddTargetVariableToScript1 <unique!target>_target_66

AddTargetVariableToScript1 <unique!target>_target_76

Chmod1 objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable

AddVariableToScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-init-vars

AddFileDataAttribute1 objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable

InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-make-dirs

CreateContainerMakeDirectoriesScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-make-dirs

AddTargetVariableToScript1 <unique!target>_target_581

InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-copy-files

AddTargetVariableToScript1 <unique!target>_target_681

As objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/shell.o

AddTargetVariableToScript1 <unique!target>_target_781

AddTargetVariableToScript1 <unique!target>_target_881

AddTargetVariableToScript1 <unique!target>_target_981

AddTargetVariableToScript1 <unique!target>_target_091

AddTargetVariableToScript1 <unique!target>_target_191

C++ objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/start.o

C++ objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/debug.o

In file included from ../src/system/boot/platform/bios_ia32/debug.cpp:7:

../src/system/boot/platform/bios_ia32/debug.h:9:10: fatal error: stdarg.h: No such file or directory

9 | #include <stdarg.h>

|          ^~~~~~~~~~

compilation terminated.

/Volumes/Haiku/haiku/generated.x86_64/cross-tools-x86_64/bin/x86_64-unknown-haiku-gcc -c “../src/system/boot/platform/bios_ia32/debug.cpp” -Os -Wall -Wno-multichar -Wpointer-arith -Wsign-compare -Wno-ctor-dtor-privacy -Woverloaded-virtual -Werror -Wno-error=unused-but-set-variable -Wno-error=cpp -Wno-error=register -Wno-error=address-of-packed-member -Wno-error=stringop-overread -Wno-error=array-bounds -Wno-error=cast-align -Wno-error=format-truncation -D_BOOT_PLATFORM_BIOS -fno-rtti -fno-strict-aliasing -fno-delete-null-pointer-checks -nostdinc -ffreestanding -finline -fno-semantic-interposition -fno-tree-vectorize -fno-exceptions -fno-use-cxa-atexit -DBOOT_ARCHIVE_IMAGE_OFFSET=384 -fno-pic -march=pentium -Wno-error=main -m32 -D_KERNEL_MODE -D_BOOT_MODE -DARCH_x86_64 -D__HAIKU_PRIMARY_PACKAGING_ARCH=\“x86_64\” -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -DHAIKU_TARGET_PLATFORM_HAIKU -DHAIKU_REGULAR_BUILD -iquote ../build/user_config_headers -iquote ../build/config_headers -iquote ../src/system/boot/platform/bios_ia32 -iquote objects/common/system/boot/platform/bios_ia32/bios_ia32 -iquote objects/darwin/arm64/common/system/boot/platform/bios_ia32/bios_ia32 -iquote objects/haiku/x86_64/common/system/boot/platform/bios_ia32/bios_ia32 -iquote ../src/add-ons/accelerants/common -iquote ../headers/private/kernel/boot/platform/bios_ia32 -I ../headers/private/kernel/disk_device_manager -I ../headers/private/graphics/common -I ../headers/private/graphics/vesa -I ../headers/private/interface -I ../headers/private/storage -I ../headers/private/. -I ../headers/private/kernel -I ../headers/private/libroot -I ../headers/private/shared -I ../headers/private/kernel/boot/platform/bios_ia32 -I ../headers/private/kernel/arch/x86 -I objects/haiku/x86_64/common/system/kernel -I ../headers/private/. -I ../headers/private/system -I ../headers/private/system/arch/x86_64 -I /Volumes/Haiku/haiku/generated.x86_64/cross-tools-x86_64/lib/gcc/x86_64-unknown-haiku/13.3.0/../../../../x86_64-unknown-haiku/include/c++/13.3.0/x86_64-unknown-haiku -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++ -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/x86_64-unknown-haiku -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/backward -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/ext -I ../headers/glibc -I ../headers/posix -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/gcc/include -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/gcc/include-fixed -I ../headers -I ../headers/os -I ../headers/os/add-ons -I ../headers/os/add-ons/file_system -I ../headers/os/add-ons/graphics -I ../headers/os/add-ons/input_server -I ../headers/os/add-ons/registrar -I ../headers/os/add-ons/screen_saver -I ../headers/os/add-ons/tracker -I ../headers/os/app -I ../headers/os/device -I ../headers/os/drivers -I ../headers/os/game -I ../headers/os/interface -I ../headers/os/kernel -I ../headers/os/locale -I ../headers/os/media -I ../headers/os/mail -I ../headers/os/midi -I ../headers/os/midi2 -I ../headers/os/net -I ../headers/os/storage -I ../headers/os/support -I ../headers/os/translation -I ../headers/private/. -o “objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/debug.o”

…failed C++ objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/debug.o …

In file included from ../headers/posix/sys/types.h:126,

from ../headers/posix/string.h:10,

from ../src/system/boot/platform/bios_ia32/start.cpp:7:

../headers/posix/size_t.h:9:10: fatal error: stddef.h: No such file or directory

9 | #include <stddef.h>

|          ^~~~~~~~~~

compilation terminated.

/Volumes/Haiku/haiku/generated.x86_64/cross-tools-x86_64/bin/x86_64-unknown-haiku-gcc -c “../src/system/boot/platform/bios_ia32/start.cpp” -Os -Wall -Wno-multichar -Wpointer-arith -Wsign-compare -Wno-ctor-dtor-privacy -Woverloaded-virtual -Werror -Wno-error=unused-but-set-variable -Wno-error=cpp -Wno-error=register -Wno-error=address-of-packed-member -Wno-error=stringop-overread -Wno-error=array-bounds -Wno-error=cast-align -Wno-error=format-truncation -D_BOOT_PLATFORM_BIOS -fno-rtti -fno-strict-aliasing -fno-delete-null-pointer-checks -nostdinc -ffreestanding -finline -fno-semantic-interposition -fno-tree-vectorize -fno-exceptions -fno-use-cxa-atexit -DBOOT_ARCHIVE_IMAGE_OFFSET=384 -fno-pic -march=pentium -Wno-error=main -m32 -D_KERNEL_MODE -D_BOOT_MODE -DARCH_x86_64 -D__HAIKU_PRIMARY_PACKAGING_ARCH=\“x86_64\” -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -DHAIKU_TARGET_PLATFORM_HAIKU -DHAIKU_REGULAR_BUILD -iquote ../build/user_config_headers -iquote ../build/config_headers -iquote ../src/system/boot/platform/bios_ia32 -iquote objects/common/system/boot/platform/bios_ia32/bios_ia32 -iquote objects/darwin/arm64/common/system/boot/platform/bios_ia32/bios_ia32 -iquote objects/haiku/x86_64/common/system/boot/platform/bios_ia32/bios_ia32 -iquote ../src/add-ons/accelerants/common -iquote ../headers/private/kernel/boot/platform/bios_ia32 -I ../headers/private/kernel/disk_device_manager -I ../headers/private/graphics/common -I ../headers/private/graphics/vesa -I ../headers/private/interface -I ../headers/private/storage -I ../headers/private/. -I ../headers/private/kernel -I ../headers/private/libroot -I ../headers/private/shared -I ../headers/private/kernel/boot/platform/bios_ia32 -I ../headers/private/kernel/arch/x86 -I objects/haiku/x86_64/common/system/kernel -I ../headers/private/. -I ../headers/private/system -I ../headers/private/system/arch/x86_64 -I /Volumes/Haiku/haiku/generated.x86_64/cross-tools-x86_64/lib/gcc/x86_64-unknown-haiku/13.3.0/../../../../x86_64-unknown-haiku/include/c++/13.3.0/x86_64-unknown-haiku -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++ -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/x86_64-unknown-haiku -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/backward -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/c++/ext -I ../headers/glibc -I ../headers/posix -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/gcc/include -I build_packages/gcc_syslibs_devel-13.3.0_2023_08_10-6-x86_64/develop/headers/gcc/include-fixed -I ../headers -I ../headers/os -I ../headers/os/add-ons -I ../headers/os/add-ons/file_system -I ../headers/os/add-ons/graphics -I ../headers/os/add-ons/input_server -I ../headers/os/add-ons/registrar -I ../headers/os/add-ons/screen_saver -I ../headers/os/add-ons/tracker -I ../headers/os/app -I ../headers/os/device -I ../headers/os/drivers -I ../headers/os/game -I ../headers/os/interface -I ../headers/os/kernel -I ../headers/os/locale -I ../headers/os/media -I ../headers/os/mail -I ../headers/os/midi -I ../headers/os/midi2 -I ../headers/os/net -I ../headers/os/storage -I ../headers/os/support -I ../headers/os/translation -I ../headers/private/. -o “objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/start.o”

…failed C++ objects/haiku/x86_64/release/system/boot/platform/bios_ia32/bios_ia32/start.o …

BUILD FAILURE:

…failed updating 2 target(s)…

…skipped 9 target(s)…

…updated 29 target(s)…

I could not reproduce your error. Could you check if you have the command line tools of xcode installed?

P.S.: I gave up on the Apple Silicon build but please continue your efforts. I installed Fedora 43 ARM in UTM (virtualization mode) and was able to compile the build tools and Haiku (x86_64) there. I am so waiting for Arm64 port for Haiku so that I can run Haiku in virtualization mode. Shout out to @dodo75: Any draft code will do! I will try to help fixing bugs. (Might be more trying than fixing.) :slight_smile:

P.P.S.:

The first error I encounter is:

static declaration of ‘strchrnul’ follows non-static declaration in ../src/libs/libsolv/solv/repodata.c:246:27

As work-around you can out-comment the method “static inline const char *strchrnul” in repodata.c

The proper solution would be to clarify why “ifndef HAVE_STRCHRNUL” was evaluated to true. I.e. why HAVE_STRCHRNUL is not defined.

Here’s the corresponding log:

generated.x86_64 % jam -q -j2 @nightly-raw 
Starting build of type regular ... 
Building Haiku Nightly 
AddHaikuImagePackages: package mawk not available! 
Asked for bios_ia32 target boot platform 
Unknown path to handle adding to image 
Asked for pxe_ia32 target boot platform 
Unknown path to handle adding to image 
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...found 104516 target(s)...
...updating 16473 target(s)...
InitScript1 haiku.image-init-vars 
AssembleNasm objects/haiku/x86_64/release/system/boot/platform/bios_ia32/stage1.bin 
AddTargetVariableToScript1 <unique!target>_target_081 
AddTargetVariableToScript1 <unique!target>_target_181 
AddTargetVariableToScript1 <unique!target>_target_281 
Link objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable 
AddTargetVariableToScript1 <unique!target>_target_381 
AddTargetVariableToScript1 <unique!target>_target_481 
Cc objects/darwin/arm64/release/build/libsolv/repodata.o 
../src/libs/libsolv/solv/repodata.c:17:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
   17 | #define _GNU_SOURCE
      |         ^
<command line>:9:9: note: previous definition is here
    9 | #define _GNU_SOURCE 1
      |         ^
ld: warning: search path '/opt/local/lib' not found
Chmod1 objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable 
AddFileDataAttribute1 objects/darwin/arm64/release/tools/makebootable/platform/bios_ia32/makebootable 
../src/libs/libsolv/solv/repodata.c:191:64: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
  191 |           for (sp = data->schemadata + data->schemata[i], h = 0; *sp; len++)
      |                                                                       ^~~
../src/libs/libsolv/solv/repodata.c:180:13: note: initialize the variable 'len' to silence this warning
  180 |   int h, len, i;
      |             ^
      |              = 0
../src/libs/libsolv/solv/repodata.c:246:27: error: static declaration of 'strchrnul' follows non-static declaration
  246 | static inline const char *strchrnul(const char *str, char x)
      |                           ^
2 Likes

Thanks for your reply :slight_smile: Interesting, the first error that I encountered when compiling the build tool was:

/Volumes/Haiku/buildtools/binutils/zlib/zutil.c:10:
In file included from /Volumes/Haiku/buildtools/binutils/zlib/gzguts.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:322:7: error: expected ')'
  322 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));

I fixed it by also commenting out this line # define fdopen(fd,mode) NULL in /buildtools/binutils/zlib/zutil.h

My assumption is that some build tools were designed for generic Unix systems, but macOS also has its own very specific way of defining standard functions, and the build script does not do a very good job on separating the two.

Keen to hear your opnion on this as I’m a newbie on Haiku lol

Also, how’s the performance if you use fedora VM on macOS to build Haiku - is it lagging for development?

Performance is ok, not sluggish, not blazingly fast, not lagging. I use KDE Plasma on a MacBook Air M3 with 24 GB RAM. I used Geany for editing work, did not yet set-up an IDE.

I encountered fdopen/zlib, too. There was also a define I modified regarding a macOS switch. I have to plug-in the usb drive and check it later.

I am still a total newbie on Haiku. Seems to be a common thing. :slight_smile:

A year ago the build on Apple Silicon didn’t work:

1 Like

I fixed the issues with building on macOS the other day so if you pull the latest changes for buildtools and haiku it should work fine

4 Likes