classilla / tenfourfox

Mozilla for Power Macintosh.
http://www.tenfourfox.com/
Other
270 stars 38 forks source link

-O3 gcc libraries #613

Closed classilla closed 3 years ago

classilla commented 4 years ago

Based on @NapalmSauce 's comments in #607, we need new libgcc, libatomic and libstdc++ for G3, 7400, 7450 and G5 built -O3 for 10.4.

classilla commented 4 years ago

(currently we use a single genericized libgcc etc anyway, so this could be an architecture-specific benefit)

NapalmSauce commented 4 years ago

(nevermind, just looked at an .app from sourceforge)

Also @kencu of course I'm not messing with the bootstrap flags; I keep it to bootstrap-debug, just for the final build flags. I used gcc-5's stock libraries, including the gmp, mpfr and mpc versions. I haven't encountered any issues with bootstrap and so far, but still, I'm interested to know if something really breaks that I'm overlooking.

kencu commented 4 years ago

Well -- Iain tells me that the optflags for the libgcc and gcc builds are intrinsic to the gcc build system, they are set to optimal settings, and they totally ignore how we set the optflags or build the the bootstrap compiler.

Are you modifying the deep-in-the-guts gcc Makefiles? If so, I can't sell that to MacPorts.

Perhaps you can show me what you are doing, so i understand better?

kencu commented 4 years ago

@iains -- can you weigh in here for a second? We're trying to make sure that gcc builds itself with optimal settings and there is some question whether it does.

Specifically the gcc is gcc48, but as you know, MacPorts uses parts of libgcc from libgcc 5,6, & 7 in the final mix.

kencu commented 4 years ago

(aside -- gcc8 / libgcc8 builds on 10.4 and 10.5 PPC too -- I just haven't rolled that out to macports yet. I haven't tried gcc9 in a while, but Iain may well have done).

NapalmSauce commented 4 years ago

No, really, I don't want to hack the build system, all I'm doing is setting custom CFLAGS and CXXFLAGS, which the build ignores during stage1, but uses for stage2 and 3. Even in stage2 and stage3 an -O3 flag seems to be discarded in various directories. The resulting libraries, though, get fatter with -O3, so CFLAGS/CXXFLAGS, at the very least, does something.

kencu commented 4 years ago

Well if that does change the compiler, and I take your word for it for now, that is news to me as I was under the impression that gcc totally ignored all that beyond the bootstrap compiler (unless you go to some lengths https://github.com/kencu/TigerPorts/commit/d26a0bfb366eeda7a1385c61239bdf8d421fbde1#diff-969dec99a801dec9918fbde6ddf5d442 to force gcc to do something you want it to). Live and learn, I guess.

I have to stick with macports builds, as I use that infrastructure to fix hundreds of other tickets and issues with ports, so can't veer too far off the farm.

kencu commented 4 years ago

One thing to know, btw, if you're comparing to the macports libgcc build -- the overall libgcc infrastructure on macports comes from (at least) three different versions of libgcc.

The approach is to use the libgcc dylibs from the last version supported on the OS, so the "libgcc" that gcc48 uses on 10.4 Tiger with macports is actually mostly libgcc 7.5.0, with parts of libgcc 6, and parts from libgcc48.

kencu commented 4 years ago

well, yes indeedy, you can -- this is for libc, but presumably the same for other libraries. https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html. Look at that. I learn so much from you guys.

Now I will have to ponder how I can use that information...

NapalmSauce commented 4 years ago

I'm working on getting the gcc runtimes. I hoped I could lazily cross-compile everything from 10.5 for 10.4 but it fails to. :-( I'll just properly boot into tiger.

It says default to -O2 -g . GCC (the compiler portion) might default to no -O flag specified, with runtimes libraries defaulting to -O2 -g just like glibc does.. That would make sense from my tests.

kencu commented 4 years ago

I am still trying to understand how compiling a library with a different opt setting could speed up your compilation, though.

The gcc48 compiler, sure -- it does a lot of this and that -- but the library is just a bunch of precompiled routines.

iains commented 4 years ago

Hi folks,

Ken notifications@github.com wrote:

I am still trying to understand how compiling a library with a different
opt setting could speed up your compilation, though.

The gcc48 compiler, sure -- it does a lot of this and that -- but the
library is just a bunch of precompiled routines.

let’s try to separate concerns.

=====

  1. How to build GCC with non-standard stage 2/3 bootstrap flags.

    • this is done by setting BOOT_CFLAGS= to whatever you want

    [ you can specify the stage flags specifically too STAGEN_???FLAGS= … but that’s tedious ]

    • it’s not necessary, useful, or wise to build the stage1 compiler with complex optimisation; one might be trying to build using c++ features that were very new when the bootstrap compiler was made….

    • in the “old days” it was said by at least two major vendors that the optimum code on Darwin was -Os (smallest achieved fastest)… so for folks building on 10.4 / 10.5 that’s a consideration. Unfortunately, I am only repeating what I’ve been told by vendors and major users - no hard evidence to back this up.

    • If you are using sources (unpatched) <= 6.5 then I would recommend -Os or -fdeclone-ctor-dtor (CXXFLAGS) to work around a bug with cloneing functions [I’ve fixed this in all open branches and will back port to Darwin-specific 6.5 and 5.5.].

======

  1. if one is building a cross compiler without bootstrapping then
    CFLAGS/CXXFLAGS take effect.

=====

  1. I can bootstrap all open branches natively on Darwin8, with two
    constraints : A) the current sources need ld64-58.2.1 at least B) patches mentioned here: https://gcc.gnu.org/pipermail/gcc-testresults/2020-May/560310.html

    On my 500MHz G4 bootstrap & test takes almost a week ….

=====

  1. Non-native Darwin8 bootstrap is possible on Darwin9: A) the current sources need ld64-58.2.1 B) patches mentioned here: https://gcc.gnu.org/pipermail/gcc-testresults/2020-May/560310.html C) You must use —with-sysroot=/Developer/SDKs/MacOSX10.4u.sdk D) You must ‘export MACOSX_DEVELOPMENT_TARGET=10.4 E) It’s advisable to bootstrap GMP and friends with the compiler.

======

  1. The library mess ..
    • we need to find a usable technical solution to cleaning this up … The fundamental problem is that we have a bunch of work-arounds to try and allow “after market upgrades” to system libraries .. I’m not convinced that this is the right solution for these old platforms, it could be better to “make a backup and install an updated working library” — at least for libgcc_s and libstdc++.

Anyway, sorry that I don’t have many cycles free for this right now - but
hopefully once GCC 10.2 is out I’ll poke at some of these things.

Could we try to make separate threads for each problem, if possible - to
help us figure out what we decided :)

cheers Iain

iains commented 4 years ago

iains notifications@github.com wrote:

Hi folks,

Ken notifications@github.com wrote:

I am still trying to understand how compiling a library with a different opt setting could speed up your compilation, though.

The gcc48 compiler, sure -- it does a lot of this and that -- but the library is just a bunch of precompiled routines.

let’s try to separate concerns.

=====

  1. How to build GCC with non-standard stage 2/3 bootstrap flags.
  • this is done by setting BOOT_CFLAGS= to whatever you want

Iff you want to build the [eventual target] libraries with non-standard
optimisation this is done with CFLAGS_FOR_TARGET= this will also apply to the target libraries that are bootstrapped with the
compiler.

fine tweaking is possible - there are settable flags for everything…. … but TBH, I’ve never found it necessary in ≈ 15 years of working with GCC
(including many native crosses etc).

I’d say “you should have a very clear idea of what you are intending to
achieve and why” before moving off the path that is well-tested.

Iain

NapalmSauce commented 4 years ago

-O3 10.4-native libgcc and friends, one set per subarch. Do you plan to ship them next beta, or something like upload them loose on sourceforge so beta-users can test outside of cycles?

gcc-runtimes.zip

classilla commented 4 years ago

Wow, that's great! Thank you, that saves me a lot of time. I think we can probably ship them in the beta.

NapalmSauce commented 4 years ago

You're welcome! They're already relinked the same way as in a tenfourfox bundle, so they're basically drop-in replacements.

classilla commented 4 years ago

I'll integrate them into the internal build system tomorrow and give it a test run.

kencu commented 4 years ago

may I ask which version of gcc7 they were built from?

NapalmSauce commented 4 years ago

They're built off gcc-5.5. Cameron has a fairly outdated macports tree from what I can see; the libgcc, libstdc++ and libatomic versions listed with otool -L firefox are lower that what gcc-5 produces.

That means someone building tenfourfox using an FSF gcc from macports (and who doesn't have an outdated tree) won't be able to drop-in these(since requiring libgcc7), but in that sense, even using versions matching macports, as soon as macports bumps their libgcc port there are chances the drop-in will stop working anyway.

classilla commented 4 years ago

This is just something to be solved with policy: the drop-ins are only supported with the same ABI level. Builders would be on their own for that. I'll add something to the build notes. I have intentionally not revved my tree because I'm trying to eliminate toolchain issues as a variable in problems.

kencu commented 4 years ago

FYI all the gcc versions on MacPorts (gcc48, gcc5, 6, 7) use the libstdc++.dylib from gcc7.

There is no compatibility issue doing that. We bump libgcc all the time without breaking things as by-and-large they are backward compatible.

However, before I bump libgcc to default to libgcc8 on PPC, Iain mentioned a possibly slipped-through-the-cracks ABI error that I will need to make sure is no big deal.

NapalmSauce commented 4 years ago

Yes, they're backward-compatible, but older ones are not drop in, as the dynamic linker complains about versions. If gcc48 links against libraries from gcc7, then libraries from gcc7 become the minimum.

kencu commented 4 years ago

Got it. Yes, I can see that these won't work for anyone using a current MacPorts to build TFF (if there is anyone besides the three of us :> ).

I guess I should have no problem building O3's with gcc7 though, for my own use at least, and then all will be well again and I can use MacPorts current infrastructure.

iains commented 4 years ago

Ken notifications@github.com wrote:

However, before I bump libgcc to default to libgcc8 on PPC, Iain
mentioned a possibly slipped-through-the-cracks ABI error that I will
need to make sure is no big deal.

This is not a Darwin-specific problem but related to zero-sized objects in

= C++17, these can/do cause abi changes for powerpc-darwin (because the
alignment of some entities depends on placement within an aggregate).. One
issue was fixed, but I think another remains (no_unique_address attribute
applied within anonymous entities / unions).

I will try to find a pointer to the page describing the issue (it’s not
“our bug” as such, but Darwin might need corrections on PPC at least).

Iain

classilla commented 4 years ago

@iains is that specific to C++17, i.e., if it's not compiling to that standard, it shouldn't be a problem? TenFourFox's compiler options don't use that.

kencu commented 4 years ago

By the way -- @classilla and @iains -- I wanted to make sure that the two of you were properly introduced, if you don't already know each other. Iain is the darwin lead for gcc, and has been making it all happen for some long time now. Cameron is without a doubt the other most knowledgable PowerPC programmer I have stumbled across in the past few years.

You two have things in common!

kencu commented 4 years ago

I can bootstrap all open branches natively on Darwin8, with two constraints : A) the current sources need ld64-58.2.1 at least B) patches mentioned here: https://gcc.gnu.org/pipermail/gcc-testresults/2020-May/560310.html

