Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

B S Magnet

macrumors 601
Original poster
For a lot of us, many POSIX-related utilities, tools, and libraries are handled routinely by Macports, so I haven’t seen this kind of question come up on the PPC forum. This question involves building from source code without using a ports handler like macports or homebrew. How come? Because this is the unique situation of running an early build of Darwin10/Snow Leopard on a PowerPC Mac.

The challenge:

I’m trying to compile GCC 4.6.4 (or any GCC revision from 4.6 onward) from source in order to finally get irssi compiled (also from source) and running under 10.6 (Build 10A96) for PowerPC.

To do so, of course, requires building up (in what feels like ascending a helix, slowly) all kinds of utilities, tools, and libraries. (Eventually, I’ll share the long list of manual builds on the Snow Leopard for PowerPC thread.) For the most part, I think I’ve more or less done most of that. By default, the Xcode 3.2 shipped with Build 10A96 comes bundled with an Apple-optimized gcc 4.2.1. For compiling/building many of the aforementioned components, this has been sufficient.

What’s hanging me up is irssi requires at least gcc 4.6, as it invokes the following (“pragma”, which doesn’t become required until gcc 4.6) before the build errors out:

[11/278] Compiling C object src/core/libcore.a.p/channels.c.o In file included from ../src/core/channels.c:23: ./irssi/src/core/misc.h:13: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’ ./irssi/src/core/misc.h:20: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’


So, in trying to build GCC 4.6, the compile process makes it some percentage of the way through before halting on the following error:

ld warning: in /usr/lib/dylib1.o, missing required architecture ppc64 in file ld warning: in libgcc.a, file is not of required architecture ld warning: in /usr/lib/libc.dylib, missing required architecture ppc64 in file

Everything which follows is the abort itself.

# @multilib_flags@ is still needed because this may use # /opt/gcc-4.6/host-powerpc-apple-darwin10.0.0d1/gcc/xgcc -B/opt/gcc-4.6/host-powerpc-apple-darwin10.0.0d1/gcc/ -B/usr/local/powerpc-apple-darwin10.0.0d1/bin/ -B/usr/local/powerpc-apple-darwin10.0.0d1/lib/ -isystem /usr/local/powerpc-apple-darwin10.0.0d1/include -isystem /usr/local/powerpc-apple-darwin10.0.0d1/sys-include and -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -Wa,-force_cpusubtype_ALL -pipe -mmacosx-version-min=10.4 -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector directly. # @multilib_dir@ is not really necessary, but sometimes it has # more uses than just a directory name. /bin/sh ../../.././libgcc/../mkinstalldirs ppc64 /opt/gcc-4.6/host-powerpc-apple-darwin10.0.0d1/gcc/xgcc -B/opt/gcc-4.6/host-powerpc-apple-darwin10.0.0d1/gcc/ -B/usr/local/powerpc-apple-darwin10.0.0d1/bin/ -B/usr/local/powerpc-apple-darwin10.0.0d1/lib/ -isystem /usr/local/powerpc-apple-darwin10.0.0d1/include -isystem /usr/local/powerpc-apple-darwin10.0.0d1/sys-include -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -Wa,-force_cpusubtype_ALL -pipe -mmacosx-version-min=10.4 -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector -dynamiclib -nodefaultlibs -install_name /usr/local/lib/libgcc_s.1.dylib -single_module -o ppc64/libgcc_s.dylib -Wl,-exported_symbols_list,libgcc.map -compatibility_version 1 -current_version 1.0 -g -O2 -m64 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o darwin-tramp_s.o ppc64-fp_s.o darwin-64_s.o darwin-ldouble_s.o darwin-world_s.o unwind-dw2_s.o unwind-dw2-fde-darwin_s.o unwind-sjlj_s.o unwind-c_s.o darwin-fallback_s.o emutls_s.o libgcc.a -lc ld warning: in /usr/lib/dylib1.o, missing required architecture ppc64 in file ld warning: in libgcc.a, file is not of required architecture ld warning: in /usr/lib/libc.dylib, missing required architecture ppc64 in file Undefined symbols: "_mprotect", referenced from: ___enable_execute_stack in _enable_execute_stack_s.o ___enable_execute_stack in _enable_execute_stack_s.o "_pthread_mutex_unlock", referenced from: ___emutls_get_address in emutls_s.o "__keymgr_get_and_lock_processwide_ptr", referenced from: _live_image_destructor in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_getpagesize", referenced from: ___enable_execute_stack in _enable_execute_stack_s.o "_pthread_once", referenced from: _uw_init_context_1 in unwind-dw2_s.o ___emutls_get_address in emutls_s.o "__keymgr_unlock_processwide_ptr", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_pthread_key_create", referenced from: _emutls_init in emutls_s.o "_realloc", referenced from: ___emutls_get_address in emutls_s.o "_malloc", referenced from: _search_object in unwind-dw2-fde-darwin_s.o _search_object in unwind-dw2-fde-darwin_s.o ___register_frame in unwind-dw2-fde-darwin_s.o ___register_frame_table in unwind-dw2-fde-darwin_s.o ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "__cpu_has_altivec", referenced from: __cpu_has_altivec$non_lazy_ptr in darwin-world_s.o "_getsectdatafromheader_64", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_calloc", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o ___emutls_get_address in emutls_s.o "_pthread_getspecific", referenced from: ___emutls_get_address in emutls_s.o "_free", referenced from: _search_object in unwind-dw2-fde-darwin_s.o ___deregister_frame_info_bases in unwind-dw2-fde-darwin_s.o _live_image_destructor in unwind-dw2-fde-darwin_s.o _live_image_destructor in unwind-dw2-fde-darwin_s.o ___deregister_frame in unwind-dw2-fde-darwin_s.o _emutls_destroy in emutls_s.o _emutls_destroy in emutls_s.o "_pthread_mutex_lock", referenced from: ___emutls_get_address in emutls_s.o "_pthread_setspecific", referenced from: ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_abort", referenced from: ___absvdi2 in _absvsi2_s.o ___absvsi2 in _absvsi2_s.o ___absvti2 in _absvdi2_s.o ___addvdi3 in _addvsi3_s.o ___addvsi3 in _addvsi3_s.o ___addvti3 in _addvdi3_s.o ___subvdi3 in _subvsi3_s.o ___subvsi3 in _subvsi3_s.o ___subvti3 in _subvdi3_s.o ___mulvdi3 in _mulvsi3_s.o ___mulvsi3 in _mulvsi3_s.o ___mulvti3 in _mulvdi3_s.o ___negvdi2 in _negvsi2_s.o ___negvsi2 in _negvsi2_s.o ___negvti2 in _negvdi2_s.o ___trampoline_setup in darwin-tramp_s.o _read_encoded_value_with_base in unwind-dw2_s.o _execute_stack_op in unwind-dw2_s.o _execute_stack_op in unwind-dw2_s.o _execute_cfa_program in unwind-dw2_s.o _execute_cfa_program in unwind-dw2_s.o _uw_frame_state_for in unwind-dw2_s.o _uw_frame_state_for in unwind-dw2_s.o _uw_install_context_1 in unwind-dw2_s.o _uw_update_context_1 in unwind-dw2_s.o _uw_update_context in unwind-dw2_s.o __Unwind_RaiseException_Phase2 in unwind-dw2_s.o _uw_init_context_1 in unwind-dw2_s.o __Unwind_GetGR in unwind-dw2_s.o __Unwind_SetGR in unwind-dw2_s.o __Unwind_Resume in unwind-dw2_s.o __Unwind_Resume_or_Rethrow in unwind-dw2_s.o _size_of_encoded_value in unwind-dw2-fde-darwin_s.o _read_encoded_value_with_base in unwind-dw2-fde-darwin_s.o _base_from_object.isra.3 in unwind-dw2-fde-darwin_s.o _base_from_object.isra.3 in unwind-dw2-fde-darwin_s.o _search_object in unwind-dw2-fde-darwin_s.o ___deregister_frame_info_bases in unwind-dw2-fde-darwin_s.o _read_encoded_value_with_base in unwind-c_s.o ___gcc_personality_v0 in unwind-c_s.o ___gcc_personality_v0 in unwind-c_s.o ___gcc_personality_v0 in unwind-c_s.o _emutls_init in emutls_s.o ___emutls_get_address in emutls_s.o "_memset", referenced from: _uw_frame_state_for in unwind-dw2_s.o _uw_init_context_1 in unwind-dw2_s.o ___frame_state_for in unwind-dw2_s.o ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_strlen", referenced from: _uw_frame_state_for in unwind-dw2_s.o _get_cie_encoding in unwind-dw2-fde-darwin_s.o "__keymgr_set_and_unlock_processwide_ptr", referenced from: _live_image_destructor in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_memcpy", referenced from: _execute_cfa_program in unwind-dw2_s.o _execute_cfa_program in unwind-dw2_s.o _uw_install_context_1 in unwind-dw2_s.o _uw_update_context_1 in unwind-dw2_s.o __Unwind_RaiseException in unwind-dw2_s.o __Unwind_RaiseException in unwind-dw2_s.o __Unwind_ForcedUnwind in unwind-dw2_s.o __Unwind_Resume in unwind-dw2_s.o __Unwind_Resume_or_Rethrow in unwind-dw2_s.o ___emutls_get_address in emutls_s.o ld: symbol(s) not found collect2: ld returned 1 exit status make[5]: *** [libgcc_s.dylib] Error 1 make[4]: *** [multi-do] Error 1 make[3]: *** [all-multi] Error 2 make[2]: *** [all-stage1-target-libgcc] Error 2 make[1]: *** [stage1-bubble] Error 2 make: *** [all] Error 2 sh-4.3#

