Skip to content

gcc14 14.2.0 #1286

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

gcc14 14.2.0 #1286

wants to merge 16 commits into from

Conversation

mistydemeo
Copy link
Owner

Getting there, but not quite building yet. Fails after about 60-90 minutes.

/usr/local/bin/g++-8 -std=c++11 -no-pie   -g -mdynamic-no-pic -DIN_GCC    -fno-exceptions -fno-rtti -fasynchro
nous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute
-Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-s
trings   -DHAVE_CONFIG_H -no-pie -static-libstdc++ -static-libgcc -L/usr/local/opt/ld64/lib -L/usr/local/lib -
F/usr/local/Frameworks -Wl,-headerpad_max_install_names -B/usr/local/Cellar/ld64/97.17_2/bin/ -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/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/d
ecl2.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/man
gle.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 c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-fami
ly/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 ../libcody/libcody.a  \
        libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a  -L/usr/local/opt/isl/lib -lisl -L/usr/local/opt/gmp/lib -L/usr/local/opt/mpfr/
lib -L/usr/local/opt/libmpc/lib -lmpc -lmpfr -lgmp   -lz
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recomp
ile without -mlong-branch: /usr/lib/crt1.o
ld: warning: can't add line info to anonymous symbol std::logic_error::logic_error(std::basic_string<char, std
::char_traits<char>, std::allocator<char> > const&) [clone .lsda] from /usr/local/Cellar/gcc/8.5.0/lib/gcc/8/g
cc/powerpc-apple-darwin8.11.0/8.5.0/../../../libstdc++.a(stdexcept.o)
Undefined symbols:
  "_crc32_combine", referenced from:
      (anonymous namespace)::bytes_out::set_crc(unsigned int*) in module.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status

Full logs: https://gist.github.com/mistydemeo/7bc051e52a0750467f71b20449a7e9e8

refs #1201

@sevan
Copy link
Collaborator

sevan commented Feb 16, 2025

Hmm, need to add zlib as a dependency?

/*
ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);

     Combine two CRC-32 check values into one.  For two sequences of bytes,
   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were 
   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
   len2. len2 must be non-negative.
*/

@mistydemeo
Copy link
Owner Author

Good catch! Does look like that's in the Macports portfile as a dependency, and I'd missed it.

@mistydemeo mistydemeo force-pushed the gcc-14 branch 3 times, most recently from 1b6911d to 236e8d8 Compare February 16, 2025 03:05
@mistydemeo
Copy link
Owner Author

Looks like both Macports and Homebrew build with zstd, but I'm going to omit that for now if we can get away with it just because the build is a little irritating.

@mistydemeo
Copy link
Owner Author

mistydemeo commented Feb 16, 2025

Looks like it failed after ~11 hours, oof. Somehow, it looks like it forgot about the zlib flags that it used in the previous stages, and dropped them in the final stage build.

/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/./prev-gcc/xg++ -B/private/tmp/gcc1420250215-6716-1bl
erp0/gcc-14.2.0/build/./prev-gcc/ -B/usr/local/Cellar/gcc14/14.2.0/powerpc-apple-darwin8.11.0/bin/ -nostdinc++
 -B/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-powerpc-apple-darwin8.11.0/libstdc++-v3/src/.
libs -B/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-powerpc-apple-darwin8.11.0/libstdc++-v3/l
ibsupc++/.libs  -I/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-powerpc-apple-darwin8.11.0/lib
stdc++-v3/include/powerpc-apple-darwin8.11.0  -I/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-
powerpc-apple-darwin8.11.0/libstdc++-v3/include  -I/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/libstdc+
+-v3/libsupc++ -L/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-powerpc-apple-darwin8.11.0/libs
tdc++-v3/src/.libs -L/private/tmp/gcc1420250215-6716-1blerp0/gcc-14.2.0/build/prev-powerpc-apple-darwin8.11.0/
libstdc++-v3/libsupc++/.libs -no-pie   -g -O2 -mdynamic-no-pic -fno-checking -gtoggle -DIN_GCC    -fno-excepti
ons -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-forma
t-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
overlength-strings   -DHAVE_CONFIG_H -no-pie -static-libstdc++ -static-libgcc  -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/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/d
ecl2.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/man
gle.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 c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-fami
ly/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 ../libcody/libcody.a  \
        libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a  -L/usr/local/opt/isl/lib -lisl -L/usr/local/opt/gmp/lib -L/usr/local/opt/mpfr/
lib -L/usr/local/opt/libmpc/lib -lmpc -lmpfr -lgmp   -lz
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recomp
ile without -mlong-branch: /usr/lib/crt1.o
Undefined symbols:
  "_crc32_combine", referenced from:
      __ZN12_GLOBAL__N_19bytes_out3endEP7elf_outjPj.isra.0 in module.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status

https://gist.github.com/mistydemeo/13729f459fa583e4b7205945cc8ccef6

@mistydemeo
Copy link
Owner Author

I'll just turn off the Tigerbrew-provided zlib here and let it build its own.

@sevan
Copy link
Collaborator

sevan commented Feb 16, 2025

Looks like both Macports and Homebrew build with zstd, but I'm going to omit that for now if we can get away with it just because the build is a little irritating.

I suspect this might be superfluous in our case since zstd support in GCC is for LTO & we're not building with LTO enabled. The other use is for compressed debug info in generated binaries, but we have nothing which supports zstd (ld64/cctools/gdb).

@sevan
Copy link
Collaborator

sevan commented Feb 16, 2025

Looks like it failed after ~11 hours, oof. Somehow, it looks like it forgot about the zlib flags that it used in the previous stages, and dropped them in the final stage build.

oof indeed :D
Is it worth just starting off with C & C++ language support for a quicker turnaround before enabling all the other languages, once you have a successful build?

@mistydemeo
Copy link
Owner Author

Hm, telling it to use its own zlib didn't work either. It still seems to have prioritized picking up the system zlib despite the -L flag.

/usr/local/bin/g++-8 -std=c++11 -no-pie   -g -mdynamic-no-pic -DIN_GCC    -fno-exceptions -fno-rtti -fasynchro
nous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute
-Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-s
trings   -DHAVE_CONFIG_H -no-pie -static-libstdc++ -static-libgcc -L/usr/local/opt/ld64/lib -L/usr/local/lib -
F/usr/local/Frameworks -Wl,-headerpad_max_install_names -B/usr/local/Cellar/ld64/97.17_2/bin/ -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/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/d
ecl2.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/man
gle.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 c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-fami
ly/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 ../libcody/libcody.a  \
        libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a  -L/usr/local/opt/isl/lib -lisl -L/usr/local/opt/gmp/lib -L/usr/local/opt/mpfr/
lib -L/usr/local/opt/libmpc/lib -lmpc -lmpfr -lgmp   -L./../zlib -lz
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recomp
ile without -mlong-branch: /usr/lib/crt1.o
ld: warning: can't add line info to anonymous symbol std::logic_error::logic_error(std::basic_string<char, std
::char_traits<char>, std::allocator<char> > const&) [clone .lsda] from /usr/local/Cellar/gcc/8.5.0/lib/gcc/8/g
cc/powerpc-apple-darwin8.11.0/8.5.0/../../../libstdc++.a(stdexcept.o)
Undefined symbols:
  "_crc32_combine", referenced from:
      (anonymous namespace)::bytes_out::set_crc(unsigned int*) in module.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
make[3]: *** [cc1plus] Error 1
make[3]: *** Waiting for unfinished jobs....
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recomp
ile without -mlong-branch: /usr/lib/crt1.o
ld: warning: can't add line info to anonymous symbol std::logic_error::logic_error(std::basic_string<char, std
::char_traits<char>, std::allocator<char> > const&) [clone .lsda] from /usr/local/Cellar/gcc/8.5.0/lib/gcc/8/g
cc/powerpc-apple-darwin8.11.0/8.5.0/../../../libstdc++.a(stdexcept.o)
rm gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

@mistydemeo
Copy link
Owner Author

Is it worth just starting off with C & C++ language support for a quicker turnaround before enabling all the other languages, once you have a successful build?

Haha, might be worth it! What's broken here is used in C/C++.

It looks like zlib support is for compressed debug sections. I suppose we could turn those off for now, even if that's not quite ideal. Better than it not building at all!

@sevan
Copy link
Collaborator

sevan commented Feb 16, 2025

Found the changelog entry for when the use of crc32_combine() was introduced in gcc/cp/ChangeLog

2024-02-13  Patrick Palka  <[email protected]>

        * Make-lang.in (CFLAGS-cp/module.o): Add $(ZLIBINC).
        * module.cc: Include <zlib.h>.
        (bytes::calc_crc): Use crc32 from zlib.
        (bytes_out::set_crc): Use crc32_combine from zlib.

and the commit to head

@sevan
Copy link
Collaborator

sevan commented Feb 16, 2025

I reduced the language list to C & C++, added depends_on "zilb" + --with-system-zlib back, and removed --enable-checking=release.
Builds are currently in progress on Tiger (G5/i386).
The iMac G5 hasn't even built xgcc yet while the c2d mac mini is on stage_final. 🤣

@mistydemeo
Copy link
Owner Author

If we can't work around the build flag issue, and the system zlib has crc32_unsigned, I suppose we could revert that patch as a last resort.

@sevan
Copy link
Collaborator

sevan commented Feb 17, 2025

If we can't work around the build flag issue, and the system zlib has crc32_unsigned, I suppose we could revert that patch as a last resort.

Yes.
I found this change upstream which I'm trying now (previous attempt didn't work).
This needs to part of ZLIBINC so it applies to CFLAGS as per changelog entry?

@sevan
Copy link
Collaborator

sevan commented Feb 17, 2025

If we can't work around the build flag issue, and the system zlib has crc32_unsigned, I suppose we could revert that patch as a last resort.

Yes. I found this change upstream which I'm trying now (previous attempt didn't work). This needs to part of ZLIBINC so it applies to CFLAGS as per changelog entry?

With the upstream change, after 292 minutes, on Tiger/i386:

Using built-in specs.
COLLECT_GCC=bin/gcc-14
COLLECT_LTO_WRAPPER=/Users/sme/tigerbrew/Cellar/gcc14/14.2.0/libexec/gcc/i686-apple-darwin8.11.1/14.2.0/lto-wrapper
Target: i686-apple-darwin8.11.1
Configured with: ../configure --build=i686-apple-darwin8.11.1 --prefix=/Users/sme/tigerbrew/Cellar/gcc14/14.2.0 --libdir=/Users/sme/tigerbrew/Cellar/gcc14/14.2.0/lib/gcc/14 --enable-languages=c,c++ --program-suffix=-14 --with-gmp=/Users/sme/tigerbrew/opt/gmp --with-mpfr=/Users/sme/tigerbrew/opt/mpfr --with-mpc=/Users/sme/tigerbrew/opt/libmpc --with-isl=/Users/sme/tigerbrew/opt/isl --with-system-zlib --with-pkgversion='Tigerbrew gcc14 14.2.0' --with-bugurl=https://github.com/mistydemeo/tigerbrew/issues --with-dwarf2 --disable-nls --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.2.0 (Tigerbrew gcc14 14.2.0) 

Now to see if the change can be dropped & ZLIBINC used instead.

@sevan
Copy link
Collaborator

sevan commented Feb 17, 2025

Now to see if the change can be dropped & ZLIBINC used instead.

bleh, no.

Undefined symbols:
  "_crc32_combine", referenced from:
      __ZN12_GLOBAL__N_19bytes_out3endEP7elf_outjPj.isra.0 in module.o
ld: symbol(s) not found

@mistydemeo
Copy link
Owner Author

That's too bad. :/ Did you edit both ZLIBINC and ZLIB, or just the former?

@sevan
Copy link
Collaborator

sevan commented Feb 17, 2025

Just the former, added "ZLIBINC=-Lbla -Ibla" to the args block.

@mistydemeo
Copy link
Owner Author

mistydemeo commented Feb 17, 2025

Might need to do both; ZLIBINC is only added to CFLAGS, while ZLIB is where it puts both the -L flags and the -lz statement.

(If worse comes to worst, I guess we could just replace the -lz with an absolute path to the Tigerbrew zlib... but I'd like to avoid something that clunky.)

@sevan
Copy link
Collaborator

sevan commented Feb 17, 2025

I'll give it a go.

@mistydemeo
Copy link
Owner Author

A person on Mastodon mentioned to me why we had the issue with the builtin zlib. OS X's ld prioritizes shared libraries; it searches all paths for a shared library first, then searches those same paths for a static library. Even if a directory containing a static library is first in the path, it'll pick a dynamic library later in the path over it. In our case, GCC's builtin zlib is a static library.

@mistydemeo mistydemeo force-pushed the gcc-14 branch 2 times, most recently from b8d7cd0 to 2c39da2 Compare February 17, 2025 21:02
@sevan
Copy link
Collaborator

sevan commented Feb 21, 2025

Built GCC 14 with isl 0.27 on Tiger/i386 in 320 minutes with GCC 8 (2Ghz c2d mac mini)
Built GCC 14 with isl 0.27 on Tiger/i386 in 319 minutes with GCC 4.8 (2Ghz c2d mac mini)
Built GCC 14 with isl 0.27, without "--enable-checking=release" specified on Tiger/i386 in 365 minutes with GCC 4.8 (2Ghz c2d mac mini)
Built on Tiger/powerpc in 1904 minutes with GCC 4.8 (1.33Ghz PowerBook G4)
Built on Tiger/powerpc in 1627 minutes with GCC 5 (1st gen 1.8Ghz iMac G5)
Built on Leopard/powerpc in 912 minutes with GCC 5 (same hardware as Tiger build - 1st gen 1.8Ghz iMac G5)
Built on Leopard/i386 in 347 minutes with GCC 5 (mid-2009 air)
Built on Snow Leopard in 572 minutes with GCC 8 (same hardware as Leopard build - mid-2009 air, it built gcc8 in 189 minutes before moving on to gcc formula)
Built on Lion in 230 minutes with GCC 5 (late 2009 white macbook, built gcc5 in 89 minutes)
Built on Mountain Lion in 236 minutes with GCC 5 (same hardware as Lion build - late 2009 white macbook, built gcc 5 in 92 minutes)
Built on Mavericks in 231 minutes with clang from command line tools (same hardware as Lion build - late 2009 white macbook)
Built on Yosemite in 238 minutes with clang from command line tools (same hardware as Lion build - late 2009 white macbook)
Built on El Capitan in 382 minutes with clang from command line tools (same hardware as Leopard build - mid-2009 air)

@sevan
Copy link
Collaborator

sevan commented Feb 21, 2025

My understanding is GCC 14 can't build with GCC 4.2; we're always going to have to bootstrap it from another Tigerbrew-supplied GCC.

Got it, so it'll do the right thing currently or a specific dependency needs to be added? (Just thinking out loud, I will test the scenario out. Not trying to create work for you)

Ok, so I removed all copies of GCC from my tigerbrew install and all direct dependencies as well (gmp, mpfr, isl), cleaned up the tree, applied the patch from the pull request, and issued brew install gcc.
It went through and built gmp, mpfr, isl, using GCC 4.0.1 without issue, then it got to instaling GCC 14 itself and errored with:

==> Installing gcc
Error: gcc cannot be built with any available compilers.
To install this formula, you may need to either:
  brew install apple-gcc42
or:
  brew install gcc

So I install apple-gcc42, and am stuck.
With apple-gcc42 installed, brew install gcc8 gcc sets things in motion.

@sevan
Copy link
Collaborator

sevan commented Feb 21, 2025

Need to pass am_cv_pathless_PYTHON=none to configure to turn off Python support, broken test is then skipped. I also found that isl itself does host detection and sets optimisation flags accordingly so we double up on different -mtune settings (only one is used, but still)

It should be safe to turn off Python support, it installs a Python script for debugging isl (Cellar/isl/0.27/share/gdb/auto-load/libisl.23.dylib-gdb.py) but it requires GDB built with Python support (script imports the Python gdb module), neither of which we have, nor does the version of GDB included in Tiger - haven't checked GDB shipped in newer OS versions).

@sevan
Copy link
Collaborator

sevan commented Feb 21, 2025

So I install apple-gcc42, and am stuck.
With apple-gcc42 installed, brew install gcc8 gcc sets things in motion.

Since all the previous versions of GCC that were packaged could build off apple-gcc42 it wasn't an issue to upgrade in the past but in this case if you installed GCC 8.5 using the gcc formula, rather than gcc8 it doesn't seem like you can upgrade, because as part of the upgrade process the previous version gets unlinked and things fail at the configure stage since gcc-8 is not found.
I'm hitting this issue on Leopard/i386.
Luckily I've got GCC 5.5 installed on this Leopard/i386 installed so I uninstalled gcc formula as GCC 8 and now installing it again as GCC 14, to move forward.

@mistydemeo
Copy link
Owner Author

Success!!

/usr/local/Cellar/gcc/14.2.0: 1517 files, 274M, built in 1233.5 minutes

@mistydemeo
Copy link
Owner Author

brew test is succeeding. I'm bottling and uploading the bottle now; we can do a few more tests, then get this branch merged.

@mistydemeo
Copy link
Owner Author

I did a bit of testing building things that we already knew didn't work with the system compilers - gnupg2, avrdude, and fswatch. All building fine, and seem to work well as well. I think we're probably good to merge this. How're you feeling?

@sevan
Copy link
Collaborator

sevan commented Feb 22, 2025

I forgot to run brew test gcc once the Leopard build completed & I'm currently waiting for the Snow Leopard build to finish but no objection if you want to merge it. I'm doing all the x86 builds first as they're quicker before I move on to PowerPC. The brew test worked on Tiger/i386.
Just one point to sync up on, we're expecting the upgrade from gcc to be broken for those that are building themselves right? (you need to uninstall gcc, install a version specific formula (gcc5 and up), then install gcc?)

@sevan
Copy link
Collaborator

sevan commented Feb 22, 2025

I also found that isl itself does host detection and sets optimisation flags accordingly so we double up on different -mtune settings (only one is used, but still)

This is on the x86 builds where you'll get -O3 -mtune=pentium-mobile from the isl build infra & Tigerbrew adds -Os -mtune=penryn. On PowerPC the isl build infra just uses -O1.

@mistydemeo
Copy link
Owner Author

Unfortunately, yeah, I don't think there's a clean path to brew upgrade from gcc to gcc. :/ Building from source will have to involve a side quest to gcc8.

@sevan
Copy link
Collaborator

sevan commented Feb 22, 2025

Ok, no worries, just so when people raise issues, know what to say or if they find this PR. :)

@sevan
Copy link
Collaborator

sevan commented Feb 23, 2025

Looks like clang on Lion, Mountain Lion and their C++ library are insufficient. Need guarding off.

In file included from ../../libcody/internal.hh:5:
../../libcody/cody.hh:260:20: error: no member named 'move' in namespace 'std'
    : string (std::move (s)), cat (STRING), code (c)
              ~~~~~^
../../libcody/cody.hh:268:20: error: no member named 'move' in namespace 'std'
    : vector (std::move (v)), cat (VECTOR), code (c)
              ~~~~~^
../../libcody/cody.hh:277:18: error: no member named 'move' in namespace 'std'
    Create (std::move (t));
            ~~~~~^
../../libcody/cody.hh:282:18: error: no member named 'move' in namespace 'std'
    Create (std::move (t));
            ~~~~~^
../../libcody/buffer.cc:268:11: error: no member named 'emplace_back' in 'std::vector<std::basic_string<char>,
      std::allocator<std::basic_string<char>>>'
          result.emplace_back ();
          ~~~~~~ ^
../../libcody/buffer.cc:288:12: error: no member named 'emplace_back' in 'std::vector<std::basic_string<char>,
      std::allocator<std::basic_string<char>>>'
                  result.emplace_back (&buffer[lastBol],
                  ~~~~~~ ^
6 errors generated.

clang -v

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

Same on Mountain Lion:

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

@sevan
Copy link
Collaborator

sevan commented Feb 24, 2025

Looks like we need to start with GCC 5 at a minimum (5.4 to be exact, but we have 5.5).
https://gcc.gnu.org/install/prerequisites.html

This likely applies to the next major release, in gcc-14.2.0/INSTALL/prerequisites.html (extracted source archive) it states:

ISO C++11 compiler
Necessary to bootstrap GCC.  GCC 4.8.3 or newer has sufficient
support for used C++11 features, with earlier GCC versions you
might run into implementation bugs.

Versions of GCC prior to 11 also allow bootstrapping with an ISO C++98
compiler, versions of GCC prior to 4.8 also allow bootstrapping with a
ISO C89 compiler, and versions of GCC prior to 3.4 also allow
bootstrapping with a traditional (K&R) C compiler.

@sevan
Copy link
Collaborator

sevan commented Feb 25, 2025

gcc48 with some changes which are not yet comitted built in 72 minutes on Tiger/i386 with a 2Ghz c2d mac mini using GCC 4.0.1.
Now it's building GCC 14 with GCC 4.8.
1.33Ghz PowerBook G4 running Tiger built GCC 4.8 in 462 minutes.
1st gen 1.8Ghz iMac G5 built GCC 4.8 in 401 minutes.

@mistydemeo
Copy link
Owner Author

Excellent! Good thought on testing the absolute compatibility floor. Took some changes to get gcc48 working?

@sevan
Copy link
Collaborator

sevan commented Feb 25, 2025

Nothing hefty or controversial, switched back to default options, turned off optimisation, and updated its dependencies.
Will raise a pull request once I've tested it builds across the board.

@sevan
Copy link
Collaborator

sevan commented Feb 26, 2025

Since we're building GCC itself without optimisation, I wonder if we can spare everyone's hardware by providing a generic package which can be installed on G3/G4/G5s. I think that would spare everyone's aging G3 & G4s (my poor PowerBook).
GCC's dependencies (gmp/mpfr/isl/cloog) are not hefty and don't take long to compile (10s of minutes max) but GCC itself is only going to take longer and longer to bake.
If you think it could work, would it be possible try putting something up on archive.org as a test & we can try installing them and building a bunch of stuff to see if it works?

@sevan
Copy link
Collaborator

sevan commented Feb 26, 2025

All OS releases have now been tested.
For Tiger there's just the build on a G3 to do which I suspect will take a couple of days (rip ibook)

@sevan
Copy link
Collaborator

sevan commented Feb 27, 2025

GCC 4.9 built on a PowerBook G4 running Tiger in 481 minutes using GCC 4.0.1.
I'll skip the rebuilds of GCC 14 with it, but for sure, this is a first, as 4.8 & 4.9 did not build for me the last time I tried, quite some time ago, so I settled on GCC 5 and brought that up to date (v5.5)

@sevan
Copy link
Collaborator

sevan commented Apr 25, 2025

Is there anything further that we need to check / test?

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

Successfully merging this pull request may close these issues.

3 participants