Compiling haikuports.cross for PPC

Hello,
I’ve tried to compile haiku for PowerPC. However, as
especially gcc_syslibs is still on version 8.3.0 (iirc) and
seems to cause a linking failure, I’ve tried running the
bootstrap process as described in
https://www.haiku-os.org/docs/develop/packages/Bootstrapping.html

I’ve tried following it using Debian 12 amd64 as a host and ran:

../configure -j12 --use-gcc-pipe  --cross-tools-source ../../buildtools --build-cross-tools ppc --bootstrap ../../haikuporter/haikuporter ../../haikuports.cross ../../haikuports/
jam -q @bootstrap-raw

I had to fiddle around with haikuporter to load the config and now it does seem
to run, however it now fails with:

Error: --command-package must be specified on this build platform!

I don’t know where the package command is, otherwise I’d try to pass it via the HAIKU_PORTER_EXTRA_OPTIONS environment variable.

Does the guide still work and did I follow it correctly?

kind regards,
zeldakatze

3 Likes

I’m not sure anyone ran a complete bootstrapping for ppc in the last few years. The command line you listed seems the right one and is supposed to automate everything, but, with the process being a bit fragile and not tested very often, it’s not uncommon to have build breakages there.

I don’t know what causes the error you listed. Maybe with a more detailed listing of earlier problems you got, and how you fixed them, we could have some more ideas of wqat’s wrong.

2 Likes

Hello again,
I’ve got the process running by using a completly clean build environment and using an up-to-date jam version. The cross packages seem to build mostly. I’ve applied the Patches from buildtools to gcc and updated some package versions in the PPC file, I’ll submit that as a PR shortly.

However, currently it seems to fail on

libsolv_bootstrap_source-0.3.0_haiku_2014_12_22-1-source.hpkg does not have a cross-devel package defined!

When commenting out the source package, it errors out with:
FetchPackage: package libsolv_source not available!

I’ve attached the failing build log below.

Log
Starting build of type bootstrap ... 
Building Haiku Bootstrap 
AddHaikuImagePackages: package less not available! 
AddHaikuImagePackages: package libedit not available! 
AddHaikuImagePackages: package libedit_devel not available! 
AddHaikuImagePackages: package icu74 not available! 
AddHaikuImagePackages: package libedit not available! 
AddHaikuImagePackages: package libedit_devel not available! 
build-feature packages unavailable on ppc: giflib glu mesa ffmpeg fluidlite libvorbis fontconfig gutenprint webkit libpng libicns jasper jpeg libedit qrencode_kdl tiff libdvdread libdvdnav libraw libwebp libavif live555 zstd 
AddHaikuImagePackages: package bc not available! 
AddHaikuImagePackages: package icu74 not available! 
Asked for openfirmware target boot platform 
Unknown path to handle adding to image 
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...found 78125 target(s)...
...updating 5332 target(s)...
InitScript1 haiku.image-init-vars 
AddTargetVariableToScript1 <unique!target>_target_481 
AddTargetVariableToScript1 <unique!target>_target_581 
AddTargetVariableToScript1 <unique!target>_target_681 
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 
AddTargetVariableToScript1 <unique!target>_target_291 
AddTargetVariableToScript1 <unique!target>_target_391 
AddTargetVariableToScript1 <unique!target>_target_491 
AddTargetVariableToScript1 <unique!target>_target_591 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-init-vars 
AddTargetVariableToScript1 <unique!target>_target_841 
AddTargetVariableToScript1 <unique!target>_target_941 
AddTargetVariableToScript1 <unique!target>_target_051 
AddTargetVariableToScript1 <unique!target>_target_151 
AddTargetVariableToScript1 <unique!target>_target_251 
AddTargetVariableToScript1 <unique!target>_target_351 
AddTargetVariableToScript1 <unique!target>_target_451 
AddTargetVariableToScript1 <unique!target>_target_551 
AddTargetVariableToScript1 <unique!target>_target_651 
AddVariableToScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-init-vars 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-make-dirs 
CreateContainerMakeDirectoriesScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-make-dirs 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-copy-files 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-init-vars 
AddTargetVariableToScript1 <unique!target>_target_211 
AddTargetVariableToScript1 <unique!target>_target_311 
AddTargetVariableToScript1 <unique!target>_target_411 
AddTargetVariableToScript1 <unique!target>_target_511 
AddTargetVariableToScript1 <unique!target>_target_611 
AddTargetVariableToScript1 <unique!target>_target_711 
AddTargetVariableToScript1 <unique!target>_target_811 
AddTargetVariableToScript1 <unique!target>_target_911 
AddTargetVariableToScript1 <unique!target>_target_021 
AddVariableToScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-init-vars 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-make-dirs 
CreateContainerMakeDirectoriesScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-make-dirs 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-copy-files 
AppendToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>haiku.package-copy-files-dummy-develop/lib 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/config/-/<copy-directory-to-container>../headers/config 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/glibc/-/<copy-directory-to-container>../headers/glibc 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/os/-/<copy-directory-to-container>../headers/os 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/posix/-/<copy-directory-to-container>../headers/posix 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/bsd/-/<copy-directory-to-container>../headers/compatibility/bsd 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg>develop/headers/gnu/-/<copy-directory-to-container>../headers/compatibility/gnu 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage0_ppc.hpkg/scripts/haiku.package-extract-files 
BuildHaikuPackage1 objects/haiku/ppc/packaging/packages/haiku_cross_devel_sysroot_stage0_ppc.hpkg 
haiku_cross_devel_sysroot_stage0_ppc.hpkg: Removing and re-creating package contents dir ...
haiku_cross_devel_sysroot_stage0_ppc.hpkg: Collecting package contents ...
haiku_cross_devel_sysroot_stage0_ppc.hpkg: mimeset'ing package contents ...
haiku_cross_devel_sysroot_stage0_ppc.hpkg: Creating the package ...
AppendToContainerCopyFilesScriptSingleFile <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>haiku.package-copy-files-dummy-develop/lib-kernel.so 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-init-vars 
AddTargetVariableToScript1 <unique!target>_target_031 
AddTargetVariableToScript1 <unique!target>_target_131 
AddTargetVariableToScript1 <unique!target>_target_231 
AddTargetVariableToScript1 <unique!target>_target_331 
AddTargetVariableToScript1 <unique!target>_target_431 
AddTargetVariableToScript1 <unique!target>_target_531 
AddTargetVariableToScript1 <unique!target>_target_631 
AddTargetVariableToScript1 <unique!target>_target_731 
AddTargetVariableToScript1 <unique!target>_target_831 
AddVariableToScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-init-vars 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-make-dirs 
CreateContainerMakeDirectoriesScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-make-dirs 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-copy-files 
AppendToContainerCopyFilesScriptSingleFile <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>haiku.package-copy-files-dummy-develop/lib-kernel.so 
AppendToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>haiku.package-copy-files-dummy-develop/lib 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/config/-/<copy-directory-to-container>../headers/config 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/glibc/-/<copy-directory-to-container>../headers/glibc 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/os/-/<copy-directory-to-container>../headers/os 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/posix/-/<copy-directory-to-container>../headers/posix 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/bsd/-/<copy-directory-to-container>../headers/compatibility/bsd 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg>develop/headers/gnu/-/<copy-directory-to-container>../headers/compatibility/gnu 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_stage1_ppc.hpkg/scripts/haiku.package-extract-files 
BuildHaikuPackage1 objects/haiku/ppc/packaging/packages/haiku_cross_devel_sysroot_stage1_ppc.hpkg 
haiku_cross_devel_sysroot_stage1_ppc.hpkg: Removing and re-creating package contents dir ...
haiku_cross_devel_sysroot_stage1_ppc.hpkg: Collecting package contents ...
haiku_cross_devel_sysroot_stage1_ppc.hpkg: mimeset'ing package contents ...
haiku_cross_devel_sysroot_stage1_ppc.hpkg: Creating the package ...
AppendToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>haiku.package-copy-files-dummy-develop/lib 
AppendToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>haiku.package-copy-files-dummy-data/locale/catalogs/x-vnd.Haiku-libbe 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>data/mime_db/-/<mimedb-app->libbe.so_mimedb 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>data/mime_db/-/<mimedb-app->libpackage.so_mimedb 
AppendToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>haiku.package-copy-files-dummy-data/locale/catalogs/x-vnd.Haiku-libpackage 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/config/-/<copy-directory-to-container>../headers/config 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/glibc/-/<copy-directory-to-container>../headers/glibc 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/os/-/<copy-directory-to-container>../headers/os 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/posix/-/<copy-directory-to-container>../headers/posix 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/bsd/-/<copy-directory-to-container>../headers/compatibility/bsd 
AddDirectoryToContainerCopyFilesScript <hpkg_-haiku_cross_devel_sysroot_ppc.hpkg>develop/headers/gnu/-/<copy-directory-to-container>../headers/compatibility/gnu 
InitScript1 objects/haiku/ppc/packaging/packages_build/bootstrap/hpkg_-haiku_cross_devel_sysroot_ppc.hpkg/scripts/haiku.package-extract-files 
BuildHaikuPackage1 objects/haiku/ppc/packaging/packages/haiku_cross_devel_sysroot_ppc.hpkg 
haiku_cross_devel_sysroot_ppc.hpkg: Removing and re-creating package contents dir ...
haiku_cross_devel_sysroot_ppc.hpkg: Collecting package contents ...
haiku_cross_devel_sysroot_ppc.hpkg: mimeset'ing package contents ...
haiku_cross_devel_sysroot_ppc.hpkg: Creating the package ...
BootstrapRepositoryFetchPackage1 /media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/packages/libsolv_bootstrap_source-0.3.0_haiku_2014_12_22-1-source.hpkg 
/media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/packages/libsolv_bootstrap_source-0.3.0_haiku_2014_12_22-1-source.hpkg does not have a cross-devel package defined!