Several years ago, there appeared to be a lead on how to rectify this issue, but that lead is now a dead end. Another lead, in Japanese, suggested preceding the configure/build steps by first running an “export ARCHFLAGS” — though in my case I tried both the suggestion, verbatim, as well as just running it with the last part (i.e., “-arch ppc” only):

export ARCHFLAGS='-arch i386 -arch x86_64 -arch ppc'

Has anyone here ever run across anything like this, and if so, have you managed to find any kind of workaround?

UPDATE: I should also add I’ve tried the following build flags suggested by the GNU configure page, and the outcome remains identical:

sh-4.3# ./configure --with-arch-32=powerpc --without-arch-64 --without-cpu-64

UPDATE THE SECOND: In what amounts to throwing stuff at a wall and seeing what sticks to it, I’ve been trying various configure flags which may or may not have an impact on the make process. I honestly don’t know what I’m doing, other than feeling like a naif. At present, this set of configure flags is yielding a different make error:

./configure --disable-multilib --with-cpu_32=powerpc --without-cpu_64 --enable-languages=c++,fortran,java,objc --program-transform-name=s,y,y, --disable-option-checking --with-target-subdir=powerpc-apple-darwin10 --build=powerpc-apple-darwin10 --host=powerpc-apple-darwin10 --target=powerpc-apple-darwin10 --disable-intermodule --disable-checking --disable-coverage

(As part of experimentation, I stripped away the “10.0.0d1” to make it simply “10”. For the most part, this seems to try building in a directory named “powerpc-apple-darwin10”.)

The current flavour of errors have all included an “error 77”, which departs from earlier:

checking for powerpc-apple-darwin10-gcc... /opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/xgcc -B/opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/ -B/usr/local/powerpc-apple-darwin10/bin/ -B/usr/local/powerpc-apple-darwin10/lib/ -isystem /usr/local/powerpc-apple-darwin10/include -isystem /usr/local/powerpc-apple-darwin10/sys-include checking for C compiler default output file name... configure: error: in `/opt/gcc-4.6.4/powerpc-apple-darwin10/libgomp': configure: error: C compiler cannot create executables See `config.log' for more details. make[2]: *** [configure-stage1-target-libgomp] Error 77 make[1]: *** [stage1-bubble] Error 2 make: *** [all] Error 2

I’ll keep at it after some rest and when I have some time to return to it, but I’m not sure what to try next.
 
Last edited:

RagingAvatar

macrumors newbie
Aug 11, 2021
2
1
Fascinating! I’ve been attempting to do the same thing and failing at the first hurdle!
I’d love to see your notes if you have them?

I assume you’re attempting to compile on the PPC and not cross compile?
 

alex_free

macrumors 65816
Feb 24, 2020
1,060
2,245
Hmm try passing CXX_FLAGS=“-arch ppc” CFLAGS=“-arch ppc” to configure, or -arch ppc64 if your trying to target that. Make sure you start the build with new source and or build directory to prevent any old cached code errors.
 

B S Magnet

macrumors 601
Original poster
Hmm try passing CXX_FLAGS=“-arch ppc” CFLAGS=“-arch ppc” to configure, or -arch ppc64 if your trying to target that. Make sure you start the build with new source and or build directory to prevent any old cached code errors.

I did see some progress (in that it built for longer before erroring out).

The obstacle now appears to emerge the moment the make process begin to build libgcc:

echo timestamp > gpl.pod perl ../.././gcc/../contrib/texi2pod.pl ../.././gcc/doc/include/gpl_v3.texi > gpl.pod Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^\@strong{ <-- HERE (.*)}$/ at ../.././gcc/../contrib/texi2pod.pl line 319. echo timestamp > doc/gpl.7 (pod2man --center="GNU" --release="gcc-4.6.4" --date=2013-04-12 --section=7 gpl.pod > doc/gpl.7.T$$ && \ mv -f doc/gpl.7.T$$ doc/gpl.7) || \ (rm -f doc/gpl.7.T$$ && exit 1) rm gcc.pod mkdir powerpc-apple-darwin10/libgcc Checking multilib configuration for libgcc... Configuring stage 1 in powerpc-apple-darwin10/libgcc configure: creating cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... awk checking build system type... powerpc-apple-darwin10 checking host system type... powerpc-apple-darwin10 checking for powerpc-apple-darwin10-ar... ar checking for powerpc-apple-darwin10-lipo... lipo checking for powerpc-apple-darwin10-nm... /opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/nm checking for powerpc-apple-darwin10-ranlib... ranlib checking for powerpc-apple-darwin10-strip... strip checking whether ln -s works... yes checking for powerpc-apple-darwin10-gcc... /opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/xgcc -B/opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/ -B/usr/local/powerpc-apple-darwin10/bin/ -B/usr/local/powerpc-apple-darwin10/lib/ -isystem /usr/local/powerpc-apple-darwin10/include -isystem /usr/local/powerpc-apple-darwin10/sys-include checking for suffix of object files... configure: error: in `/opt/gcc-4.6.4/powerpc-apple-darwin10/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] Error 1 make[1]: *** [stage1-bubble] Error 2 make: *** [all] Error 2

I’m attaching the config.log here as well.
 

Attachments

  • config.log.zip
    7.1 KB · Views: 113
Last edited:
  • Like
Reactions: alex_free

alex_free

macrumors 65816
Feb 24, 2020
1,060
2,245
I did see some progress (in that it built for longer before erroring out.

The obstacle now appears to emerge the moment the make process begin to build libgcc:

echo timestamp > gpl.pod perl ../.././gcc/../contrib/texi2pod.pl ../.././gcc/doc/include/gpl_v3.texi > gpl.pod Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^\@strong{ <-- HERE (.*)}$/ at ../.././gcc/../contrib/texi2pod.pl line 319. echo timestamp > doc/gpl.7 (pod2man --center="GNU" --release="gcc-4.6.4" --date=2013-04-12 --section=7 gpl.pod > doc/gpl.7.T$$ && \ mv -f doc/gpl.7.T$$ doc/gpl.7) || \ (rm -f doc/gpl.7.T$$ && exit 1) rm gcc.pod mkdir powerpc-apple-darwin10/libgcc Checking multilib configuration for libgcc... Configuring stage 1 in powerpc-apple-darwin10/libgcc configure: creating cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... awk checking build system type... powerpc-apple-darwin10 checking host system type... powerpc-apple-darwin10 checking for powerpc-apple-darwin10-ar... ar checking for powerpc-apple-darwin10-lipo... lipo checking for powerpc-apple-darwin10-nm... /opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/nm checking for powerpc-apple-darwin10-ranlib... ranlib checking for powerpc-apple-darwin10-strip... strip checking whether ln -s works... yes checking for powerpc-apple-darwin10-gcc... /opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/xgcc -B/opt/gcc-4.6.4/host-powerpc-apple-darwin10/gcc/ -B/usr/local/powerpc-apple-darwin10/bin/ -B/usr/local/powerpc-apple-darwin10/lib/ -isystem /usr/local/powerpc-apple-darwin10/include -isystem /usr/local/powerpc-apple-darwin10/sys-include checking for suffix of object files... configure: error: in `/opt/gcc-4.6.4/powerpc-apple-darwin10/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] Error 1 make[1]: *** [stage1-bubble] Error 2 make: *** [all] Error 2

I’m attaching the config.log here as well.
Are the MacPorts built MPFR, GMP and MPC installed? Best I can come up with is this related stackoverfl0w post. This would make sense to me, as I've built GCC toolchains (but not from scratch like you are on PPC Mac OS X). If they are installed, you would need to specify them with configure as for some reason configure is not finding the directories which contain their headers and libraries (something like --with-mpfr=/opt/lib/mpfr I think, although the real directory name escapes me at the moment). It may be possible to use the download_prerequisties script in gcc like in the stack overflow post as well, but I'm not sure if those libs need patching as well (would not be surprised). Another thing, you probably have to have open darwin cc tools compiled (get it from apple, or MacPorts).
 
Last edited:

kencu

macrumors member
Jan 23, 2019
92
110
I have a little 25 line shell script that builds most any version of gcc on most any macOS version you want. it's really quite simple to do... I'll post it up for you tomorrow.

But it sounds like you are trying to build a gcc cross compiler. To do that, you don't set any arch flags or similar mac-isms. You set the build, host, and target triples. The compiler is built on the build system, to run on the host system, and to generate code for the target system.

On the given target system, if you want to support flavours, like i386 and x86_64 intel, or 32bit and 64bit PowerPC, you enable the "multilib" option, which defaults on anyway.
 

B S Magnet

macrumors 601
Original poster
Are the MacPorts built MPFR, GMP and MPC installed?

No. I manually compiled those, as most of the ports from Macports for Darwin 10 are available only as i386 (and a handful which can be built via Macports on Darwin 10 on a PowerPC being available as “noarch”). So far, the only ports I’ve been able to install via Macports in this unique environment are neofetch and mpstats.

Best I can come up with is this related stackoverfl0w post. This would make sense to me, as I've built GCC toolchains (but not from scratch like you are on PPC Mac OS X). If they are installed, you would need to specify them with configure as for some reason configure is not finding the directories which contain their headers and libraries (something like --with-mpfr=/opt/lib/mpfr I think, although the real directory name escapes me at the moment). It may be possible to use the download_prerequisties script in gcc like in the stack overflow post as well, but I'm not sure if those libs need patching as well (would not be surprised). Another thing, you probably have to have open darwin cc tools compiled (get it from apple, or MacPorts).

For the latter, I’ll look for open darwin cc tools source code (not sure if AOSP will have what I need, since all the source code for 10.6 are geared for i386 at a minimum.

I’ll also have a closer look at the SO post in the morning when I’m a bit more rested and can focus on this. Thank you, and I’ll continue to make updates here as I work through this maze.
 
  • Like
Reactions: alex_free

alex_free

macrumors 65816
Feb 24, 2020
1,060
2,245
No. I manually compiled those, as most of the ports from Macports for Darwin 10 are available only as i386 (and a handful which can be built via Macports on Darwin 10 on a PowerPC being available as “noarch”). So far, the only ports I’ve been able to install via Macports in this unique environment are neofetch and mpstats.



For the latter, I’ll look for open darwin cc tools source code (not sure if AOSP will have what I need, since all the source code for 10.6 are geared for i386 at a minimum.

I’ll also have a closer look at the SO post in the morning when I’m a bit more rested and can focus on this. Thank you, and I’ll continue to make updates here as I work through this maze.
You can probably use the leopard one if the snow leopard one does not work. I think that's the problem. That's good news that you successfully manually compiled those libs as that rules that out. I wonder, would editing port files to include arch ppc and not just i386 help here? Could do something crazy and just recursively sed replace all portfiles to include ppc.
 
  • Like
Reactions: G4fanboy

B S Magnet

macrumors 601
Original poster
I have a little 25 line shell script that builds most any version of gcc on most any macOS version you want. it's really quite simple to do... I'll post it up for you tomorrow.

Thank you. I’ll look forward to it.

But it sounds like you are trying to build a gcc cross compiler. To do that, you don't set any arch flags or similar mac-isms. You set the build, host, and target triples. The compiler is built on the build system, to run on the host system, and to generate code for the target system.

Initially, when I set out to do this (on the road to being able to successfully build irssi on Build 10A96 of Snow Leopard on this PowerPC), I was running an unmodified ./configure — which is how I first ran headlong into the “required missing architecutre ppc64 in file” errors. That was when I began to append configure flags which I thought might help to steer the make-build away from looking for or expecting anything related to 64-bit PPC stuff (since I’m building for a ppc7450 G4 here).

On the given target system, if you want to support flavours, like i386 and x86_64 i
intel, or 32bit and 64bit PowerPC, you enable the "multilib" option, which defaults on anyway.

For this exercise, I’m solely focussing on building for 32-bit PowerPC in the early Darwin10 environment — which is already an anomaly as Macs go.
 

B S Magnet

macrumors 601
Original poster
You can probably use the leopard one if the snow leopard one does not work. I think that's the problem. That's good news that you successfully manually compiled those libs as that rules that out. I wonder, would editing port files to include arch ppc and not just i386 help here? Could do something crazy and just recursively sed replace all portfiles to include ppc.

As I understand it, macports never set up a system to account for the possibility darwin10 tarballs with ppc ports, since Apple very quickly followed up after the initial Developer Preview of Snow Leopard to announce that Snow Leopard (and darwin10) would not be deployed for PPC/UB environments like Leopard/darwin9 was.

Prior to this round of trying macports (2.7.1, built from source), I had been trying out things with a build of 2.6.4, but finding that darwin9 ports were not compatible with the darwin10 macports environment (as macports install errors were reporting before I wiped it and started over with 2.7.1).
 

kencu

macrumors member
Jan 23, 2019
92
110
when building gcc cross compilers, you're best to let gcc itself build the supporting parts the way it wants to. gcc looks in it's own source folder for these components, and will build them properly if the source is there. Don't use prebuilt ones...they likely won't be built the way you need them.
 
  • Like
Reactions: G4fanboy

kencu

macrumors member
Jan 23, 2019
92
110
macports is not set up to build it's ports as powerpc on 10.6.8. Certain ports might be forced to do that, if they only use Xcode installed compilers. It's not likely worth the effort trying.

Likewise, MacPorts has not set up gcc vesions > 4.2 to cross-compile. So you cannot build PPC code on 10.5 Leopard Intel using any newer gcc version (4.5+) or any version of clang (at present).

You certainly can build your own PPC cross-compiling gcc-11 version on 10.6.8....just nobody like me has automated that process in MacPorts to date.
 

B S Magnet

macrumors 601
Original poster
when building gcc cross compilers, you're best to let gcc itself build the supporting parts the way it wants to. gcc looks in it's own source folder for these components, and will build them properly if the source is there. Don't use prebuilt ones...they likely won't be built the way you need them.

So, would I need to be backstepping to when I built earlier parts of my toolchain components from scratch and changing configure flags on those before trying to configure and build gcc-4.6.x? I ask as a novice, given the complaints I was getting from the failed build with no flags set for configure after the “missing architecture ppc64” messages (which I guess is what it might look for without any configure flags set). This is a long-winded way of saying that I’m not sure what “cross-compiling” entails here or what conditions are calling for cross-compile circumstances.

I should add how with all of those components/earlier dependencies, I didn’t set any flags on builds. I just did the I’m-just-guessing ./configure && make, followed sometimes by a make test or make check before running make install, as specified by their readme instructions.

When picking which component versions to download and compile, I assessed a window of time (typically, 2011 to 2014 for darwin9/darwin10-era support in the open-source community) and picked the repository of a dependency which I gathered would probably build with the gcc-4.2.1 (which is installed with the Xcode 3.2 for SL DP — a version of Xcode specific for the earliest developer builds of Snow Leopard/Darwin10.0.0d1 and Darwin 10.0.0d2, over a year before 10.6.0 went on sale).

In a couple of cases (though I’d have to look through my downloaded tarballs), I did need to find an earlier revision of a component/dependency which would build after finding I couldn’t with a later revision (and confirming this to be the case after finding bits and pieces of related discussions scattershot across forums over the last ten years which ran into similar issues before me).
 
Last edited:

kencu

macrumors member
Jan 23, 2019
92
110
gcc is set up to build a proper mpfr, mpc, isl, and gmp directly from the source code in the proper architecture for the system that you are targeting. You don't need to build any of them yourself in any way. What you do instead is download and decompress the source code for them, and then either copy or symlink the source code into the gcc source directory, with names gmp, mpfr, mpc, and isl. gcc sees those source folders, and will automatically build the supporting software in the proper format for the target during the build of gcc.
 

alex_free

macrumors 65816
Feb 24, 2020
1,060
2,245
gcc is set up to build a proper mpfr, mpc, isl, and gmp directly from the source code in the proper architecture for the system that you are targeting. You don't need to build any of them yourself in any way. What you do instead is download and decompress the source code for them, and then either copy or symlink the source code into the gcc source directory, with names gmp, mpfr, mpc, and isl. gcc sees those source folders, and will automatically build the supporting software in the proper format for the target during the build of gcc.
The contrib/download_prerequisites.sh script in the GCC source code does this automatically.
 

kencu

macrumors member
Jan 23, 2019
92
110
The contrib/download_prerequisites.sh script in the GCC source code does this automatically.
it does indeed. It doesn't work on Apple machines when I tried it in a few gcc versions (had to edit it) and it will download very old copies of things, but that is what you can use.
 

kencu

macrumors member
Jan 23, 2019
92
110
I started with a simpler script I found somewhere on the web, and modified it like this.

The components are updated to more current versions (upstream also does this with these gcc versions). I use a new "make" because the one on Tiger is too old to build many gcc versions.

I also use a patch for Tiger to get past a missing function in sysconf. I'll include this as well. This script works up to Mojave, and in Mojave you need to spec the SDK as there is no SDK in "/". It's an extra config argument.

I can show you how the cross-compiler build works later; it's similar, but a few extra things are specified.

Code:
#!/bin/bash

PREFIX=/opt/gcc7

GCC_VERSION=7.5.0
GMP_VERSION=6.2.1
MPFR_VERSION=4.1.0
MPC_VERSION=1.2.1
ISL_VERSION=0.18
MAKE_VERSION=3.81

here="$PWD"
trap 'cd "$here"' EXIT

die() {
    echo "${@}" >&2
    exit 1
}

if [[ ! -d $PREFIX ]]; then
    die "The prefix folder ${PREFIX} does not exist, please create it manually."
fi

rm -rf "$here/bins"
test -d "$here/bins" || mkdir "$here/bins"

# clean path
export PATH="$here/bins:/usr/bin:/bin:/usr/sbin:/sbin";
echo "PATH=$PATH"


# clean make
export MAKE=make
echo "MAKE=$MAKE"

if ! [ -f gcc-${GCC_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz || die "Could not download gcc-${GCC_VERSION}.tar.gz"
fi
if ! [ -f gmp-${GMP_VERSION}.tar.bz2 ] ; then
    curl -O http://mirror.facebook.net/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2 || die "Could not download gmp-${GMP_VERSION}.tar.bz2"
fi
if ! [ -f mpfr-${MPFR_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.gz || die "Could not download mpfr-${MPFR_VERSION}.tar.gz"
fi
if ! [ -f mpc-${MPC_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/mpc/mpc-${MPC_VERSION}.tar.gz || die "Could not download mpc-${MPC_VERSION}.tar.gz"
fi
if ! [ -f isl-${ISL_VERSION}.tar.bz2 ] ; then
#    curl -O  https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 || die "Could not download isl-0.18.tar.bz2"
    curl -O  http://isl.gforge.inria.fr/isl-${ISL_VERSION}.tar.bz2 || die "Could not download isl-${ISL_VERSION}.tar.bz2"
fi
if ! [ -f make-${MAKE_VERSION}.tar.gz ] ; then
    curl -O http://mirror.facebook.net/gnu/make/make-${MAKE_VERSION}.tar.gz || die "Could not download make-${MAKE_VERSION}.tar.gz"
fi

set -v

if ! [ -f "$here/bins/make" ] ; then
    test -d make-${MAKE_VERSION} || tar xzf make-${MAKE_VERSION}.tar.gz
    cd make-${MAKE_VERSION}
    ./configure && make
    mv make "$here/bins/make"
    cd "$here"
fi

echo "MAKE=`which make`"

test -d gcc-${GCC_VERSION} || tar xzf gcc-${GCC_VERSION}.tar.gz
cd gcc-${GCC_VERSION}

patch -p0 < "$here"/patch-gcc7-tiger-intel.diff

test -d gmp-${GMP_VERSION} || tar xjf ../gmp-${GMP_VERSION}.tar.bz2
test -e gmp || ln -s gmp-${GMP_VERSION} gmp

test -d mpfr-${MPFR_VERSION} || tar xzf ../mpfr-${MPFR_VERSION}.tar.gz
test -e mpfr || ln -s mpfr-${MPFR_VERSION} mpfr

test -d mpc-${MPC_VERSION} || tar xzf ../mpc-${MPC_VERSION}.tar.gz
test -e mpc || ln -s mpc-${MPC_VERSION} mpc

test -d isl-${ISL_VERSION} || tar xjf ../isl-${ISL_VERSION}.tar.bz2
test -e isl || ln -s isl-${ISL_VERSION} isl

mkdir objdir
cd objdir
set +v

../configure "--prefix=$PREFIX" \
    --enable-languages=c,c++,fortran,lto,objc,obj-c++ \
    --with-system-zlib \
    --disable-nls \
    --with-dwarf2

test $? -eq 0 || exit 2

make -j 8

test $? -eq 0 || exit 42

here's the tiger Patch:

Code:
--- libcilkrts/runtime/sysdep-unix.c.orig    2018-04-15 15:19:32.000000000 -0700
+++ libcilkrts/runtime/sysdep-unix.c    2018-04-15 15:58:16.000000000 -0700
@@ -102,6 +102,46 @@
 #   include <vxCpuLib.h> 
 #endif
 
+#ifdef __APPLE__
+#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#include <Availability.h>
+#else
+#include <AvailabilityMacros.h>
+#endif
+#endif //#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED
+
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#define _SC_NPROCESSORS_ONLN 58
+
+long tigersysconf(int name){
+
+    if (name == _SC_NPROCESSORS_ONLN) {
+        int nm[2];
+        size_t len = 4;
+        uint32_t count;
+       
+        nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
+        sysctl(nm, 2, &count, &len, NULL, 0);
+       
+        if (count < 1) {
+            nm[1] = HW_NCPU;
+            sysctl(nm, 2, &count, &len, NULL, 0);
+            if (count < 1) { count = 1; }
+            }
+           
+        return (long)count;
+    }
+    return -1;
+}
+#endif //#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#endif //#ifdef __APPLE__
+
+
+
 struct global_sysdep_state
 {
     pthread_t *threads;    ///< Array of pthreads for system workers
@@ -695,7 +735,13 @@
 #ifdef __VXWORKS__     
     fprintf(fp, "System cores: %d\n", (int)__builtin_popcount(vxCpuEnabledGet()));
 #else   
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+    fprintf(fp, "System cores: %d\n", (int)tigersysconf(_SC_NPROCESSORS_ONLN));
+#else
     fprintf(fp, "System cores: %d\n", (int)sysconf(_SC_NPROCESSORS_ONLN));
+#endif //__MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
 #endif   
     fprintf(fp, "Cilk workers requested: %d\n", n);
 

B S Magnet

macrumors 601
Original poster
I started with a simpler script I found somewhere on the web, and modified it like this.

The components are updated to more current versions (upstream also does this with these gcc versions). I use a new "make" because the one on Tiger is too old to build many gcc versions.

I also use a patch for Tiger to get past a missing function in sysconf. I'll include this as well. This script works up to Mojave, and in Mojave you need to spec the SDK as there is no SDK in "/". It's an extra config argument.

I can show you how the cross-compiler build works later; it's similar, but a few extra things are specified.

Code:
#!/bin/bash

PREFIX=/opt/gcc7

GCC_VERSION=7.5.0
GMP_VERSION=6.2.1
MPFR_VERSION=4.1.0
MPC_VERSION=1.2.1
ISL_VERSION=0.18
MAKE_VERSION=3.81

here="$PWD"
trap 'cd "$here"' EXIT

die() {
    echo "${@}" >&2
    exit 1
}

if [[ ! -d $PREFIX ]]; then
    die "The prefix folder ${PREFIX} does not exist, please create it manually."
fi

rm -rf "$here/bins"
test -d "$here/bins" || mkdir "$here/bins"

# clean path
export PATH="$here/bins:/usr/bin:/bin:/usr/sbin:/sbin";
echo "PATH=$PATH"


# clean make
export MAKE=make
echo "MAKE=$MAKE"

if ! [ -f gcc-${GCC_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz || die "Could not download gcc-${GCC_VERSION}.tar.gz"
fi
if ! [ -f gmp-${GMP_VERSION}.tar.bz2 ] ; then
    curl -O http://mirror.facebook.net/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2 || die "Could not download gmp-${GMP_VERSION}.tar.bz2"
fi
if ! [ -f mpfr-${MPFR_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.gz || die "Could not download mpfr-${MPFR_VERSION}.tar.gz"
fi
if ! [ -f mpc-${MPC_VERSION}.tar.gz ] ; then
    curl -O  http://mirror.facebook.net/gnu/mpc/mpc-${MPC_VERSION}.tar.gz || die "Could not download mpc-${MPC_VERSION}.tar.gz"
fi
if ! [ -f isl-${ISL_VERSION}.tar.bz2 ] ; then
#    curl -O  https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 || die "Could not download isl-0.18.tar.bz2"
    curl -O  http://isl.gforge.inria.fr/isl-${ISL_VERSION}.tar.bz2 || die "Could not download isl-${ISL_VERSION}.tar.bz2"
fi
if ! [ -f make-${MAKE_VERSION}.tar.gz ] ; then
    curl -O http://mirror.facebook.net/gnu/make/make-${MAKE_VERSION}.tar.gz || die "Could not download make-${MAKE_VERSION}.tar.gz"
fi

set -v

if ! [ -f "$here/bins/make" ] ; then
    test -d make-${MAKE_VERSION} || tar xzf make-${MAKE_VERSION}.tar.gz
    cd make-${MAKE_VERSION}
    ./configure && make
    mv make "$here/bins/make"
    cd "$here"
fi

echo "MAKE=`which make`"

test -d gcc-${GCC_VERSION} || tar xzf gcc-${GCC_VERSION}.tar.gz
cd gcc-${GCC_VERSION}

patch -p0 < "$here"/patch-gcc7-tiger-intel.diff

test -d gmp-${GMP_VERSION} || tar xjf ../gmp-${GMP_VERSION}.tar.bz2
test -e gmp || ln -s gmp-${GMP_VERSION} gmp

test -d mpfr-${MPFR_VERSION} || tar xzf ../mpfr-${MPFR_VERSION}.tar.gz
test -e mpfr || ln -s mpfr-${MPFR_VERSION} mpfr

test -d mpc-${MPC_VERSION} || tar xzf ../mpc-${MPC_VERSION}.tar.gz
test -e mpc || ln -s mpc-${MPC_VERSION} mpc

test -d isl-${ISL_VERSION} || tar xjf ../isl-${ISL_VERSION}.tar.bz2
test -e isl || ln -s isl-${ISL_VERSION} isl

mkdir objdir
cd objdir
set +v

../configure "--prefix=$PREFIX" \
    --enable-languages=c,c++,fortran,lto,objc,obj-c++ \
    --with-system-zlib \
    --disable-nls \
    --with-dwarf2

test $? -eq 0 || exit 2

make -j 8

test $? -eq 0 || exit 42

here's the tiger Patch:

Code:
--- libcilkrts/runtime/sysdep-unix.c.orig    2018-04-15 15:19:32.000000000 -0700
+++ libcilkrts/runtime/sysdep-unix.c    2018-04-15 15:58:16.000000000 -0700
@@ -102,6 +102,46 @@
#   include <vxCpuLib.h>
#endif

+#ifdef __APPLE__
+#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#include <Availability.h>
+#else
+#include <AvailabilityMacros.h>
+#endif
+#endif //#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED
+
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#define _SC_NPROCESSORS_ONLN 58
+
+long tigersysconf(int name){
+
+    if (name == _SC_NPROCESSORS_ONLN) {
+        int nm[2];
+        size_t len = 4;
+        uint32_t count;
+     
+        nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
+        sysctl(nm, 2, &count, &len, NULL, 0);
+     
+        if (count < 1) {
+            nm[1] = HW_NCPU;
+            sysctl(nm, 2, &count, &len, NULL, 0);
+            if (count < 1) { count = 1; }
+            }
+         
+        return (long)count;
+    }
+    return -1;
+}
+#endif //#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#endif //#ifdef __APPLE__
+
+
+
struct global_sysdep_state
{
     pthread_t *threads;    ///< Array of pthreads for system workers
@@ -695,7 +735,13 @@
#ifdef __VXWORKS__   
     fprintf(fp, "System cores: %d\n", (int)__builtin_popcount(vxCpuEnabledGet()));
#else 
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+    fprintf(fp, "System cores: %d\n", (int)tigersysconf(_SC_NPROCESSORS_ONLN));
+#else
     fprintf(fp, "System cores: %d\n", (int)sysconf(_SC_NPROCESSORS_ONLN));
+#endif //__MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
#endif 
     fprintf(fp, "Cilk workers requested: %d\n", n);

I went ahead with running your shell script, as-is, recognizing how it is designed to contain all of the build independently of what the system might have installed previously. This makes sense and provides a bit of clarity.

It did run considerably longer than other approaches I’ve tried, but in the end, the build once again fails when the “ppc64” step begins (which, of course, I’m neither asking for nor wanting when building on a G4 system for use in a 32-bit environment… like a G4). I’ve been unable to determine why this “missing required architecture ppc64 in file” keeps coming up. I’m not sure which “file” makes the ppc64 call/request.

Enclosed is the last bit of the failed build using your shell script:

8 -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector directly. # @multilib_dir@ is not really necessary, but sometimes it has # more uses than just a directory name. /bin/sh ../../../../libgcc/../mkinstalldirs ppc64 mkdir ppc64 /opt/gcc_kencu/gcc-7.5.0/objdir/./gcc/xgcc -B/opt/gcc_kencu/gcc-7.5.0/objdir/./gcc/ -B/opt/gcc_kencu/powerpc-apple-darwin10.0.0d1/bin/ -B/opt/gcc_kencu/powerpc-apple-darwin10.0.0d1/lib/ -isystem /opt/gcc_kencu/powerpc-apple-darwin10.0.0d1/include -isystem /opt/gcc_kencu/powerpc-apple-darwin10.0.0d1/sys-include -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -mmacosx-version-min=10.4 -Wa,-force_cpusubtype_ALL -fno-common -mlong-double-128 -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -dynamiclib -nodefaultlibs -install_name /opt/gcc_kencu/lib/libgcc_s.1.dylib -single_module -o ppc64/libgcc_s.dylib -Wl,-exported_symbols_list,libgcc.map -compatibility_version 1 -current_version 1.0 -g -O2 -m64 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulhc3_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divhc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o darwin-tramp_s.o darwin-64_s.o darwin-world_s.o ppc64-fp_s.o ibm-ldouble_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-darwin_s.o unwind-sjlj_s.o unwind-c_s.o darwin-fallback_s.o emutls_s.o libgcc.a -lc ld warning: in /usr/lib/dylib1.o, missing required architecture ppc64 in file ld warning: in /usr/lib/libc.dylib, missing required architecture ppc64 in file Undefined symbols: "_mprotect", referenced from: ___enable_execute_stack in enable-execute-stack_s.o "_pthread_mutex_unlock", referenced from: ___emutls_get_address in emutls_s.o "__keymgr_get_and_lock_processwide_ptr", referenced from: _live_image_destructor in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_getpagesize", referenced from: ___enable_execute_stack in enable-execute-stack_s.o "_pthread_once", referenced from: _uw_init_context_1 in unwind-dw2_s.o ___emutls_get_address in emutls_s.o "__keymgr_unlock_processwide_ptr", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_pthread_key_create", referenced from: _emutls_init in emutls_s.o "_realloc", referenced from: ___emutls_get_address in emutls_s.o "_malloc", referenced from: _search_object in unwind-dw2-fde-darwin_s.o _search_object in unwind-dw2-fde-darwin_s.o ___register_frame in unwind-dw2-fde-darwin_s.o ___register_frame_table in unwind-dw2-fde-darwin_s.o ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_getsectdatafromheader_64", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_calloc", referenced from: __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o ___emutls_get_address in emutls_s.o "_pthread_getspecific", referenced from: ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_free", referenced from: _search_object in unwind-dw2-fde-darwin_s.o ___deregister_frame_info_bases.part.8 in unwind-dw2-fde-darwin_s.o _live_image_destructor in unwind-dw2-fde-darwin_s.o _live_image_destructor in unwind-dw2-fde-darwin_s.o ___deregister_frame in unwind-dw2-fde-darwin_s.o _emutls_destroy in emutls_s.o _emutls_destroy in emutls_s.o "_pthread_mutex_lock", referenced from: ___emutls_get_address in emutls_s.o "_pthread_setspecific", referenced from: ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_abort", referenced from: ___absvdi2 in _absvsi2_s.o ___absvsi2 in _absvsi2_s.o ___absvti2 in _absvdi2_s.o ___addvdi3 in _addvsi3_s.o ___addvsi3 in _addvsi3_s.o ___addvti3 in _addvdi3_s.o ___subvdi3 in _subvsi3_s.o ___subvsi3 in _subvsi3_s.o ___subvti3 in _subvdi3_s.o ___mulvdi3 in _mulvsi3_s.o ___mulvsi3 in _mulvsi3_s.o ___mulvti3 in _mulvdi3_s.o ___negvdi2 in _negvsi2_s.o ___negvsi2 in _negvsi2_s.o ___negvti2 in _negvdi2_s.o ___trampoline_setup in darwin-tramp_s.o ___enable_execute_stack in enable-execute-stack_s.o _read_encoded_value_with_base in unwind-dw2_s.o _base_of_encoded_value in unwind-dw2_s.o _execute_cfa_program in unwind-dw2_s.o _uw_frame_state_for in unwind-dw2_s.o _execute_stack_op in unwind-dw2_s.o _uw_update_context_1 in unwind-dw2_s.o _uw_init_context_1 in unwind-dw2_s.o _uw_update_context in unwind-dw2_s.o __Unwind_RaiseException_Phase2 in unwind-dw2_s.o _uw_install_context_1 in unwind-dw2_s.o __Unwind_GetGR in unwind-dw2_s.o __Unwind_SetGR in unwind-dw2_s.o __Unwind_Resume in unwind-dw2_s.o __Unwind_Resume_or_Rethrow in unwind-dw2_s.o _read_encoded_value_with_base in unwind-dw2-fde-darwin_s.o _size_of_encoded_value.part.3 in unwind-dw2-fde-darwin_s.o _base_from_object.isra.4.part.5 in unwind-dw2-fde-darwin_s.o _search_object in unwind-dw2-fde-darwin_s.o ___deregister_frame_info_bases.part.8 in unwind-dw2-fde-darwin_s.o _base_of_encoded_value in unwind-c_s.o _read_encoded_value_with_base in unwind-c_s.o _emutls_init in emutls_s.o ___emutls_get_address in emutls_s.o "_memset", referenced from: _uw_frame_state_for in unwind-dw2_s.o _uw_init_context_1 in unwind-dw2_s.o ___frame_state_for in unwind-dw2_s.o ___emutls_get_address in emutls_s.o ___emutls_get_address in emutls_s.o "_strlen", referenced from: _uw_frame_state_for in unwind-dw2_s.o _get_cie_encoding in unwind-dw2-fde-darwin_s.o "__keymgr_set_and_unlock_processwide_ptr", referenced from: _live_image_destructor in unwind-dw2-fde-darwin_s.o __Unwind_Find_FDE in unwind-dw2-fde-darwin_s.o "_memcpy", referenced from: _execute_cfa_program in unwind-dw2_s.o _execute_cfa_program in unwind-dw2_s.o _uw_update_context_1 in unwind-dw2_s.o _uw_install_context_1 in unwind-dw2_s.o __Unwind_RaiseException in unwind-dw2_s.o __Unwind_RaiseException in unwind-dw2_s.o __Unwind_ForcedUnwind in unwind-dw2_s.o __Unwind_Resume in unwind-dw2_s.o __Unwind_Resume_or_Rethrow in unwind-dw2_s.o ___emutls_get_address in emutls_s.o ld: symbol(s) not found collect2: error: ld returned 1 exit status make[5]: *** [libgcc_s.dylib] Error 1 make[5]: Leaving directory `/opt/gcc_kencu/gcc-7.5.0/objdir/powerpc-apple-darwin10.0.0d1/ppc64/libgcc' make[4]: *** [multi-do] Error 1 make[4]: Leaving directory `/opt/gcc_kencu/gcc-7.5.0/objdir/powerpc-apple-darwin10.0.0d1/libgcc' make[3]: *** [all-multi] Error 2 make[3]: Leaving directory `/opt/gcc_kencu/gcc-7.5.0/objdir/powerpc-apple-darwin10.0.0d1/libgcc' make[2]: *** [all-stage1-target-libgcc] Error 2 make[2]: Leaving directory `/opt/gcc_kencu/gcc-7.5.0/objdir' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/opt/gcc_kencu/gcc-7.5.0/objdir' make: *** [all] Error 2 sh-4.3#
 

kencu

macrumors member
Jan 23, 2019
92
110
what system did you attempt to build it on? Did you modify the script at all? It works as is from 10.4 ppc to 10.13.

how did you get a ppc error? If you were trying to cross-compile to ppc on an intel system, I pointed out I haven't shown you yet how to do that.
 

kencu

macrumors member
Jan 23, 2019
92
110
by default, gcc builds a support library system that supports both 32 bit and 64 bit versions of the target arch. If you only want one (usually the one you are running on) you set the option "--disable-multilib". That might get rid of the ppc64 arch issues for you.

Nobody I know of has tried to build a gcc cross-compiler from Intel 10.6 to PPC in a long long time. I haven't looked recently, but because Rosetta in 10.6 only supports PowerPC 7400 code, the system roots might also only support that. I can check later.

Oh, I see now -- you are running on that bootleg 10.6 for PPC! I'm sorry I didn't notice that point clearly before. OK. Then "--disable-multilib" might be just what you need to avoid ppc64 and only get ppc 32 bit on that system.
 
  • Like
Reactions: barracuda156

B S Magnet

macrumors 601
Original poster
what system did you attempt to build it on? Did you modify the script at all? It works as is from 10.4 ppc to 10.13.

As described in detail in the first post on this thread, I attempted to build on a PowerBook G4 running an early developer build of Snow Leopard which can and does run on PowerPC Macs as well as Intel. I realize you may be somewhat new here and may not be aware of the “Clouded Leopard” project which has been going here on since April 2020.

It’s actually an interesting, unusual quirk in the history of OS X’s development — a sidebar which originally appeared headed to be a third (and final) Universal binary build of OS X before Apple put the official kibosh on it. The purpose of this thread (and the one I linked to just now) is to see how much can be done for this unusual combination of running the early Snow Leopard environment on PowerPCs (like the G4s and G5s already tested successfully by the community in the above-linked project).

how did you get a ppc error? If you were trying to cross-compile to ppc on an intel system, I pointed out I haven't shown you yet how to do that.

Again…

1628954597184.png


Intel, for sake of this thread and this troubleshooting situation, has nothing to do with what I’m hoping to accomplish here.

Specifically, I began this thread because I wanted to get irssi running on this PowerBook G4 running 10.6 (Build 10A96/Darwin10.0.0d1, the first developer build from June 2008 — 15 months before the retail version of 10.6.0, which was Intel-only, went on sale).

I still hope to do this. What stands in the way is a new-enough gcc which can handle the “pragma GCC diagnostic” (as described in this thread’s first post) — which means a minimum working GCC of 4.6 or higher. This is why I was trying to compile gcc 4.6.4 before trying your shell script.

by default, gcc builds a support library system that supports both 32 bit and 64 bit versions of the target arch. If you only want one (usually the one you are running on) you set the option "--disable-multilib". That might get rid of the ppc64 arch issues for you.

I’ll give this a try. Thanks.

Oh, I see now -- you are running on that bootleg 10.6 for PPC!

If only it was bootlegged! I can only begin to imagine what Apple internal development archives have (or had) on unreleased nightly builds of early Snow Leopard which could help our community project here.

I'm sorry I didn't notice that point clearly before. OK. Then "--disable-multilib" might be just what you need to avoid ppc64 and only get ppc 32 bit on that system.

I’ll give the flag a try. Should I be appending it to the shell command or is there a particular place within the shell script where I should be invoking that flag? Never mind, I figured out where to append it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.