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@13: add Modula 2 support #176192

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
class GccAT13 < Formula

Check warning on line 1 in Formula/g/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 14-x86_64

`brew linkage --cached --test --strict gcc@13` failed on macOS Sonoma (14)!

Files with missing rpath: /usr/local/Cellar/gcc@13/13.3.0_1/lib/gcc/13/libgcc_s.1.dylib

Check warning on line 1 in Formula/g/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 13-x86_64

`brew linkage --cached --test --strict gcc@13` failed on macOS Ventura (13)!

Files with missing rpath: /usr/local/Cellar/gcc@13/13.3.0_1/lib/gcc/13/libgcc_s.1.dylib

Check warning on line 1 in Formula/g/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 12-x86_64

`brew linkage --cached --test --strict gcc@13` failed on macOS Monterey (12)!

Files with missing rpath: /usr/local/Cellar/gcc@13/13.3.0_1/lib/gcc/13/libgcc_s.1.dylib
desc "GNU compiler collection"
homepage "https://gcc.gnu.org/"
url "https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz"
sha256 "0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083"
license "GPL-3.0-or-later" => { with: "GCC-exception-3.1" }
revision 1

livecheck do
url :stable
Expand All @@ -31,6 +32,8 @@
depends_on "mpfr"
depends_on "zstd"

uses_from_macos "flex" => :build
uses_from_macos "m4" => :build
uses_from_macos "zlib"

on_linux do
Expand All @@ -55,7 +58,7 @@
# - Ada and D, which require a pre-existing GCC to bootstrap
# - Go, currently not supported on macOS
# - BRIG
languages = %w[c c++ objc obj-c++ fortran]
languages = %w[c c++ objc obj-c++ fortran m2]

pkgversion = "Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip

Expand Down Expand Up @@ -120,7 +123,8 @@
# To make sure GCC does not record cellar paths, we configure it with
# opt_prefix as the prefix. Then we use DESTDIR to install into a
# temporary location, then move into the cellar path.
system "make", install_target, "DESTDIR=#{Pathname.pwd}/../instdir"
# Deparallelize for modula 2 as make install will block indefinitely.
ENV.deparallelize { system "make", install_target, "DESTDIR=#{Pathname.pwd}/../instdir" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been reported upstream?

Copy link
Author

@schaecsn schaecsn Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is pstree when make install is parallelized

 | | \-+= 84054 schaecsn -bash
 | |   \-+= 17854 schaecsn /opt/homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby -W1 --disable=gems,rubyopt /opt/homebrew/Library/Homebrew/brew.rb install --build-from-source gcc
 | |     \-+- 18140 schaecsn /opt/homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby -W1 --disable=gems,rubyopt /opt/homebrew/Library/Homebrew/brew.rb install --build-from-source gcc
 | |       \-+= 18141 schaecsn /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/bin/ruby -W1 --disable=gems,rubyopt -- /opt/homebrew/Library/Homebrew/build.rb /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/g/gcc.rb
 | |         \-+- 05633 schaecsn /Library/Developer/CommandLineTools/usr/bin/make install DESTDIR=/private/tmp/gcc-20240703-18141-wmii4g/gcc-14.1.0/build/../instdir
 | |           \-+- 05655 schaecsn /bin/sh -c r=`${PWDCMD-pwd}`; export r; s=`cd ..; ${PWDCMD-pwd}`; export s; /Library/Developer/CommandLineTools/usr/bin/make "DESTDIR=/private/tmp/gcc-20240703-18141-wmii4g/gcc-14.1.0/build/../instdir" "RPAT
 | |             \-+- 05667 schaecsn /Library/Developer/CommandLineTools/usr/bin/make DESTDIR=/private/tmp/gcc-20240703-18141-wmii4g/gcc-14.1.0/build/../instdir RPATH_ENVVAR=DYLD_LIBRARY_PATH TARGET_SUBDIR=aarch64-apple-darwin23 bindir=/opt/h
 | |               \-+- 06235 schaecsn /bin/sh -c r=`${PWDCMD-pwd}`; export r; s=`cd ..; ${PWDCMD-pwd}`; export s; FLEX="flex"; export FLEX; LEX="flex"; export LEX; BISON="bison"; export BISON; YACC="bison -y"; export YACC; M4="gm4"; export M
 | |                 \-+- 06296 schaecsn /bin/sh -c r=`${PWDCMD-pwd}`; export r; s=`cd ..; ${PWDCMD-pwd}`; export s; FLEX="flex"; export FLEX; LEX="flex"; export LEX; BISON="bison"; export BISON; YACC="bison -y"; export YACC; M4="gm4"; export
 | |                   \--- 06362 schaecsn /Library/Developer/CommandLineTools/usr/bin/make DESTDIR=/private/tmp/gcc-20240703-18141-wmii4g/gcc-14.1.0/build/../instdir RPATH_ENVVAR=DYLD_LIBRARY_PATH TARGET_SUBDIR=aarch64-apple-darwin23 bindir=

The call to make is stuck (the pid 06362 does not change over hours) and there is no progress reported in ~/Library/Logs/Homebrew/gcc/03.make. The probem is the ancient make 3.81 in /Library/Developer/CommandLineTools/usr/bin/make. Replacing it with the modern make from Homebrew makes make install run to completion.

It's difficult to know which upstream to blame: gcc lists make 3.80 as a minimal dependency. Are they to blame? There are lots of custom Makefile changes in the applied patch https://raw.githubusercontent.com/Homebrew/formula-patches/bda0faddfbfb392e7b9c9101056b2c5ab2500508/gcc/gcc-13.3.0.diff - is it to blame for requiring a more recent make? My guess is Homebrew setting quite a few enviroment variables. Are they to blame for requiring a more recent make?

mv Dir[Pathname.pwd/"../instdir/#{opt_prefix}/*"], prefix
end

Expand Down Expand Up @@ -263,5 +267,18 @@
EOS
system "#{bin}/gfortran-#{version.major}", "-o", "test", "test.f90"
assert_equal "Done\n", shell_output("./test")

(testpath/"hello.mod").write <<~EOS
MODULE hello;

FROM InOut IMPORT WriteString, WriteLn;

BEGIN
WriteString("Hello, world!");
WriteLn;
END hello.
EOS
system "#{bin}/gm2-#{version.major}", "-o", "hello-m2", "hello.mod"
assert_equal "Hello, world!\n", shell_output("./hello-m2")
end
end
Loading