package="/media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/packages/libsolv_bootstrap_source-0.3.0_haiku_2014_12_22-1-source.hpkg"
if [ -e "$package" ]; then
exit 0
fi



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

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


secondaryCrossDevelPackages=
if [ -n  ]; then
for secondaryCrossDevelPackage in  ; do
if [ "x$secondaryCrossDevelPackage" = "x${secondaryCrossDevelPackage#/}" ]; then
secondaryCrossDevelPackage="`pwd`/$secondaryCrossDevelPackage"
fi
if [ -n "$secondaryCrossDevelPackages" ]; then
secondaryCrossDevelPackages="$secondaryCrossDevelPackages,$secondaryCrossDevelPackage"
else
secondaryCrossDevelPackages="--secondary-cross-devel-package=$secondaryCrossDevelPackage"
fi
done
fi


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

cd /media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/linux/lib"
if [ -n "$secondaryCrossDevelPackages" ]; then
/media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/../../haikuporter/haikuporter  \
--all-dependencies  \
--cross-devel-package "$haikuCrossDevelPackage" \
"$secondaryCrossDevelPackages" $portSpec
else
/media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/../../haikuporter/haikuporter  \
--all-dependencies  \
--cross-devel-package "$haikuCrossDevelPackage" $portSpec
fi

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

...failed BootstrapRepositoryFetchPackage1 /media/teamySSD/maite/haikuBuildenv/haiku/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/packages/libsolv_bootstrap_source-0.3.0_haiku_2014_12_22-1-source.hpkg ...

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

Honestly, it still kind of feels weird running haikuporter under linux and seeing it actually working.

kind regards,
zeldakatze

Something overlooked?

Compare with: haiku-master-ppc #2100 - Concourse (haiku-os.org)

Ref: Compiling Haiku for PowerPC | Haiku Project (haiku-os.org)

I’ve tried compiling Haikuports.cross for x86_64 since I’d guess it’s the most updated and it also fails with the same error. Just to be sure that my build environment is sane, could someone else try to compile haikuports.cross? You have to replace some md5 sums and some links have changed, I’ll create a PR with that. I’m also confused about what the cross-devel package is, as the devel packages themselfes are being created.

Kind regards,
zeldakatze

Edit:
the changes I did on haikuports.cross are on GitHub - TheZeldakatze/haikuports.cross: For cross-compiling packages that Haiku requires for a build. on the powerpcFix branch

1 Like

Hi zeldakatze.

I‘ve not investigated this myself yet, but would be interested if you get it working.

I‘ve now gotten my porting target for powerpc (a wii U) and after experimenting with linux on it want to try porting Haiku.

2 Likes

The last powerpc build is from 2021. Maybe someone from Devs can unpause the master-ppc pipeline to see if Concourse can still build it?

The “Devs” don’t have this privilege actually.

It’s reserved for 10x Devs (sorry, couldn’t resist).

It’s stopped because it’s broken, not the other way around. There is no point in running builds that we know will fail.

I am confused by a few things in your PR:

  • You have made changes to several versions of ICU. You only need one (better to start fresh with the latest one, I guess).
  • You added some $secondaryArchSuffix changes, this is not needed unless you build for x86 32bit and enable both versions of the compiler (gcc2 and gcc13). Maybe let’s ignore that for now and try to get the other architectures working
  • Whenever you change packages in haikuports.cross, you also need to update them in the corresponding package repositories file definitions on Haiku side (build/jam/repositories/…). If there is a mismatch, some packages will not be found.

I think I have only tried ARM and ARM64 and SPARC somewhat recently. I will see if I can set up a PPC build and see what I find.

1 Like

About it failing: I tried debugging the build process a bit, it looks like the source packages are also passed to BootstrapRepositoryFetchPackage1 but there are no devel packages that can be found. I’ll also try to learn how jam actually works

I had some cache problems with jam and switched back to an old ICU version. I’ll try to get newer libraries working in cross-devel (libsolv_bootstrap for example is still from 2014).

Is dash usable as a Jam shell? I just used the default debian shell, setting it to bash makes it error out, however that could be because of generated files, I didn’t check yet.

I’ll reorganize the changes again and create multiple separate PRs and do some cleanup in the process aswell.

I’ll check that again, could be that I missed some.

I’m writing some exams in the next 2 weeks and will probably no do as much work on haiku until then, I should really begin learning some stuff.

kind regards,
zeldakatze

I had problem using mksh as my shell (not even as the jam shell, just starting the bootstrap process from a mksh session). I recommend using bash as much as possible (unless you want to investigate the releated problems).

In the past (but I think this has since been solved) there were also issues with different Linux distributions (Debian vs OpenSUSE) when building Python. Definitely there is room for a lot of improvements.

My first attempt (without applying any of your patches yet) failed here while building gcc using the haikuports recipe I think:

/bin/bash ../libtool  --tag=CC   --mode=compile powerpc-apple-haiku-gcc -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LITTLE_ENDIAN=1 -DHAVE_CLOCK_GETTIME=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_STRUCT_LCONV_DECIMAL_POINT=1 -DHAVE_STRUCT_LCONV_THOUSANDS_SEP=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_UINTPTR_T=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_SIGNAL=1 -DHAVE_SIGACTION=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_HAVE_NORETURN=1 -DMPFR_HAVE_BUILTIN_UNREACHABLE=1 -DMPFR_HAVE_CONSTRUCTOR_ATTR=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_DOUBLE_IEEE_BIG_ENDIAN=1 -DHAVE_LDOUBLE_IS_DOUBLE=1 -DMPFR_USE_STATIC_ASSERT=1 -DHAVE_ATTRIBUTE_MODE=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -DMPFR_LONG_WITHIN_LIMB=1 -DHAVE_GETRUSAGE=1 -I. -I/mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/buildtools-f7a513f6367dbb570ba0a71a4bbbfcbc217b0201/mpfr/src   -I/mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/gcc_bootstrap-13.2.0_2023_08_10-obj/gmp -DNO_ASM -O2 -U_FORTIFY_SOURCE     -MT powerof2.lo -MD -MP -MF $depbase.Tpo -c -o powerof2.lo /mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/buildtools-f7a513f6367dbb570ba0a71a4bbbfcbc217b0201/mpfr/src/powerof2.c &&\
mv -f $depbase.Tpo $depbase.Plo
/mnt/storage/opensource/generated.ppc/cross-tools-ppc/lib/gcc/powerpc-apple-haiku/13.3.0/../../../../powerpc-apple-haiku/bin/ld: /mnt/storage/opensource/generated.ppc/cross-tools-ppc/lib/gcc/powerpc-apple-haiku/13.3.0/../../../../powerpc-apple-haiku/lib/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)':
/mnt/storage/opensource/buildtools/gcc/libstdc++-v3/src/c++11/random.cc:179:(.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x34): undefined reference to `getentropy'
/mnt/storage/opensource/generated.ppc/cross-tools-ppc/lib/gcc/powerpc-apple-haiku/13.3.0/../../../../powerpc-apple-haiku/bin/ld: /mnt/storage/opensource/generated.ppc/cross-tools-ppc/lib/gcc/powerpc-apple-haiku/13.3.0/../../../../powerpc-apple-haiku/lib/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/mnt/storage/opensource/buildtools/gcc/libstdc++-v3/src/c++11/random.cc:452:(.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8): undefined reference to `getentropy'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:1696: isl_test_cpp] Error 1
make[4]: Leaving directory '/mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/gcc_bootstrap-13.2.0_2023_08_10-obj/isl'
make[3]: *** [Makefile:1997: all-recursive] Error 1
make[3]: Leaving directory '/mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/gcc_bootstrap-13.2.0_2023_08_10-obj/isl'
make[2]: *** [Makefile:1506: all] Error 2
make[2]: Leaving directory '/mnt/storage/opensource/generated.ppc/objects/haiku/ppc/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-13.2.0_2023_08_10/sources/gcc_bootstrap-13.2.0_2023_08_10-obj/isl'
make[1]: *** [Makefile:6569: all-isl] Error 2
make[1]: *** Waiting for unfinished jobs....

