As I wrote the previous post, the PowerBook was attempting to compile
lang/gcc48 from pkgsrc & since then I’ve still been attempting to build
lang/gcc48 with varying levels of success which led me to branch out from trying to build GCC 4.8 to the other 4.x releases on pkgsrc.
In-between roasting the PowerBook I managed to obtain a re-writable CD, that allowed me to install OpenBSD on the PowerBook. Everything went smoothly apart from some bug with installer/documentation. The OpenBSD install was short-lived as I swapped the 5400RPM HDD for an 64GB SSD, the empty partition is there ready for reinstall but the GCC builds have consumed most of the time with the computer so I’ve not got around to reinstalling on the new disk.
Capacity: 59.63 GB
Removable Media: No
Detachable Drive: No
BSD Name: disk0
Unit Number: 1
Socket Type: Internal
OS9 Drivers: No
S.M.A.R.T. status: Verified
Capacity: 41.5 GB
Available: 26.21 GB
File System: Journaled HFS+
BSD Name: disk0s3
Mount Point: /
The laptop is now running with 1.25GB of RAM which has made a big difference, more than the SSD did, though the change is mainly visible in the apple supplied application binaries e.g System Preferences or Activity Monitor which don’t bounce on the dock whilst loading, click & it’s there, running.
Trying to install a newer version of GCC from pkgsrc has been quite painful, build attempts are taking up to 20+ hours before failing, depending on which languages / options are enabled.
I reverted to attempting to building with only C & C++ language support to speed up the time to success/fail. This reduced the build time down to 8-10 hours, it then became apparent (a little quicker) that all GCC 4.x releases in pkgsrc fail to build on Mac OS X Tiger.
GCC 4.4 was the easiest to fix as the only thing that prevented the build of the C/C++ language support was a space between the
-I flag & the path to headers to include which caused the linker to complain, this issues is taken care of in
gcc48 but the fix wasn’t retroactively applied to previous releases.
Attempting to build with GCC 4.5 & newer revealed further issues.
Thanks to the maintainer of TigerBrew, Misty De Meo who was able to provide hints for issues that need to be addressed in-order to build a more recent version of GCC on Tiger, having gone through the same problems when adding support in TigerBrew.
“../../../libitm/config/powerpc/sjlj.S:155:Invalid mnemonic ‘FUNC'” whyyyyyyyy
— funroll misty (@mistydemeo) October 14, 2013
I’m not sure how many iterations other builds use but on pkgsrc gcc is built with 3 iterations of tests where binaries generated are compared at each iteration. The tests would fail on the third iteration, forcing dwarf2 format for debug data allowed the tests to succeed. As the G4 is a 32-bit PowerPC CPU, the build then failed when it came to 64-bit binaries, disabling multilib support resolved this issue, the build then failed as the linker & assembler bundled with XCode 2.5 were too old & missing functionality. Bug 52482 covers this issue.
gmake: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CC_FOR_TARGET=/usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/" "CFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "CXXFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "CFLAGS_FOR_BUILD=-pipe -O2 -I/usr/pkg/include -I/usr/include" "CFLAGS_FOR_TARGET=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "INSTALL=/usr/bin/install -c -o root -g wheel" "INSTALL_DATA=/usr/bin/install -c -o root -g wheel -m 644" "INSTALL_PROGRAM=/usr/bin/install -c -s -o root -g wheel -m 755" "INSTALL_SCRIPT=/usr/bin/install -c -o root -g wheel -m 755" "LDFLAGS=-L/usr/pkg/lib" "LIBCFLAGS=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "LIBCFLAGS_FOR_TARGET=-g -pipe -O2 -I/usr/pkg/include -I/usr/include" "MAKE=/usr/pkg/bin/gmake" "MAKEINFO=/usr/pkgsrc/lang/gcc48/work/.tools/bin/makeinfo --split-size=5000000 --split-size=5000000 " "SHELL=/bin/sh" "RUNTESTFLAGS=" "exec_prefix=/usr/pkg/gcc48" "infodir=/usr/pkg/gcc48/info" "libdir=/usr/pkg/gcc48/lib" "includedir=/usr/pkg/gcc48/include" "prefix=/usr/pkg/gcc48" "tooldir=/usr/pkg/gcc48/powerpc-apple-darwin8" "gxx_include_dir=/usr/pkg/gcc48/include/c++/" "AR=ar" "AS=/usr/pkgsrc/lang/gcc48/work/build/./gcc/as" "LD=/usr/pkgsrc/lang/gcc48/work/build/./gcc/collect-ld" "RANLIB=ranlib" "NM=/usr/pkgsrc/lang/gcc48/work/build/./gcc/nm" "NM_FOR_BUILD=" "NM_FOR_TARGET=nm" "DESTDIR=" "WERROR=" DO=all multi-do # /usr/pkg/bin/gmake gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libstdc++-v3' Checking multilib configuration for libitm... gmake: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' /usr/pkg/bin/gmake all-recursive gmake: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Making all in testsuite gmake: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm/testsuite' gmake: Nothing to be done for 'all'. gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm/testsuite' gmake: Entering directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' /bin/sh ./libtool --mode=compile /usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/bin/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/lib/ -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/include -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.8.2/libitm -I../../../gcc-4.8.2/libitm/config/powerpc -I../../../gcc-4.8.2/libitm/config/posix -I../../../gcc-4.8.2/libitm/config/generic -I../../../gcc-4.8.2/libitm -Wall -Werror -Wc,-pthread -g -pipe -O2 -I/usr/pkg/include -I/usr/include -MT sjlj.lo -MD -MP -MF .deps/sjlj.Tpo -c -o sjlj.lo ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S libtool: compile: /usr/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc48/work/build/./gcc/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/bin/ -B/usr/pkg/gcc48/powerpc-apple-darwin8/lib/ -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/include -isystem /usr/pkg/gcc48/powerpc-apple-darwin8/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.8.2/libitm -I../../../gcc-4.8.2/libitm/config/powerpc -I../../../gcc-4.8.2/libitm/config/posix -I../../../gcc-4.8.2/libitm/config/generic -I../../../gcc-4.8.2/libitm -Wall -pthread -Werror -g -pipe -O2 -I/usr/pkg/include -I/usr/include -MT sjlj.lo -MD -MP -MF .deps/sjlj.Tpo -c ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S -fno-common -DPIC -o .libs/sjlj.o ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:155:Invalid mnemonic 'FUNC' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:250:Invalid mnemonic 'CALL' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:259:Invalid mnemonic 'END' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:262:Invalid mnemonic 'HIDDEN' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:263:Invalid mnemonic 'FUNC' ../../../gcc-4.8.2/libitm/config/powerpc/sjlj.S:407:Invalid mnemonic 'END' Makefile:496: recipe for target 'sjlj.lo' failed gmake: *** [sjlj.lo] Error 1 gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:697: recipe for target 'all-recursive' failed gmake: *** [all-recursive] Error 1 gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:360: recipe for target 'all' failed gmake: *** [all] Error 2 gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build/powerpc-apple-darwin8/libitm' Makefile:16624: recipe for target 'all-target-libitm' failed gmake: *** [all-target-libitm] Error 2 gmake: Leaving directory '/usr/pkgsrc/lang/gcc48/work/build' Makefile:889: recipe for target 'all' failed gmake: *** [all] Error 2 *** Error code 2 Stop. bmake: stopped in /usr/pkgsrc/lang/gcc48 *** Error code 1
Apple provides updates as part of their open source initiative, cctools contain the as & ld sources but sadly with the move to intel & the startup of the Hackintosh scene Apple has made it a little difficult to build things, their first move was to stop generating the iso of Darwin builds & the documentation seems non-existent now. Funnily enough the legacy information on the iPhone jailbreak & Hackintosh scene seems to be the commonly available documentation, that is ofcourse after you’ve excluded bug reports from fink & mac/darwinports in your search results. The main problem with building the open-source components is the bespoke build mechanism which seems to have various issues with Mac OS X, mainly missing header files, with TigerBrew, they seem to work around this issue by using the headers from a newer version of OS X. Through my search for a solution I discovered the OpenDarwin project, the project repackaged the source for the open source Apple components around the GNU toolchain. A version is available in pkgsrc in
emulators/darwin_lib though it’s intended for NetBSD/PowerPC to provide binary compatibility, sadly the version it attempts to build is older than the version available with XCode 2.5. The OpenDarwin site is broken & the project doesn’t appear to be in development but I was able to find a repository on Apples MacOS Forge for the OpenDarwin cctools which contained the cctools-758. This was sufficient to allow GCC 4.x to build successfully,
AS_TARGET variables need to be set to where the new version of
as(1) installed from odcctools however. GCC 4.7 built successfully with C, C++, Fortran, Objective C, Objective C++ & Fortran support. The code is in a SVN repository, you can obtain precompiled binaries of old versions of svn from collab.net.
Using built-in specs. COLLECT_GCC=/usr/pkg/gcc47/bin/gcc COLLECT_LTO_WRAPPER=/usr/pkg/gcc47/libexec/gcc/powerpc-apple-darwin8/4.7.3/lto-wrapper Target: powerpc-apple-darwin8 Configured with: ../gcc-4.7.3/configure --enable-languages='c obj-c++ objc java fortran c++' --enable-shared --enable-long-long --with-local-prefix=/usr/pkg/gcc47 --enable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc++ -static-libgcc -L/usr/pkg/lib ' --with-dwarf2 --disable-multilib --disable-nls --with-gmp=/usr/pkg --with-mpc=/usr/pkg --with-mpfr=/usr/pkg --with-ecj-jar=/usr/pkgsrc/distfiles/ecj-4.5.jar --enable-java-home --with-os-directory=darwin --with-arch-directory=powerpc --with-jvm-root-dir=/usr/pkg/java/gcc47 --with-java-home=/usr/pkg/java/gcc47 --with-system-zlib --enable-__cxa_atexit --with-gxx-include-dir=/usr/pkg/gcc47/include/c++/ --with-libintl-prefix=/usr/pkg --prefix=/usr/pkg/gcc47 --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --infodir=/usr/pkg/gcc47/info --mandir=/usr/pkg/gcc47/man Thread model: posix gcc version 4.7.3 (GCC)
While attempting to get things to build,
lang/gcc48 was updated in pkgsrc and languages were separated out to individual packages with gcc48 becoming a wrapper around this, these changes are very much in their infancy and have issues which need to be addressed. As it currently stands, it’s not possible to build individual languages as there is ties which need to be removed e.g attempting to build
lang/gcc48-cc++ will build in
lang/gcc48-fortran. For me, the next step is to get these changes prepared correctly & submitted for inclusion in pkgsrc, for the duration of getting things to run I hard coded the paths for
as(1) & defined the configure arguments globally, where as these changes are specific to Tiger & prior / 32-bit PowerPC specific. Then there’s dealing with odcctools, I’m not sure if it will require a new package or
emulators/darwin_lib should be extended.
emulators/darwin_lib introduces more than just odcctools hence my leaning towards a separate package. I also want to try out building from a RAM disk using Make RAM disk to see if build can be sped up any further. Since I wrote the previous article I found out how to set the location in F.lux, thanks to co-developer of F.lux, Michael Herf
— Michael Herf (@herf) May 4, 2014
It seems that some people opt to cross-compile for OS X on another platform, including macports developers (sorry, I didn’t make a note of the bug report where the developer explained building packages on Linux). iTerm 0.10 from the original project is now my terminal emulator with the Inconsolata font, the font smoothing isn’t that great on this machine when using white text on black background so I’ve opted for the opposite here & it’s working out well.
There is a MAC POWERPC ? blog which provides regular articles. I found an article on how to rebuild the PowerBook battery with new cells if it should fail.
Following the instructions from floodgap.com to update the curl-ca-bundle bundled with OS X I discovered that the version included in Tiger was from 2000!!
/usr/share/curl/curl-ca-bundle.crt - Last Modified: Thu Mar 2 09:32:46 CET 2000, These were automatically extracted from Netscape Communicator 4.72's certificate database (the file `cert7.db')