Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc does not build on arm64-based MacOSX b/c undefined host_hooks symbols #2961

Open
markghayden opened this issue Mar 7, 2023 · 11 comments

Comments

@markghayden
Copy link

Trying to build mxe on arm-based-host for gcc_x86_64-w64-mingw32 target. There is a problem with undefined host_hooks late in the build. I've copy/pasted the relevant error.

I've tried figuring out what is going wrong, but the gcc build process is just too complicated and I can't figure out where things are going wrong or how the host_hooks should be working.

This problem only happens when host is built native arm64. The build works with (Rosetta-based) x86_64 build. In both cases, Macports with +universal variants is used for the host build environment.

The full log file is attached (compressed because of the 70MB size, github gists would not accept the file).

Any help would be appreciated!

gcc_x86_64-w64-mingw32.shared.zip

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 adjust-alignment.o alias.o alloc-pool.o auto-inc-dec.o auto-profile.o bb-reorder.o bitmap.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 symtab-thunks.o symtab-clones.o cgraph.o cgraphbuild.o cgraphunit.o cgraphclones.o combine.o combine-stack-adj.o compare-elim.o context.o convert.o coroutine-passes.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 digraph.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-abi.o function-tests.o fwprop.o gcc-rich-location.o gcse.o gcse-common.o ggc-common.o ggc-tests.o gimple.o gimple-array-bounds.o gimple-builder.o gimple-expr.o gimple-if-to-switch.o gimple-iterator.o gimple-fold.o gimple-laddress.o gimple-loop-interchange.o gimple-loop-jam.o gimple-loop-versioning.o gimple-low.o gimple-pretty-print.o gimple-range.o gimple-range-cache.o gimple-range-edge.o gimple-range-gori.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 graphviz.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 hw-doloop.o hwint.o ifcvt.o ree.o inchash.o incpath.o init-regs.o internal-fn.o ipa-cp.o ipa-sra.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-modref.o ipa-modref-tree.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-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-low.o omp-oacc-kernels-decompose.o omp-simd-clone.o opt-problem.o optabs.o optabs-libfuncs.o optabs-query.o optabs-tree.o optinfo.o optinfo-emit-json.o options-save.o opts-global.o ordered-hash-map-tests.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 range.o range-op.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-error.o rtl-ssa/accesses.o rtl-ssa/blocks.o rtl-ssa/changes.o rtl-ssa/functions.o rtl-ssa/insns.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 splay-tree-utils.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-diagnostic-path.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-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-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 gimple-isel.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-vect-slp-patterns.o tree-vectorizer.o tree-vector-builder.o tree-vrp.o tree.o tristate.o typed-splay-tree.o unique-ptr-tests.o valtrack.o value-query.o value-range.o value-range-equiv.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 i386.o analyzer/analysis-plan.o analyzer/analyzer.o analyzer/analyzer-logging.o analyzer/analyzer-pass.o analyzer/analyzer-selftests.o analyzer/bar-chart.o analyzer/call-string.o analyzer/checker-path.o analyzer/complexity.o analyzer/constraint-manager.o analyzer/diagnostic-manager.o analyzer/engine.o analyzer/feasible-graph.o analyzer/function-set.o analyzer/pending-diagnostic.o analyzer/program-point.o analyzer/program-state.o analyzer/region.o analyzer/region-model.o analyzer/region-model-impl-calls.o analyzer/region-model-manager.o analyzer/region-model-reachability.o analyzer/sm.o analyzer/sm-file.o analyzer/sm-malloc.o analyzer/sm-pattern-test.o analyzer/sm-sensitive.o analyzer/sm-signal.o analyzer/sm-taint.o analyzer/state-purge.o analyzer/store.o analyzer/supergraph.o analyzer/svalue.o analyzer/trimmed-graph.o x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o winnt.o winnt-stubs.o host-darwin.o ranlib libbackend.a if [ -f ../stage_final ] \ && cmp -s ../stage_current ../stage_final; then \ cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \ else \ 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 i386-c.o winnt-c.o msformat-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \ checksum-options > cc1-checksum.c.tmp && \ /Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \ fi if [ -f ../stage_final ] \ && cmp -s ../stage_current ../stage_final; then \ cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \ else \ build/genchecksum cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.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/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.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 i386-c.o winnt-c.o winnt-cxx.o msformat-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \ checksum-options > cc1plus-checksum.c.tmp && \ /Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \ fi g++ -std=gnu++11 -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -Wl,-no_pie -o f951 \ fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o fortran/class.o fortran/constructor.o fortran/cpp.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o fortran/error.o fortran/expr.o fortran/interface.o fortran/intrinsic.o fortran/io.o fortran/iresolve.o fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o fortran/symbol.o fortran/target-memory.o fortran/convert.o fortran/dependency.o fortran/f95-lang.o fortran/trans.o fortran/trans-array.o fortran/trans-common.o fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o fortran/trans-stmt.o fortran/trans-types.o fortran/frontend-passes.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L./../zlib -lz libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a attribs.o \ -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lisl -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lmpc -lmpfr -lgmp -L./../zlib -lz build/genchecksum objc/objc-lang.o objc/objc-act.o hash-table.o objc/objc-runtime-shared-support.o objc/objc-gnu-runtime-abi-01.o objc/objc-next-runtime-abi-01.o objc/objc-next-runtime-abi-02.o objc/objc-encoding.o objc/objc-map.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 i386-c.o winnt-c.o msformat-c.o \ libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a checksum-options > cc1obj-checksum.c.tmp && \ /Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../move-if-change cc1obj-checksum.c.tmp cc1obj-checksum.c clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] ld: warning: -no_pie is deprecated when targeting new OS versions ld: warning: -no_pie ignored for arm64 Undefined symbols for architecture arm64: "_host_hooks", referenced from: toplev::main(int, char**) in libbackend.a(toplev.o) gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [f951] Error 1 g++ -std=gnu++11 -fno-PIE -c -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcpp/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcody -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber/bid -I../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libbacktrace -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -o cc1obj-checksum.o -MT cc1obj-checksum.o -MMD -MP -MF ./.deps/cc1obj-checksum.TPo cc1obj-checksum.c g++ -std=gnu++11 -fno-PIE -c -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcpp/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcody -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber/bid -I../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libbacktrace -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -o cc1-checksum.o -MT cc1-checksum.o -MMD -MP -MF ./.deps/cc1-checksum.TPo cc1-checksum.c g++ -std=gnu++11 -fno-PIE -c -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/. -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcpp/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libcody -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libdecnumber/bid -I../libdecnumber -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-11.3.0/gcc/../libbacktrace -I/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/include -o cc1plus-checksum.o -MT cc1plus-checksum.o -MMD -MP -MF ./.deps/cc1plus-checksum.TPo cc1plus-checksum.c clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] warning: unknown warning option '-Werror=format-diag' [-Wunknown-warning-option] warning: unknown warning option '-Werror=format-diag' [-Wunknown-warning-option] warning: unknown warning option '-Werror=format-diag' [-Wunknown-warning-option] 1 warning generated. 1 warning generated. 1 warning generated. g++ -std=gnu++11 -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -Wl,-no_pie -o cc1obj \ objc/objc-lang.o objc/objc-act.o hash-table.o objc/objc-runtime-shared-support.o objc/objc-gnu-runtime-abi-01.o objc/objc-next-runtime-abi-01.o objc/objc-next-runtime-abi-02.o objc/objc-encoding.o objc/objc-map.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 i386-c.o winnt-c.o msformat-c.o cc1obj-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/libiberty.a ../libdecnumber/libdecnumber.a -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lisl -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lmpc -lmpfr -lgmp -L./../zlib -lz g++ -std=gnu++11 -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -Wl,-no_pie -o cc1plus \ cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.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/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.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 i386-c.o winnt-c.o winnt-cxx.o msformat-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a \ libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lisl -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lmpc -lmpfr -lgmp -L./../zlib -lz g++ -std=gnu++11 -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -Wl,-no_pie -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 i386-c.o winnt-c.o msformat-c.o \ 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/libiberty.a ../libdecnumber/libdecnumber.a -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lisl -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -L/Users/mhayden/plotter/toolchain/windows/version/5.15.8.arm64/mxe/usr/aarch64-apple-darwin22.3.0/lib -lmpc -lmpfr -lgmp -L./../zlib -lz clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] ld: warning: -no_pie is deprecated when targeting new OS versions ld: warning: -no_pie ignored for arm64 ld: warning: -no_pie is deprecated when targeting new OS versions ld: warning: -no_pie ignored for arm64 ld: warning: -no_pie is deprecated when targeting new OS versions ld: warning: -no_pie ignored for arm64 Undefined symbols for architecture arm64: "_host_hooks", referenced from: c_common_no_more_pch() in c-pch.o toplev::main(int, char**) in libbackend.a(toplev.o) gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) Undefined symbols for architecture arm64: "_host_hooks", referenced from: c_common_no_more_pch() in c-pch.o Undefined symbols for architecture arm64: toplev::main(int, char**) in libbackend.a(toplev.o) "_host_hooks", referenced from: gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) c_common_no_more_pch() in c-pch.o toplev::main(int, char**) in libbackend.a(toplev.o) gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [cc1] Error 1 ld: symbol(s) not found for architecture arm64 ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [cc1obj] Error 1 make[3]: *** [cc1plus] Error 1 make[3]: Target all' not remade because of errors.
rm gfortran.pod gcc.pod
make[2]: *** [all-gcc] Error 2
make[1]: *** [build-only-gcc_x86_64-w64-mingw32.shared] Error 2

