Compiling HaikuPorts packages for different architecture

I am currently running into troubles with RISC-V port because something is crashing in 3rd-party libraries ( that are provided as binary packages. This libraries are compiled with -fomit-frame-pointer that breaks stack trace and makes debugging much harder. Also it may be linked to old brolen glue code.

Is there an instruction how to compile HaikuPorts packages for different architecture?

Cast @pulkomandy, @kallisti5.

4 Likes is provided by gcc, probably when it was bootstrapped?

1 Like

The information for bootstrapping is at

Howver the process documented here expects that you already have a working Haiku install for the target architecture. If that’s not the case, the normal process would be to always build in bootstrap mode (everything will be built from source). It takes a lot of time to do this because several steps are re-run everytime.

So I made a script to avoid this problem:

The idea of this script is:

  • First you build Haiku in bootstrap mode. As part of the process it will cross-compile various packages, using the haikuports-cross recipes and the compiler flags from your gcc port (buildtools repo) and Jamfile configuration. This has to be done from Linux
  • Then you copy the packages to a Haiku install, and you use the script that will extract and repackage them, removing the “_bootstrap” from the package metadata, making it look like these are the “real”, final packages
  • Finally, these packages have to be put in the “downloads” directory of your generated/ working directory; and ideally also put on Haiku servers so that other people can use them. needs to be updated if any package changes versions when you do this (usually not, there are very few updates to the haikuports-cross git repository).

Putting the packages on Haiku server requires root access there currently, so you have to ask kallisti5, waddlesplash or me to do it.


No chances to build from Haiku?

Also is it possible to just build individual packages for target architecture?

For bootstrap packages, not really. It’s all or nothing.


I never managed to get that working. In theory there is nothing that would prevent it, but the build fails in various ways and no one has debugged it.

It should be possible, but not easily accessible currently. Probably it needs adding more specific jam targets to run the builds, or run haikuporter manually.

Bootstrap seems running fine on OpenSUSE.

1 Like

Is it possible to run haikuporter for haikuports.cross directly without using jam -q @bootstrap-raw or specify packages to build?

1 Like

Now I get:

BootstrapRepositoryFetchPackage1 /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPortsCross-build/packages/icu_bootstrap-57.2-2-riscv64.hpkg 
Checking if any dependency-infos need to be updated ...
Looking for stale dependency-infos ...
The following build dependencies were found:
Skipping download of source for icu4c-57_1-src.tgz
Validating checksum of icu4c-57_1-src.tgz
Error: Expected SHA-256: ff8c67cb65949b1e7808f2359f2b80f722697048e90e7cfc382ec1fe229e9581
Error: Found SHA-256:    6e5b3d0218a47698be3314c03863f061ebdad5ca0dc071441af83439a4fc7d5a
Supposedly built package /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPortsCross-build/packages/icu_bootstrap-57.2-2-riscv64.hpkg does not exist; version mismatch?

if [ -e "$package" ]; then
exit 0

if [ "x$haikuCrossDevelPackage" = "x" ]; then
echo "$package does not have a cross-devel package defined!"
exit 1

if [ "x$haikuCrossDevelPackage" = "x${haikuCrossDevelPackage#/}" ]; then

if [ -n  ]; then
for secondaryCrossDevelPackage in  ; do
if [ "x$secondaryCrossDevelPackage" = "x${secondaryCrossDevelPackage#/}" ]; then
if [ -n "$secondaryCrossDevelPackages" ]; then

portSpec=`basename "$package" | sed 's@-.*@@'`

cd /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPortsCross-build

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/Packages/haiku/generated.riscv64-bootstrap/objects/linux/lib"
if [ -n "$secondaryCrossDevelPackages" ]; then
/home/user/Packages/haiku/generated.riscv64-bootstrap/../../haikuporter/haikuporter  \
--all-dependencies  \
--cross-devel-package "$haikuCrossDevelPackage" \
"$secondaryCrossDevelPackages" $portSpec
/home/user/Packages/haiku/generated.riscv64-bootstrap/../../haikuporter/haikuporter  \
--all-dependencies  \
--cross-devel-package "$haikuCrossDevelPackage" $portSpec

if [ ! -e "$package" ]; then
echo "Supposedly built package $package does not exist; version mismatch?"
exit 1

...failed BootstrapRepositoryFetchPackage1 /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPortsCross-build/packages/icu_bootstrap-57.2-2-riscv64.hpkg ...

...failed updating 1 target(s)...
...skipped 16 target(s)...
...updated 75 target(s)...

Created ticket #16975.

1 Like

Seems like a failed download or upstream changed the package as you get:
Skipping download of source for icu4c-57_1-src.tgz
Validating checksum of icu4c-57_1-src.tgz
Error: Expected SHA-256: ff8c67cb65949b1e7808f2359f2b80f722697048e90e7cfc382ec1fe229e9581
Error: Found SHA-256: 6e5b3d0218a47698be3314c03863f061ebdad5ca0dc071441af83439a4fc7d5a

1 Like

icu4c-57_1-src.tgz is not available anymore from specified URL. I downloaded it from different place, changed Haiku build system ICU version to 57.1.2 and that stage passed.

Now it creates source packages of a lot of HaikuPorts packages. Why it is needed? Will it pack all HaikuPorts packages? What is expected time to complete?

1 Like

It creates packages for all haikuports.cross packages, it can take some time and it depends on your hardware (speed of CPU, disk, and downloads). It can be from a few minutes to a few hours the first time you run it. The next runs are a little faster because it can reuse existing packages, but it still is not very fast.

1 Like

Why Qt is needed?

The following required ports will be built first:
Skipping download of source for 5.15.2.tar.gz
Skipping checksum validation of 5.15.2.tar.gz

Downloading: ...
--2021-05-28 16:00:56--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘/home/user/Packages/haiku/generated.riscv64-bootstrap/../../haikuports/dev-qt/qt5/download/qt3d-72b026a22e6942eca4b70ba948022aecbd8965fc.tar.gz’

haikuports.cross processing seems to be already finished, now it seems processing HaikuPorts.


Depending on what you’re trying to do, maybe you can stop there.

The “normal” bootstrap process is:

  • A lot of source packages will be generated and included in the image
  • You can then boot the bootstrap image
  • From inside the image you can run haikuporter, and compile all these packages from the prepared sources

I am not sure if this complete process has been used recently. Maybe @korli did it when working on the 32bit support for 64bit systems? When this process was designed, haikuports was a lot smaller than it is now.

However, for other architectures we had no way to actually run that image. So we did something else:

  • Build the bootstrap packages only
  • Use the “unbootstrap” script to convert these packages to non-boostrap ones
  • Put these packages in the haiku repository (for this you need the help of @kallisti5, @waddlesplash or myself because it requires root access to one of our servers…)

This appears to be sufficient to get Haiku built normally afterwards.

You can find the script here: « pulkomandy « 3rdparty - haiku - Haiku's main repository

Note that this script uses the “package” command, so it is easier to run it from an Haiku machine (after getting the hpkg files copied there, since the other parts of the bootstrap process work only on Linux).

If this approach works for you, we should probably make it the official one, and see if we can automate it. Unfortunately for other architectures we never got this running far enough to check if it actually results in a working system.

1 Like

After Qt it seems finished correctly:

mimesetting files for package qt5_source_rigged-5.15.2-5-riscv64.hpkg ...
creating package qt5_source_rigged-5.15.2-5-riscv64.hpkg ...
----- Package Info ----------------
header size:                     80
heap size:                336290260
TOC size:                   9359706
package attributes size:       5313
total size:               336290340
grabbing qt5_source-5.15.2-5-source.hpkg and moving it to /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPorts-sources-build/packages/qt5_source-5.15.2-5-source.hpkg
grabbing qt5_source_rigged-5.15.2-5-riscv64.hpkg and moving it to /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPorts-sources-build/packages/qt5_source_rigged-5.15.2-5-riscv64.hpkg
non-chroot has these packages active:
Setting up sysroot for non-chroot build: /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/repositories/HaikuPorts-sources-build/meta-ports/meta_portsfile/work-1/boot/cross-sysroot/riscv64
Activating haiku_cross_devel_sysroot package: /home/user/Packages/haiku/generated.riscv64-bootstrap/objects/haiku/riscv64/packaging/packages/haiku_cross_devel_sysroot_stage1_riscv64.hpkg
AddDirectoryToContainerCopyFilesScript <HaikuImage>home/haikuports/input-source-packages/-/<HaikuPorts-repository-source-packages>packages 
MkDir1 objects/haiku/riscv64/packaging/repositories/HaikuPorts-bootstrap 
BuildHaikuPortsRepositoryConfig1 objects/haiku/riscv64/packaging/repositories/HaikuPorts-bootstrap/haikuports.conf 
AppendToContainerCopyFilesScript <HaikuImage>haiku.image-copy-files-dummy-home/haikuports 
AppendToContainerCopyFilesScript <HaikuImage>haiku.image-copy-files-dummy-home/config/settings/boot/launch 
InitScript1 haiku.image-extract-files 
warning: using independent target <HaikuImage>/home/user/Packages/haiku/generated.riscv64-bootstrap/./haiku.image-init-vars
warning: using independent target <HaikuImage>/home/user/Packages/haiku/generated.riscv64-bootstrap/./haiku.image-make-dirs
warning: using independent target <HaikuImage>/home/user/Packages/haiku/generated.riscv64-bootstrap/./haiku.image-copy-files
warning: using independent target <HaikuImage>/home/user/Packages/haiku/generated.riscv64-bootstrap/./haiku.image-extract-files
BuildHaikuImage1 haiku-bootstrap.image 

Creating image ...
Creating filesystem indices...
Populating image ...
Unmounting ...
...updated 549 target(s)...

I changed buildPlatform from BuildPlstformHaiku to BuildPlatformUnix in haikuporter and it started working on Haiku. Lets see how far it progress.


I think that the cmake build requires Qt for the GUI. One can removed this locally before bootstrapping.

Yep, this can be the reason. I have extended the port with the GUI pieces, but i see no point in it at all.

I managed to build gcc_bootstrap under Haiku, but some recipe changes were needed. --with-sysroot=/ cause attempting to use Haiku system libraries (mpfr) and fail because of incompatible architecture.

diff --git a/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe b/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
index a44ec01..8d3330a 100644
--- a/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
+++ b/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
@@ -154,10 +154,10 @@ BUILD()
 		--libexecdir=$installDir/lib --mandir=$manDir --docdir=$docDir \
 		--disable-nls --enable-shared --disable-plugin \
 		--enable-version-specific-runtime-libs \
-		--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
+		--enable-languages=c,c++ --disable-lto --enable-frame-pointer \
 		--enable-threads=posix --enable-tls \
 		--with-pkgversion=$(echo $portVersion | cut -c 7-) \
-		--with-sysroot=/ \
+		--with-sysroot=/boot/data/packages/haiku/generated.riscv64/cross-tools-riscv64 \
 		--with-build-sysroot=$installDestDir/ \
 		--with-threads=posix \
 		--with-default-libstdcxx-abi=gcc4-compatible \
@@ -303,7 +303,7 @@ INSTALL()
 	cd $installDestDir$installDir
 	$effectiveTargetMachineTriple-strip --strip-debug bin/*
-	for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
+	for f in cc1 cc1plus collect2 ; do
 		$effectiveTargetMachineTriple-strip --strip-debug \


Never looked into other architectures for haikuports other then x86_64 and x86_gcc2 (and x86 for secondary), how do the packages get build if one would enable another architecture?
The buildbot atm is running the ones for 32bit and 64bit, but I don’t know any other that are able to do this. Is this why you need the gcc_bootstrap for then?
EDIT nvm, should have started reading from the start :wink: