Build Haiku on Mac failed

Haiku is self hosting now. Best scenario is to install from a pre-built image and compile within Haiku itself on your hardware. Did you follow the tutorial on building on other platforms? It should be in the development docs on haiku-os.org. The tutorial may be deprecated or obsolete by now.

1 Like

Darwin stat uses an -f argument, rather than -c , as it is a GNU extension.
You just change that (just one line) in configure script and it should continue.

2 Likes

Definitely try building Haiku on native hardware. If that’s not an option, a quad-core or better Haiku hypervisor on a Gnu/Linux machine under kvm is halfway decent at building an image. And… if that’s not an option, you could try building under VirtualBox on your Mac, but be aware, (and I say this from experience) it’ll be much slower than the previous two methods I’ve mentioned.

As for the errors, as @Diver also pointed out, macOS handles certain commands differently; in this case, stat. Notice where your output mentions “illegal option – c” and "Bad option ‘-e’ " before continuing. Also, be sure case-sensitivity is on for HFS+. Otherwise, FileName and filename will look the same to Haiku’s build process. Might also add as one final tip, if the final image creation tries to happen early on in the build process (i.e. 79 targets), you can automatically assume something went wrong.

Self hosting does not mean we don’t support building on other platforms. If there are bugs, we should fix them. If the tutorials are wrong, we should update them.

3 Likes

I tried @Diver’s method, but got the same result.
It seems that I can only build it within HaiKu itself…

So how to confirm this is a bug? I noticed that there are some header files not found, like this

C++ objects/haiku/x86_64/release/system/boot/loader/file_systems/packagefs/bios_ia32/ZlibCompressionAlgorithm.o
../src/kits/support/ZlibCompressionAlgorithm.cpp:15:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.

AppendToContainerCopyFilesScript <FloppyBootArchive>haiku-floppyboot-copy-files-dummy-system/add-ons/kernel/console
../src/system/boot/platform/generic/video_splash.cpp:20:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.

Does that mean something?

That usually means it partially extracted a package; this sometimes happens when a concurrent build fails. Try deleting the generated/build_packages directory, that should un-stick it.

@apgreimann, @bullfrog, this really isn’t helpful. Building Haiku on macOS is a bit less-used but completely supported, so telling a user to “just build on Haiku” is not a valid solution.

4 Likes

@PtrNull, @PulkoMandy, @waddlesplash, my apologies. I thought I remembered reading awhile back that cross-compiling was being deprecated. Perhaps I misunderstood native building being prefered to mean cross-compile support was going away.

No, native building isn’t preferred. I don’t know where you read this? It’s easier to set up, but it’s not particularly “preferred.” Both cross-builds and native builds are supported.

Now I have a new problem

I changed /Volumes/HaiKu/haiku/build/jam/ImageRules line 1574

mkisofs -b $(BOOTIMG) -eltorito-alt-boot -no-emul-boot -e $(BOOTEFI) -r -J -V bootimg -o $(<) $(>[1]) $(>[2]) $(>[3-])

to

mkisofs -b $(BOOTIMG) -eltorito-alt-boot -no-emul-boot -eltorito-boot $(BOOTEFI) -r -J -V bootimg -o $(<) $(>[1]) $(>[2]) $(>[3-])

and /Volumes/HaiKu/haiku/build/jam/ImageRules 1512

haiku_loader_size=`stat -c %s "$(>[1])"`
drivers_tgz_size=`stat -c %s "$(>[2])"`

to

haiku_loader_size=`stat -f %z "$(>[1])"`
drivers_tgz_size=`stat -f %z "$(>[2])"`

and /Volumes/HaiKu/haiku/configure line 559

if [ `stat -c '%a' $sourceDir/data/system/boot/SetupEnvironment` -lt 644 ]; then

to

if [ `stat -f '%a' $sourceDir/data/system/boot/SetupEnvironment` -lt 644 ]; then

So there is no Bad Optionanymore, but got some new error.

Here’s the log

headers/os/support/String.h:522:9: error: 'strcmp' was not declared in this scope
See discussion about it here https://echelog.com/logs/browse/haiku/1529272800

As I think I said then, if someone gave me SSH access to a Mac, I could look into this…

Otherwise, getting the preprocessor output of that file to see exactly why strcmp isn’t defined would be helpful.

I really want to do this, but the network I used is campus network and its very unstable.Anyway, thanks very much.

I agree. Unstable/spotty networking is a headache with Haiku’s build system. I remember having migraines because I’d have to start over every time I tried because the network I was on failed midway through.

I think we have wget set to retry 10 times or something like that during the build? And I’m not sure why you’d need to start over, just restarting the build should be enough. At least it is for me in these situations…

To be honest, this was about a year ago, and my network connection was very spotty in addition to any (at the time) instability of the driver I was using at the time. I was near max range on a WiFi connection. When it failed after timeout, all I could do is run jam again and hope for the best. I think I tried a clean environment a few times for reasons only memorable at the time.

@Diver Thanks for your reminder.
I found some reasons in IRC. Because my mac system is not case sensitive.
I installed mac with case-sensitive file system by Parallels Desktop.
The header file problem no longer exists, but I got new problems

 ✗ jam -q -j4 @image
Starting build of type regular ...
Skipping setjmp_test2.S test on non-x86
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...found 155014 target(s)...
...updating 13050 target(s)...
InitScript1 haiku.image-init-vars
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-init-vars
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-make-dirs
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-copy-files
AddTargetVariableToScript1 <unique!target>_target_513
CreateContainerMakeDirectoriesScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-make-dirs
AddTargetVariableToScript1 <unique!target>_target_15
AppendToContainerCopyFilesScript <hpkg_-haiku_loader.hpkg>haiku.package-copy-files-dummy-.
AddTargetVariableToScript1 <unique!target>_target_613
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-extract-files
AddTargetVariableToScript1 <unique!target>_target_25
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku.hpkg/scripts/haiku.package-init-vars
AddTargetVariableToScript1 <unique!target>_target_713
AddTargetVariableToScript1 <unique!target>_target_35
AddTargetVariableToScript1 <unique!target>_target_813
AddTargetVariableToScript1 <unique!target>_target_45
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku.hpkg/scripts/haiku.package-make-dirs
AddTargetVariableToScript1 <unique!target>_target_913
AddTargetVariableToScript1 <unique!target>_target_55
AddTargetVariableToScript1 <unique!target>_target_532
AddTargetVariableToScript1 <unique!target>_target_023
AddTargetVariableToScript1 <unique!target>_target_65
AddTargetVariableToScript1 <unique!target>_target_632
AddTargetVariableToScript1 <unique!target>_target_123
AddTargetVariableToScript1 <unique!target>_target_75
AddTargetVariableToScript1 <unique!target>_target_732
CreateContainerMakeDirectoriesScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku.hpkg/scripts/haiku.package-make-dirs
AddTargetVariableToScript1 <unique!target>_target_223
AddTargetVariableToScript1 <unique!target>_target_85
AddTargetVariableToScript1 <unique!target>_target_832
AddTargetVariableToScript1 <unique!target>_target_323
AddVariableToScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku_loader.hpkg/scripts/haiku.package-init-vars
AddTargetVariableToScript1 <unique!target>_target_932
AppendToContainerMakeDirectoriesScriptAttributes <hpkg_-haiku.hpkg>haiku.package-make-dirs-attributes-dummy-apps
AddTargetVariableToScript1 <unique!target>_target_423
BuildHaikuPackage1 objects/haiku/x86_64/packaging/packages/haiku_loader.hpkg
AppendToContainerMakeDirectoriesScriptAttributes <hpkg_-haiku.hpkg>haiku.package-make-dirs-attributes-dummy-preferences
AddTargetVariableToScript1 <unique!target>_target_042
AddTargetVariableToScript1 <unique!target>_target_523
InitScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku.hpkg/scripts/haiku.package-copy-files
AddTargetVariableToScript1 <unique!target>_target_623
AddTargetVariableToScript1 <unique!target>_target_142
haiku_loader.hpkg: Removing and re-creating package contents dir ...
C++ objects/haiku/x86_64/release/kits/app/LinkReceiver.o
AddTargetVariableToScript1 <unique!target>_target_242
AppendToContainerCopyFilesScript <hpkg_-haiku.hpkg>haiku.package-copy-files-dummy-data/firmware/iprowifi2100
AppendToContainerCopyFilesScript <hpkg_-haiku.hpkg>haiku.package-copy-files-dummy-data/firmware/iprowifi2200
haiku_loader.hpkg: Collecting package contents ...
AddVariableToScript1 objects/haiku/x86_64/packaging/packages_build/regular/hpkg_-haiku.hpkg/scripts/haiku.package-init-vars
AppendToContainerCopyFilesScript <hpkg_-haiku.hpkg>haiku.package-copy-files-dummy-add-ons/kernel/bus_managers
C++ objects/haiku/x86_64/release/kits/app/MessageQueue.o
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku.hpkg>data/mime_db/-/<mimedb-app->usb_mimedb
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku.hpkg>data/mime_db/-/<mimedb-app-<usb>uhci_mimedb
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku.hpkg>data/mime_db/-/<mimedb-app-<usb>ohci_mimedb
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku.hpkg>data/mime_db/-/<mimedb-app-<usb>ehci_mimedb
haiku_loader.hpkg: mimeset'ing package contents ...
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku.hpkg>data/mime_db/-/<mimedb-app-<usb>xhci_mimedb
C++ objects/haiku/x86_64/release/kits/app/MessageRunner.o
haiku_loader.hpkg: Creating the package ...
C++ objects/haiku/x86_64/release/kits/app/Messenger.o
../src/kits/app/LinkReceiver.cpp: In member function 'status_t BPrivate::LinkReceiver::ReadString(BString&, size_t*)':
../src/kits/app/LinkReceiver.cpp:378:18: error: invalid use of incomplete type 'class BString'
   char* buffer = string.LockBuffer(length + 1);
                  ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:378:18: error: invalid use of incomplete type 'class BString'
   char* buffer = string.LockBuffer(length + 1);
                  ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:386:4: error: invalid use of incomplete type 'class BString'
    string.UnlockBuffer();
    ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:386:4: error: invalid use of incomplete type 'class BString'
    string.UnlockBuffer();
    ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:392:3: error: invalid use of incomplete type 'class BString'
   string.UnlockBuffer(length);
   ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:392:3: error: invalid use of incomplete type 'class BString'
   string.UnlockBuffer(length);
   ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~
../src/kits/app/LinkReceiver.cpp:394:3: error: invalid use of incomplete type 'class BString'
   string = "";
   ^~~~~~
In file included from ../src/kits/app/LinkReceiver.cpp:16:0:
../headers/private/app/LinkReceiver.h:18:7: note: forward declaration of 'class BString'
 class BString;
       ^~~~~~~

/Volumes/HaiKu/haiku/generated/cross-tools-x86_64/bin/x86_64-unknown-haiku-gcc -c "../src/kits/app/LinkReceiver.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar -Werror -Wno-error=uninitialized -Wno-error=maybe-uninitialized -Wno-unused-but-set-variable -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-builtin-fork -fno-builtin-vfork -nostdinc -Wno-deprecated -DARCH_x86_64 -DBOOT_ARCHIVE_IMAGE_OFFSET=320 -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/kits/app -iquote objects/common/kits/app -iquote objects/darwin/x86_64/common/kits/app -iquote objects/haiku/x86_64/common/kits/app -I ../headers/libs/icon -I ../headers/private/shared -I ../headers/private/app -I ../headers/private/interface -I ../headers/private/kernel -I ../headers/private/libroot -I ../headers/private/locale -I ../headers/private/notification -I ../headers/private/. -I ../headers/private/system -I ../headers/private/system/arch/x86_64 -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/c++ -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/c++/x86_64-unknown-haiku -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/c++/backward -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/c++/ext -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/gcc/include -I build_packages/gcc_syslibs_devel-7.3.0_2018_05_01-3-x86_64/develop/headers/gcc/include-fixed -I ../headers -I ../headers/posix -I ../headers/glibc -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/codec -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/kits/app/LinkReceiver.o" ;

...failed C++ objects/haiku/x86_64/release/kits/app/LinkReceiver.o ...

BUILD FAILURE:
...failed updating 1 target(s)...
...skipped 8 target(s)...
...updated 55 target(s)...

You didn’t need to install macOS in VM, you could’ve created an image file using DiskUtil and format it to case sensitive FS.

oops, I was not noticed that…But all the images used for haiku are made according to the tutorial steps.
Building Haiku on Mac OS X 10.10 Yosemite. There may be other reasons.
Anyway, its no longer exist.