BTW, I have a more complete patch a for _SC_NPROCESSORS_ONLN if you like.

classilla commented 4 years ago

So, it drops in fine. I don't notice much improvement in V8, but that largely tests the JIT. DOM seems a bit sprightlier and nothing regresses so let's ship this for the beta. I've plugged it into the autobuilder.

iains commented 4 years ago

Hi Ken, Cameron,

Ken notifications@github.com wrote:

I can bootstrap all open branches natively on Darwin8, with two
constraints : A) the current sources need ld64-58.2.1 at least B) patches
mentioned here:
https://gcc.gnu.org/pipermail/gcc-testresults/2020-May/560310.html

BTW, I have a more complete patch a for _SC_NPROCESSORS_ONLN if you like.

Thanks, that looks good - what conditions is that patch under?

However - it could be/become relevant for some libstdc++ stuff .. so
clarifying the postion would be worthwhile because I want to keep 10.4
viable for as long as possible.

cheers Iain

NapalmSauce commented 4 years ago

That's pretty much it, no magic, but helps. Small win for already cpu-optimized builds. You did the testing on the G5 quad?

classilla commented 4 years ago

Yup.

classilla commented 3 years ago

Marking as fixed since this is shipping. Feel free to talk about the other issues still here if you want, though.

barracuda156 commented 2 years ago

@kencu Do you still recall what was the trick to make gcc8 build on 10.5 PPC?

iains commented 2 years ago

FWIW: I don't recall needing any 'trick' to build gcc-8-5 on powerpc-apple-darwin9: here is the configure line I used to check the 8.5 release:

/src-local/gcc-8/configure --prefix=/opt/iains/powerpc-apple-darwin9/gcc-8-5 --build=powerpc-apple-darwin9 --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=all

nothing special and no patches.

NOTE: that there would be some recommended back ports of fixes since then - but those are not build fixes.

barracuda156 commented 2 years ago

@iains Thank you for replying. For me any gcc higher than 7 fails with some Bus errors. Initially I have been trying to get gcc11 to 10.6 PPC, but then tried to build the same on 10.5.8 PPC, and that too fails.

:info:build echo GCC_CFLAGS = '-g -O2 -pipe -Os -DIN_GCC -fPIC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include ' >> tmp-libgcc.mvars
:info:build echo INHIBIT_LIBC_CFLAGS = '' >> tmp-libgcc.mvars
:info:build echo TARGET_SYSTEM_ROOT = '' >> tmp-libgcc.mvars
:info:build if test no = yes; then \
:info:build       NO_PIE_CFLAGS="-fno-PIE"; \
:info:build     else \
:info:build       NO_PIE_CFLAGS=; \
:info:build     fi; \
:info:build     echo NO_PIE_CFLAGS = "$NO_PIE_CFLAGS" >> tmp-libgcc.mvars
:info:build mv tmp-libgcc.mvars libgcc.mvars
:info:build if /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/ -print-sysroot-headers-suffix > /dev/null 2>&1; then \
:info:build       set -e; for ml in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/ -print-multi-lib`; do \
:info:build         multi_dir=`echo ${ml} | sed -e 's/;.*$//'`; \
:info:build         flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
:info:build         sfx=`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/ ${flags} -print-sysroot-headers-suffix`; \
:info:build         if [ "${multi_dir}" = "." ]; \
:info:build           then multi_dir=""; \
:info:build         else \
:info:build           multi_dir=/${multi_dir}; \
:info:build         fi; \
:info:build         echo "${sfx};${multi_dir}"; \
:info:build       done; \
:info:build     else \
:info:build       echo ";"; \
:info:build     fi > tmp-fixinc_list
:info:build /bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../move-if-change tmp-fixinc_list fixinc_list
:info:build echo timestamp > s-fixinc_list
:info:build rm -rf libbackend.a
:info:build ar rc libbackend.a gimple-match.o generic-match.o insn-attrtab.o insn-automata.o insn-dfatab.o insn-emit.o insn-extract.o insn-latencytab.o insn-modes.o insn-opinit.o insn-output.o insn-peep.o insn-preds.o insn-recog.o insn-enums.o ggc-page.o alias.o alloc-pool.o auto-inc-dec.o auto-profile.o bb-reorder.o bitmap.o bt-load.o builtins.o caller-save.o calls.o ccmp.o cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfgexpand.o cfghooks.o cfgloop.o cfgloopanal.o cfgloopmanip.o cfgrtl.o symtab.o cgraph.o cgraphbuild.o cgraphunit.o cgraphclones.o combine.o combine-stack-adj.o compare-elim.o context.o convert.o coverage.o cppbuiltin.o cppdefault.o cprop.o cse.o cselib.o data-streamer.o data-streamer-in.o data-streamer-out.o dbxout.o dbgcnt.o dce.o ddg.o debug.o df-core.o df-problems.o df-scan.o dfp.o dojump.o dominance.o domwalk.o double-int.o dse.o dumpfile.o dwarf2asm.o dwarf2cfi.o dwarf2out.o early-remat.o emit-rtl.o et-forest.o except.o explow.o expmed.o expr.o fibonacci_heap.o file-prefix-map.o final.o fixed-value.o fold-const.o fold-const-call.o function.o function-tests.o fwprop.o gcc-rich-location.o gcse.o gcse-common.o ggc-common.o ggc-tests.o gimple.o gimple-builder.o gimple-expr.o gimple-iterator.o gimple-fold.o gimple-laddress.o gimple-loop-interchange.o gimple-loop-jam.o gimple-low.o gimple-pretty-print.o gimple-ssa-backprop.o gimple-ssa-evrp.o gimple-ssa-evrp-analyze.o gimple-ssa-isolate-paths.o gimple-ssa-nonnull-compare.o gimple-ssa-split-paths.o gimple-ssa-store-merging.o gimple-ssa-strength-reduction.o gimple-ssa-sprintf.o gimple-ssa-warn-alloca.o gimple-ssa-warn-restrict.o gimple-streamer-in.o gimple-streamer-out.o gimple-walk.o gimplify.o gimplify-me.o godump.o graph.o graphds.o graphite.o graphite-isl-ast-to-gimple.o graphite-dependences.o graphite-optimize-isl.o graphite-poly.o graphite-scop-detection.o graphite-sese-to-poly.o gtype-desc.o haifa-sched.o hash-map-tests.o hash-set-tests.o hsa-common.o hsa-gen.o hsa-regalloc.o hsa-brig.o hsa-dump.o hw-doloop.o hwint.o ifcvt.o ree.o inchash.o incpath.o init-regs.o internal-fn.o ipa-chkp.o ipa-cp.o ipa-devirt.o ipa-fnsummary.o ipa-polymorphic-call.o ipa-split.o ipa-inline.o ipa-comdats.o ipa-visibility.o ipa-inline-analysis.o ipa-inline-transform.o ipa-predicate.o ipa-profile.o ipa-prop.o ipa-param-manipulation.o ipa-pure-const.o ipa-icf.o ipa-icf-gimple.o ipa-reference.o ipa-hsa.o ipa-ref.o ipa-utils.o ipa.o ira.o ira-build.o ira-costs.o ira-conflicts.o ira-color.o ira-emit.o ira-lives.o jump.o langhooks.o lcm.o lists.o loop-doloop.o loop-init.o loop-invariant.o loop-iv.o loop-unroll.o lower-subreg.o lra.o lra-assigns.o lra-coalesce.o lra-constraints.o lra-eliminations.o lra-lives.o lra-remat.o lra-spills.o lto-cgraph.o lto-streamer.o lto-streamer-in.o lto-streamer-out.o lto-section-in.o lto-section-out.o lto-opts.o lto-compress.o mcf.o mode-switching.o modulo-sched.o multiple_target.o omp-offload.o omp-expand.o omp-general.o omp-grid.o omp-low.o omp-simd-clone.o optabs.o optabs-libfuncs.o optabs-query.o optabs-tree.o options-save.o opts-global.o passes.o plugin.o postreload-gcse.o postreload.o predict.o print-rtl.o print-rtl-function.o print-tree.o profile.o profile-count.o read-md.o read-rtl.o read-rtl-function.o real.o realmpfr.o recog.o reg-stack.o regcprop.o reginfo.o regrename.o regstat.o reload.o reload1.o reorg.o resource.o rtl-chkp.o rtl-error.o rtl-tests.o rtl.o rtlhash.o rtlanal.o rtlhooks.o rtx-vector-builder.o run-rtl-passes.o sched-deps.o sched-ebb.o sched-rgn.o sel-sched-ir.o sel-sched-dump.o sel-sched.o selftest-rtl.o selftest-run-tests.o sese.o shrink-wrap.o simplify-rtx.o sparseset.o spellcheck.o spellcheck-tree.o sreal.o stack-ptr-mod.o statistics.o stmt.o stor-layout.o store-motion.o streamer-hooks.o stringpool.o substring-locations.o target-globals.o targhooks.o timevar.o toplev.o tracer.o trans-mem.o tree-affine.o asan.o tsan.o ubsan.o sanopt.o sancov.o tree-call-cdce.o tree-cfg.o tree-cfgcleanup.o tree-chrec.o tree-complex.o tree-data-ref.o tree-dfa.o tree-diagnostic.o tree-dump.o tree-eh.o tree-emutls.o tree-if-conv.o tree-inline.o tree-into-ssa.o tree-iterator.o tree-loop-distribution.o tree-nested.o tree-nrv.o tree-object-size.o tree-outof-ssa.o tree-parloops.o tree-phinodes.o tree-chkp.o tree-chkp-opt.o tree-predcom.o tree-pretty-print.o tree-profile.o tree-scalar-evolution.o tree-sra.o tree-switch-conversion.o tree-ssa-address.o tree-ssa-alias.o tree-ssa-ccp.o tree-ssa-coalesce.o tree-ssa-copy.o tree-ssa-dce.o tree-ssa-dom.o tree-ssa-dse.o tree-ssa-forwprop.o tree-ssa-ifcombine.o tree-ssa-live.o tree-ssa-loop-ch.o tree-ssa-loop-im.o tree-ssa-loop-ivcanon.o tree-ssa-loop-ivopts.o tree-ssa-loop-manip.o tree-ssa-loop-niter.o tree-ssa-loop-prefetch.o tree-ssa-loop-split.o tree-ssa-loop-unswitch.o tree-ssa-loop.o tree-ssa-math-opts.o tree-ssa-operands.o tree-ssa-phionlycprop.o tree-ssa-phiopt.o tree-ssa-phiprop.o tree-ssa-pre.o tree-ssa-propagate.o tree-ssa-reassoc.o tree-ssa-sccvn.o tree-ssa-scopedtables.o tree-ssa-sink.o tree-ssa-strlen.o tree-ssa-structalias.o tree-ssa-tail-merge.o tree-ssa-ter.o tree-ssa-threadbackward.o tree-ssa-threadedge.o tree-ssa-threadupdate.o tree-ssa-uncprop.o tree-ssa-uninit.o tree-ssa.o tree-ssanames.o tree-stdarg.o tree-streamer.o tree-streamer-in.o tree-streamer-out.o tree-tailcall.o tree-vect-generic.o tree-vect-patterns.o tree-vect-data-refs.o tree-vect-stmts.o tree-vect-loop.o tree-vect-loop-manip.o tree-vect-slp.o tree-vectorizer.o tree-vector-builder.o tree-vrp.o tree.o typed-splay-tree.o unique-ptr-tests.o valtrack.o value-prof.o var-tracking.o varasm.o varpool.o vec-perm-indices.o vmsdbgout.o vr-values.o vtable-verify.o web.o wide-int.o wide-int-print.o xcoffout.o rs6000.o rs6000-string.o rs6000-p8swap.o darwin.o host-darwin.o host-ppc-darwin.o
:info:build ranlib  libbackend.a
:info:build if [ -f ../stage_final ] \
:info:build        && cmp -s ../stage_current ../stage_final; then \
:info:build       cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
:info:build     else \
:info:build       build/genchecksum c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o darwin-c.o rs6000-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/pic/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
:info:build                      checksum-options > cc1-checksum.c.tmp &&        \
:info:build       /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
:info:build     fi
:info:build if [ -f ../stage_final ] \
:info:build        && cmp -s ../stage_current ../stage_final; then \
:info:build        cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \
:info:build     else \
:info:build       build/genchecksum cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/method.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/repo.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o darwin-c.o rs6000-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/pic/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
:info:build                      checksum-options > cc1plus-checksum.c.tmp &&      \
:info:build       /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
:info:build     fi
:info:build /opt/local/bin/g++-mp-7 -arch ppc -std=gnu++98 -no-pie   -g -mdynamic-no-pic -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -L/opt/local/lib -Wl,-headerpad_max_install_names -o lto1 \
:info:build         lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/pic/libiberty.a ../libdecnumber/libdecnumber.a 
:info:build /opt/local/bin/g++-mp-7 -arch ppc -std=gnu++98 -fno-PIE -c  -DIN_GCC_FRONTEND -g -mdynamic-no-pic -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libcpp/include -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libbacktrace -I/opt/local/include -I/opt/local/include -o cc1plus-checksum.o -MT cc1plus-checksum.o -MMD -MP -MF ./.deps/cc1plus-checksum.TPo cc1plus-checksum.c
:info:build /opt/local/bin/g++-mp-7 -arch ppc -std=gnu++98 -fno-PIE -c  -DIN_GCC_FRONTEND -g -mdynamic-no-pic -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libcpp/include -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/gcc-8.5.0/gcc/../libbacktrace -I/opt/local/include -I/opt/local/include -o cc1-checksum.o -MT cc1-checksum.o -MMD -MP -MF ./.deps/cc1-checksum.TPo cc1-checksum.c
:info:build cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build /opt/local/bin/g++-mp-7 -arch ppc -std=gnu++98 -no-pie   -g -mdynamic-no-pic -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -L/opt/local/lib -Wl,-headerpad_max_install_names -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o darwin-c.o rs6000-c.o \
:info:build       cc1-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/pic/libiberty.a ../libdecnumber/libdecnumber.a  -L/opt/local/lib -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz
:info:build /opt/local/bin/g++-mp-7 -arch ppc -std=gnu++98 -no-pie   -g -mdynamic-no-pic -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -L/opt/local/lib -Wl,-headerpad_max_install_names -o cc1plus \
:info:build           cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/method.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/repo.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o darwin-c.o rs6000-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/pic/libiberty.a ../libdecnumber/libdecnumber.a  -L/opt/local/lib -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build ld: warning: direct access in libc_name::hash(char const*, unsigned int) to global weak symbol libc_name::hash(char const*, unsigned int) means the weak symbol cannot be overriden at runtime. This was likely caused by different translation units being compiled with different visiblity settings.
:info:build echo | /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build/./gcc/ -E -dM - | \
:info:build       sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
:info:build          -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
:info:build       sort -u > tmp-macro_list
:info:build cc1: internal compiler error: Bus error
:info:build libbacktrace could not find executable to open
:info:build make[3]: *** [s-macro_list] Error 130
:info:build make[3]: *** Deleting intermediate file `gcc.pod'
:info:build make[2]: *** [all-stage1-gcc] Interrupt
:info:build make[1]: *** [stage1-bubble] Interrupt
:info:build make: *** [bootstrap-lean] Interrupt
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc8/gcc8/work/build" && /usr/bin/make -j4 -w bootstrap-lean 
:info:build Killed by signal: 2
:debug:build process_cmd aborted: interrupted by signal
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "catch {system {*}$notty {*}$callback {*}$nice $fullcmdstring} result"
:debug:build     (procedure "command_exec" line 103)
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:debug:build     invoked from within
:debug:build "catch {$procedure $targetname} errstr"
:debug:build     (procedure "target_run" line 172)
:debug:build     invoked from within
:debug:build "{*}$handler $ditem"
:debug:build     invoked from within
:debug:build "catch {{*}$handler $ditem} result"
:debug:build     (procedure "dlist_eval" line 33)
:debug:build     invoked from within
:debug:build "dlist_eval $dlist "" target_run"
:debug:build     (procedure "eval_targets" line 41)
:debug:build     invoked from within
:debug:build "eval_targets activate"
:debug:build     invoked from within
:debug:build "$workername eval "eval_targets $target""
:debug:build     (procedure "mportexec" line 152)
:debug:build     invoked from within
:debug:build "mportexec $workername $target"
:debug:build     invoked from within
:debug:build "catch {set result [mportexec $workername $target]} result"
:debug:build     ("uplevel" body line 72)
:debug:build     invoked from within
:debug:build "uplevel 1 $block"
:debug:build     (procedure "foreachport" line 20)
:debug:build     invoked from within
:debug:build "foreachport $portlist {
:debug:build         array unset portinfo
:debug:build         # If we have a url, use that, since it's most specific
:debug:build         # otherwise try to map the..."
:debug:build     (procedure "action_target" line 10)
:debug:build     invoked from within
:debug:build "$action_proc $action $portlist [array get global_options]"
:debug:build     (procedure "process_cmd" line 110)
:debug:build     invoked from within
:debug:build "process_cmd $remaining_args"
:debug:build     ("uplevel" body line 3)
:debug:build     invoked from within
:debug:build "uplevel 1 $body"
:error:build Aborted: SIGINT received.
kencu commented 2 years ago

@kencu Do you still recall what was the trick to make gcc8 build on 10.5 PPC?

If you would like to open a ticket on MacPorts about building gcc8 on 10.5 PPC, we can work through it there.

For a start, what I would do is just build gcc8 alone, without macports in the mix. It is not hard to do, there are four prerequisites needed, and then it will build in a folder without any outside confusion. Do it on an Intel system first, maybe, just to really get a flavour of how this is done.

Once you see how to build it simply, without confusion, then build gcc8 on PowerPC 10.5 Leopard. It builds easily (for me).

And then, once you know it builds, you can try to build it in MacPorts environment. That adds lots of confusion, environment variables, non-standard linker, assembler, and libtool choices, etc.

Then once you get gcc8 building in a MacPorts environment, you can look at actually updating the floor gcc in MacPorts of 10.5 to gcc8. There are issues on MacPorts building gcc8 in 10.5 on the Intel side (assembler issues induced by the changes made to cctools in MacPorts) but they can be worked through (I did, on 10.6+, with Iain's help).

iains commented 2 years ago

@kencu Do you still recall what was the trick to make gcc8 build on 10.5 PPC?

And then, once you know it builds, you can try to build it in MacPorts environment. That adds lots of confusion, environment variables, non-standard linker, assembler, and libtool choices, etc.

There are definitely versions of cctools 'as' that are broken for powerpc.

barracuda156 commented 2 years ago

@iains I have ld64 from Macports, and apparently it works since gcc4.9, gcc6 and gcc7 have compiled and are functional. Something breaks down starting with gcc8. The only time I changed the linker was when I tried building TFF, @kencu suggestion helped me proceed quite far with the build: https://github.com/classilla/tenfourfox/issues/498 However it still failed with weird zip errors: https://github.com/classilla/tenfourfox/issues/652

I have actually tried to build your xtools, but Cmake complained about the lack of tapi. Then I tried building libtapi via Macports, and it failed on 10.6 PPC and 10.5.8 alike. I opened a ticket for that: https://trac.macports.org/ticket/64187 (re failure on 10.5.8).

barracuda156 commented 2 years ago

@kencu Thank you, I will give it a try. Anyway I want to check that 10.6 PPC is indeed unable to compile for ppc64, and Macports for some reason ignores --enforce-variants +universal (which I have set in config to be ppc ppc64). I remember what you have told me, so my hopes are low here. Once ppc64 fails, I try building the same gcc for ppc32 (outside of Macports). Compilation is running now, and unless is errors soon, I will leave it compile overnight.

iains commented 2 years ago

@iains I have ld64 from Macports,

what version is that?

and apparently it works since gcc4.9, gcc6 and gcc7 have compiled and are functional. Something breaks down starting with gcc8.

maybe the executable gets larger and the islanding fails? what is the reported problem?

The only time I changed the linker was when I tried building TFF, @kencu suggestion helped me proceed quite far with the build: #498 However it still failed with weird zip errors: #652

I have actually tried to build your xtools, but Cmake complained about the lack of tapi.

Yes, tapi needs to be built from the llvm/clang project (I have not had any chance to update from 7.1.1 - but that was working sufficiently for the ld64 being built.)

note: Upstream LLVM needs patches to work on powerpc-darwin (those are on my llvm-7.1.1. branch)

Then I tried building libtapi via Macports, and it failed on 10.6 PPC and 10.5.8 alike. I opened a ticket for that: https://trac.macports.org/ticket/64187 (re failure on 10.5.8).

no idea on that - (but it would not be a surprise, depending on the LLVM versions, since older OS support was dropped at various points)

barracuda156 commented 2 years ago

@kencu @iains Okay, Iains branch of gcc10 failed building with this:

ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make[3]: *** [lto1] Error 1
make[3]: *** Waiting for unfinished jobs....
Undefined symbols for architecture ppc:
  "_ZSTD_maxCLevel", referenced from:
      lto_normalized_zstd_level()      in libbackend.a(lto-compress.o)
  "_ZSTD_compressBound", referenced from:
      lto_compression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
  "_ZSTD_compress", referenced from:
      lto_compression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
  "_ZSTD_isError", referenced from:
      lto_compression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
      lto_uncompression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
  "_ZSTD_getErrorName", referenced from:
      lto_compression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
      lto_uncompression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
  "_ZSTD_getFrameContentSize", referenced from:
      lto_uncompression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
  "_ZSTD_decompress", referenced from:
      lto_uncompression_zstd(lto_compression_stream*)       in libbackend.a(lto-compress.o)
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make[3]: *** [lto-dump] Error 1
rm gcov.pod fsf-funding.pod lto-dump.pod gpl.pod cpp.pod gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

I have seen this error a number of times, it is not related to 64-bit (I have been building for ppc previously, not ppc64). I will reconfigure now for 32-bit just to make sure.

P. S. I used gcc-mp-7 and g++-mp-7 in config (which otherwise perfectly work).

iains commented 2 years ago

@kencu Thank you, I will give it a try. Anyway I want to check that 10.6 PPC is indeed unable to compile for ppc64,

10.6 was only released on X86, and the powerpc support was via Rosetta - which only supports ppc7400. The system libraries on 10.6 do not contain a ppc64 slice (so you should not expect it to work on any standard 10.6 configuration).

barracuda156 commented 2 years ago

@iains Here is the ld64 output:

36-9:build svacchanda$ port -v installed ld64
The following ports are currently installed:
  ld64 @3_3+ld64_127 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2021-10-04T16:17:12+0800'
  ld64 @3_3+ld64_97 requested_variants='+ld64_97' platform='darwin 10' archs='ppc' date='2021-12-15T02:40:15+0800'
36-9:build svacchanda$ 

So the ld64_127 have been used for everything aside of TFF build attempt.

Regarding tapi and xtools: so where should I start? As @kencu suggested, I can try working completely outside of Macports set up. (Which would mean I have gcc4.2 as a system compiler.)

iains commented 2 years ago

however, compiling 32b code with -macosx-version-min=10.6 should work for recent GCC (I do not recall when, exactly, we fixed the Rosetta support).

iains commented 2 years ago

@iains Here is the ld64 output:

36-9:build svacchanda$ port -v installed ld64 The following ports are currently installed: ld64 @3_3+ld64_127 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2021-10-04T16:17:12+0800' ld64 @3_3+ld64_97 requested_variants='+ld64_97' platform='darwin 10' archs='ppc' date='2021-12-15T02:40:15+0800' 36-9:build svacchanda$

So the ld64_127 have been used for everything aside of TFF build attempt.

ld64 127 was the last version to support ppc (officially) although ISTR that the release of cctools at the same time was broken for ppc64.

I have not yet back ported the re-write of branch islanding to that version.

Regarding tapi and xtools: so where should I start? As @kencu suggested, I can try working completely outside of Macports set up. (Which would mean I have gcc4.2 as a system compiler.)

I'd suggest you try to build an earlier version of xtools https://github.com/iains/darwin-xtools/tree/darwin-xtools-1-1-0

This does not need a tapi build (and 10.5 does not use .tbd libs so that's OK) - however, this does need a C++11 compiler (all later ld64 versions do) but GCC5 is fine.

For the record: up to gcc-10 you should be able to bootstrap with Apple-gcc-4.2.1 (I have checked that works) - but from GCC-11 we also need a C++11 compiler (although, again, GCC-5 should be OK).

iains commented 2 years ago

@kencu @iains Okay, Iains branch of gcc10 failed

JFTR: The branch does work perfectly OK on powerpc-darwin9 :

the 10.3 release was configured and tested like so: /src-local/gcc-10/configure --prefix=/opt/iains/powerpc-apple-darwin9/gcc-10-3-toolchain --build=powerpc-apple-darwin9 --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=all

https://gcc.gnu.org/pipermail/gcc-testresults/2021-April/681033.html

building with this:

ld: symbol(s) not found for architecture ppc collect2: error: ld returned 1 exit status make[3]: [lto1] Error 1 make[3]: Waiting for unfinished jobs.... Undefined symbols for architecture ppc: "_ZSTD_maxCLevel", referenced from: lto_normalized_zstd_level() in libbackend.a(lto-compress.o) "_ZSTD_compressBound", referenced from: lto_compression_zstd(lto_compression_stream*) in libbackend.a(lto-compress.o) "_ZSTD_compress", referenced from:

I have seen this error a number of times, it is not related to 64-bit (I have been building for ppc previously, not ppc64). I will reconfigure now for 32-bit just to make sure.

This looks like some kind of configuration error - i.e. it is thinks it can use a compression scheme for LTO that it fails to find later.

What is the configuration line?

iains commented 2 years ago

BTW .. this "issue" seems to have drifted far from its title

Having said that, I'm not sure we're seeing a GCC issue here.

barracuda156 commented 2 years ago

@kencu @iains Okay, Iains branch of gcc10 failed

JFTR: The branch does work perfectly OK on powerpc-darwin9 : the 10.3 release was configured and tested like so: /src-local/gcc-10/configure --prefix=/opt/iains/powerpc-apple-darwin9/gcc-10-3-toolchain --build=powerpc-apple-darwin9 --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=all

Thank you very much for detailed reply. Is this configuration with stock linker and assembler of 10.5.8 PPC? Or your rebuilt tools?

I will try building on 10.5.8 PPC exactly with your settings to make sure that works, and once successful, then will work on adapting it for 10.6 PPC.

P. S. I will update on the config and result of the build once back to office.

kencu commented 2 years ago

@barracuda156 -- if you would like to open a ticket on the MacPorts tracker and call it something like "libgcc - update to gcc8 (or newer) on systems less than 10.6" we will work with you on getting gcc built.

For the moment, you are really going around in circles here still.

Forget about 10.6 on PPC for the time being. Not only is is non-standard, but it will not work right with either gcc or cctools or ld64 without some knowledgable surgery, because what these tools expect to find on a 10.6 system (certain symbols in the system library for example) do not exist on 10.6 on PPC, and many things break / segfault / just don't work.

Your best bet to get smoothly started is to use an Intel system, something between 10.6 and 10.13 if you have it, and just learn how to build gcc correctly even one time. Once you have that, you can build a few different versions of gcc.

Once you know how to do that, you can try building gcc5 or something very simple on 10.5 PPC.

And once you can do that, you are ready to think about gcc8, gcc9, etc.

gcc11 is where it starts to get harder, because it won't build with the default toolchain on 10.5 PPC -- so don't even try that for now, until everything else is easy for you.

Forget about libtapi, etc, for the time being. You will spend dozens of hours on that, and you don't need to. When it comes time to build gcc11 on 10.5 PowerPC, you will use MacPorts updated cctools and ld64, but not before then!

by the end of this, you will be a big gcc expert. But right now, getting gcc5 to just build on a reasonably new Intel system would be a nice place to start.

barracuda156 commented 2 years ago

@kencu I have actually built gcc11 on Catalina (outside Macports), used XcodeLegacy to extract PPC components and install them into Xcode 12.4 and then almost built cross-compiler for PCC with gcc11. It built but some tests fail.