Not sure what to think of that, as far as I know, both Haiku and my Debian host both have getentropy available?

There is a container prepared for the bootstrap process: bootstrap « docker « 3rdparty - haiku - Haiku's main repository
It might also be broken though.

1 Like

It may be missing from the libroot stubs file which is used to build the dummy libroot for the bootstrap process. We may need to update this.

2 Likes

Hello,

So, just for the record, I’m using a generated directory outside of Haiku source directory so my configure line looks like this:

../haiku/configure -j12 --use-gcc-pipe  --cross-tools-source ../buildtools --build-cross-tools ppc --bootstrap ../haikuporter/haikuporter ../haikuports.cross ../haikuports/

Unsure if that makes any difference, I hope not.

I fixed the issue with getentropy undefined reference, it was indeed a missing stub in libroot_stubs: https://cgit.haiku-os.org/haiku/commit/?id=87d1e18fc0dbd57bb1e92019ab69731bf2b64f07

I then had to use your change to port fixes to gcc: gcc-13.2.0: import patches for PowerPC · haikuports/haikuports.cross@5224108 · GitHub (with one small change, I moved the recipe change from the next commit to this one)

Not generally needed, but I was testing this on my paid job machine and my employer blocks ftp, so I changed an URL to use https: libtool: use https URL · haikuports/haikuports.cross@a7b5e55 · GitHub

Next step was apparently we are trying to bootstrap using Python 2.7, which isn’t available anymore on the host, so we may need to update that to some version of Python 3 instead. I didn’t hit the other problems you have mentioned at the moment. I may continue playing with this this weekend.

2 Likes

Ok, making some progress here!

Switched to Python 3: Switch to Python 3 for PowerPC bootstrap · haikuports/haikuports.cross@1a8fe8b · GitHub

That needs libffi, so updated libffi to a new version that knows about Haiku for PowerPC: libffi: add a new version that knows about Haiku on powerpc · haikuports/haikuports.cross@4c720e0 · GitHub

I think the next steps are things you had already solved, but I made it in smaller step-by-step commits:

Expat which has renamed a download file: Expat: update download URL · haikuports/haikuports.cross@90d38d5 · GitHub

gawk which was not enabled: gawk: enable for PowerPC · haikuports/haikuports.cross@c638b4e · GitHub

ICU, which was out of sync between the repository file in Haiku and what platforms were enabled in the recipes in haikuports.cross: Use ICU 67 instead of 57 for PowerPC · haikuports/haikuports.cross@7e2d76e · GitHub

And libsolv which was not the latest version: Use the current version of libsolv for ppc. · haikuports/haikuports.cross@525e5a4 · GitHub

After all these changes, I got to a point where I finally hit the same error message you have listed. A bit of investigation shows that the main problem is source packages not being created. This is my fault, it turns out. I modified Haikuporter a while ago to not create source packages by default anymore (changing the default value of the CREATE_SOURCE_PACKAGES setting). The bootstrap process did not set that setting explicitly so it inherited this change. But it does rely on source packages being created. So, since that change, all bootstrap had been broken.

Here’s the diff to Haiku sources, that I will push in a few minutes or hours once I’ve confirmed that fixes the problem:

diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules
index 3faf726eaf..c39a67a447 100644
--- a/build/jam/RepositoryRules
+++ b/build/jam/RepositoryRules
@@ -394,6 +394,7 @@ MIMESET_COMMAND="$(PWD)/$(2[2])"
 SYSTEM_MIME_DB="$(PWD)/$(2[3])"
 LICENSES_DIRECTORY="$(HAIKU_ABSOLUTE_TOP)/data/system/data/licenses"
 OUTPUT_DIRECTORY="$(HAIKU_REPOSITORY_BUILD_DIRECTORY)"
+CREATE_SOURCE_PACKAGES="yes"
 EOF

        # If we have cross tools, add the cross tools directory.
diff --git a/build/jam/repositories/HaikuPortsCross/ppc b/build/jam/repositories/HaikuPortsCross/ppc
index 6c88fa95d8..7cb44ff95f 100644
--- a/build/jam/repositories/HaikuPortsCross/ppc
+++ b/build/jam/repositories/HaikuPortsCross/ppc
@@ -27,11 +27,12 @@ BootstrapPackageRepository HaikuPortsCross
        grep_bootstrap-2.14-1
        icu_bootstrap-67.1-2
        icu_bootstrap_devel-67.1-2
+       libffi_bootstrap-3.4.6-1
        m4_bootstrap-1.4.16-1
        make_bootstrap-4.3-1
        ncurses6_bootstrap-6.2-1
        ncurses6_bootstrap_devel-6.2-1
-       python_bootstrap-2.7.6-1
+       python_bootstrap-3.9.1-1
        sed_bootstrap-4.2.1-1
        texinfo_bootstrap-4.13a-1
        zlib_bootstrap-1.2.13-1
@@ -55,6 +56,8 @@ BootstrapPackageRepository HaikuPortsCross
        icu_bootstrap
        gcc_bootstrap
        grep_bootstrap
+       libffi_bootstrap
+       libsolv_bootstrap
        m4_bootstrap
        make_bootstrap
        ncurses6_bootstrap
@@ -62,7 +65,7 @@ BootstrapPackageRepository HaikuPortsCross
        sed_bootstrap
        texinfo_bootstrap
        zlib_bootstrap
-       libsolv_bootstrap
+       zstd_bootstrap
        :
        # debuginfo packages
        ;
9 Likes

Hello,

The next problem was undefined references to functions that should be in libgcc while linking the bootloader. I checked libgcc and indeed the functions are not there.

This turns out to be a typo in the previous round of PowerPC fixes, which I fixed here: buildtools - Haiku's buildtools repository

The haikuports.cross build uses a fixed version of the buildtools, for now I adjusted the patch there (I guess, when this is all working, we can make a new release source archive of the buildtools to avoid having to duplicate these patches).

This means I’m now rebuilding gcc… again (and questioning wether it was a good idea to do this the one weekend when temperatures reach 40º outside). LEt’s see how far we get this time!

4 Likes

And now we’re getting into the interesting part, I think.

I had to remove some “?ppc” from a few recipes in haikuports (why did people mark things as specifically untested on PowerPC? I don’t know). For example in curl, bison, icu, …

Then starts the problem of untangling dependencies that have gotten more and more complex on haikuports side.

Haiku needs freetype (seems pretty reasonable).
Freetype is now built with meson (ok, why not)
meson needs Python (sure, makes sense)
Python needs liblzma (so far so good, we can add that to the bootstrap)
liblzma is part of xz_utils which needs doxygen (ok, to build documentation, makes sense)
doxygen needs Qt5 (because it has a GUI)
Qt5 needs gstreamer and its plugins

Well, now building Haiku depends on Qt5. This is going to be fun.

My main problem now is that gstreamer and its plugin currently depend on cmd:python, which is not provided by anything anymore (python2 is retired). So I will try removing that requirement (keeping only cmd:python3) and see what happens. If someone from haikuports team has a comment about that dependency, your help is welcome.

Now I will let the bootstrap process try to download Qt5 and all its dependencies, which I think is not ideal. We’ll see how far that goes…

4 Likes

This doesn’t make sense to me. Why would one need doxygen if all they want is to provide liblzma dependency, and not to read its documentation? Building doxygen documentation should be optional, and quick check of the xz/PACKAGERS at master · tukaani-project/xz · GitHub shows it indeed is:

Does Haiku specify the --enable-doxygen option somehow? If not, and it’s still required it looks like a bug on the xz-utils side. But I’d rather assume there’s some wrong configuration on our (or Python) side.