real 5m19.496s
user 10m1.381s
sys 1m59.595s
`

@markghayden
Copy link
Author

Here is link to the gist for the error copy/pasted above.

[https://gist.github.com/markghayden/b69b1b08269b9a87d3138ce1a75916d3]

@tonytheodore
Copy link
Member

Make sure you are using gcc12:

make ... MXE_PLUGIN_DIRS=plugins/gcc12

@tonytheodore
Copy link
Member

gcc13 is also now available and building all four targets on aarch64-apple-darwin22.4.0. You can try either, but gcc11 definitely won't work.

Also, I'm seeing a lot of issues with Apple's make, I'd recommend you use gmake from macports (or homebrew). See #2910, you may be better off using a Linux VM.

@markghayden
Copy link
Author

Thanks! The MXE build got farther with gcc12 plugin but gcc had seg fault on building cairo (I'm trying to build qt5). Trying again with gcc13, it still crashes on cairo. See attached log.

cairo_x86_64-w64-mingw32.shared.zip

@tomsci
Copy link

tomsci commented Apr 8, 2023

Thanks for the info! I'd test it if not for the fact that zstd is trying to link against the x86 /usr/local/lib/liblz4.dylib (installed by my Rosetta Homebrew install) and not the arm version /opt/homebrew/lib/liblz4.dylib and I haven't figured out if there's any magic search path runes that avoid me having to nuke my Rosetta Homebrew install (again...). The darwin ld doesn't seem to support any magic environment variables to override its default search behaviour.

fwiw (and for anyone else searching for this) the error I get is:

ld: warning: ignoring file /usr/local/lib/liblzma.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/liblz4.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

Which totally makes sense and isn't MXE's fault, but I was hoping Homebrew would work given it's listed in the MXE requirements section. Maybe it's time to try MacPorts again, it seems like it might support building universal versions of packages rather than having two separate installs like Homebrew does. Really wish Homebrew supported universal builds.

@markghayden
Copy link
Author

markghayden commented Apr 8, 2023

I gave up Homebrew for Macports, largely because of the presence of universal builds. I can build MXE under Rosetta and (partially) native. I've attached a script used to install/update macports, which installs some ports as universal for the Rosetta build of MXE.

For Rosetta build of MXE, you need the following change to your Makefile

diff --git a/Makefile b/Makefile
index 3512e69a..95234cd0 100644
--- a/Makefile
+++ b/Makefile
@@ -739,7 +739,7 @@ else
     NONET_LIB := $(PREFIX)/$(BUILD)/lib/nonetwork.dylib
     PRELOAD   := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES='$(NONET_LIB
)' \
                  http_proxy=$(DUMMY_PROXY) https_proxy=$(DUMMY_PROXY)
-    NONET_CFLAGS := -arch $(shell uname -m)
+    NONET_CFLAGS := -arch $(shell uname -m) -arch arm64 -arch x86_64
 endif
 
 $(NONET_LIB): $(TOP_DIR)/tools/nonetwork.c | $(PREFIX)/$(BUILD)/lib/.gitkeep

I've attached a script to setup Macports with few required universal ports (and setting up a required link for py-mako). Also a script to build MXE with Rosetta using the arch command.

Hopefully this is helpful to other MXE users on MacOS with arm processors.

scripts.zip

@tomsci
Copy link

tomsci commented Apr 8, 2023

Thanks @markghayden I'll take a look at that. I got qt5 to build under rosetta with homebrew after making sure the gnu versions of make and libtool and python3->python were used (using the path aliases homebrew provides).

# Switch to x86 terminal, maybe not necessary
$ arch -x86_64 -d HOMEBREW_CELLAR -d HOMEBREW_PREFIX -d HOMEBREW_REPOSITORY bash --noprofile
$ eval "$(/usr/local/bin/brew shellenv)"

# Setup path
$ export PATH=/usr/local/opt/make/libexec/gnubin:/usr/local/opt/libtool/libexec/gnubin:/usr/local/opt/python@3.11/libexec/bin:$PATH

$ make qt5 -j 6

With only one modification needed - something was blowing up with DBUS in qttools so I had to disable that:

$ git diff
diff --git a/src/qtbase.mk b/src/qtbase.mk
index b0b0ce60..f303ab65 100644
--- a/src/qtbase.mk
+++ b/src/qtbase.mk
@@ -66,7 +66,7 @@ define $(PKG)_BUILD
             -system-harfbuzz \
             -system-pcre \
             -openssl-linked \
-            -dbus-linked \
+            -no-dbus \
             -no-pch \
             -v \
             $(PKG_CONFIGURE_OPTS)

@tonytheodore
Copy link
Member

@markghayden wrote:

but gcc had seg fault on building cairo

I can sometimes see the same, one log will have:

In file included from world-map.c:49:
world-map.h:103:1: internal compiler error: Segmentation fault: 11
  103 | N(443.617,107.095),l(-.065,-.035),l(-.435,-.156),l(-.017,-.15),l(-.501,-.485),l(-.848,-.3),l(-.033,-.021),l(.002,-.1),l(-.029,-.092),l(-.082,-.072),l(-.033,-.078),l(.022,-.089),l(-.005,-.004),l(.183,-.108),l(.09,-.089),l(-.045,-.101),l(-.078,-.089),l(-.066,-.112),l(-.012,-.044),l(-.011,-.145),l(-.012,-.112),l(.012,-.134),l(.101,-.089),l(.111,-.022),l(.134,-.011),l(.056,-.056),l(-.011,-.1),l(-.034,-.089),l(.112,-.101),l(.044,-.089),l(.045,-.101),l(.168,-.078),l(.122,-.056),l(.123,.011),l(.056,.044),l(.056,.089),l(.09,.056),l(.111,0),l(.056,-.101),l(-.056,-.101),l(-.123,-.167),l(-.089,-.1),l(-.012,-.078),l(.078,-.056),l(.112,-.033),l(.066,.044),l(.112,.022),l(.156,-.056),l(.056,.033),l(0,.101),l(.223,.056),l(.156,.101),l(.168,.078),l(.111,.111),l(.101,.146),l(.167,.134),l(.056,.033),l(.078,.022),l(.279,.078),l(.101,.056),l(.078,.011),l(.067,-.044),l(.066,.022),l(.078,.1),l(.123,.101),l(.033,.067),l(.078,.045),l(.111,-.022),l(.057,.044),l(.134,.045),l(.167,.067),l(.101,.101),l(.011,.089),l(-.089,.011),l(-.134,.022),l(-.09,.044),l(-.021,.067),l(-.057,.033),l(-.167,-.033),l(-.146,-.011),l(-.111,.033),l(-.022,.089),l(.056,.056),l(.101,0),l(.078,.067),l(0,.067),l(-.109,.286),l(-.361,-.022),l(-.727,-.11),l(-.273,.273),l(-.279,.515),l(.133,.427),l(-.002,.342),
      | ^
libbacktrace could not find executable to open

another (similar to yours):

x86_64-w64-mingw32.shared.gcc13-gcc: internal compiler error: Segmentation fault: 11 signal terminated program cc1

but I can't replicate it in a terminal or subsequent build.

@tomsci wrote:

if not for the fact that zstd is trying to link against the x86 /usr/local/lib/liblz4.dylib

The gcc12/13 plugins (and gcc10 for that matter) use the mxe zstd package, I'll add it to the default gcc11.

@tomsci
Copy link

tomsci commented Apr 9, 2023

The zstd problem still happens for me with gcc12/13, sorry if that wasn't clear. zstd seems to use the system lzma and lz4 libraries. And on my system the library search paths aren't picking up the aarch64 binaries which is largely homebrew's fault, combined with ld seeming to default to looking in /usr/local/lib which is where homebrew rosetta uses for convenience without having any way of overriding that with environment vars. Although I got past this before by nuking my Rosetta Homebrew install, so either something somewhere is figuring out to look in /opt/homebrew/lib or something builds lz4 if /usr/local/lib/liblz4.dylib doesn't exist? Minimal repro (same thing happens if I build qt5):

$ make zstd MXE_PLUGIN_DIRS=plugins/gcc13
...
Failed to build package zstd for target aarch64-apple-darwin22.4.0!

Logs attached: zstd_aarch64-apple-darwin22.4.0.zip

@tonytheodore
Copy link
Member

@tomsci wrote:

zstd seems to use the system lzma and lz4

I see, we can work around that in the short term by disabling any additional compression support in the native build as we only need the zstd library for gcc. Doesn't help with the underlying issues though.

I can confirm the qttools/dbus issue with gcc12 (static targets), doesn't happen with gcc11/13 - I'll test on x86 Ubuntu next.

@markghayden wrote:

I've attached a script to setup Macports with few required universal ports (and setting up a required link for py-mako). Also a script to build MXE with Rosetta using the arch command.

Nice! I gave up on Rosetta a while ago.

Also, literally nice. Seeing it in your script led me to running the shell like this:

sudo nice -n -10 su tonyt -c zsh

which is the first complete build of all four gcc targets I've seen on an arm64 Mac.

There are heisenbugs later on, but they are drastically reduced.

@tonytheodore
Copy link
Member

There are heisenbugs later on, but they are drastically reduced.

Spoke too soon, now I've got a completely blank screen with a moving mouse cursor - only remedy is to ssh in and "killall Dock".

I think I'll leave this alone for a while, I'm just chasing my tail on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants