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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

schaecsn
Copy link

@schaecsn schaecsn commented Jul 2, 2024

Enable support for Modula 2 and add a test case.

Deparallelization of 'make install' is necessary, at least under macOS, otherwise the make command is stuck for reasons unknown.

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

@github-actions github-actions bot added legacy Relates to a versioned @ formula long build Set a long timeout for formula testing long dependent tests Set a long timeout for dependent testing labels Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request.

@fxcoudert
Copy link
Member

Hi, I don't think we want to add features to versioned (legacy) formulas. How about adding it to the main GCC formula?

@schaecsn
Copy link
Author

schaecsn commented Jul 3, 2024

Hi, I don't think we want to add features to versioned (legacy) formulas. How about adding it to the main GCC formula?

Modula 2 came in with gcc 13. I wanted to enable it in both, gcc 13 and 14. I happened to raise a PR for gcc 13 first.

I'm going to raise a PR for gcc 14 soon.

@@ -120,7 +122,8 @@ def install
# 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?

@schaecsn schaecsn force-pushed the gcc13-modula2 branch 2 times, most recently from e9eed7b to 4be0753 Compare July 4, 2024 06:31
@schaecsn
Copy link
Author

schaecsn commented Jul 4, 2024

The docker instructions on https://github.com/Homebrew/homebrew-core/blob/HEAD/CONTRIBUTING.md#homebrew-docker-container created a docker image with only 4 GB of memory where my brew of gcc@13 runs out of memory. I don't know why the CI docker image on github does not run out of memory.

What made linux CI pass was

  on_linux do
    ...
    depends_on "flex"
  end

flex should be just a build-time dependency and declaring it as such

  on_linux do
    depends_on "flex" => :build
  end

makes the build fail in configure with

  checking for suffix of executables... flex: fatal internal error, exec of /tmp/gccA13-20240704-6531-uaccr6/gcc-13.3.0/missing m4 failed

Why do I need all in a sudden m4 as a build-time dependency? Let me try that next ...

@schaecsn schaecsn force-pushed the gcc13-modula2 branch 2 times, most recently from 6928ee8 to 121d31a Compare July 4, 2024 09:53
Enable support for Modula 2 and add a test case.

Signed-off-by: Stefan Schaeckeler <[email protected]>
@schaecsn
Copy link
Author

schaecsn commented Jul 4, 2024

Without an explicit dependency on m4, I see it getting fetched on the failed linux CI run

==> Determining dependencies...
==> brew fetch --formulae --retry autoconf automake berkeley-db@5 binutils bison bzip2 ca-certificates cmake expat flex gdbm gettext gmp gpatch help2man icu4c isl krb5 libedit libffi libmpc libnsl libtirpc libtool libxcrypt libxml2 lz4 lzip m4 mpdecimal mpfr ncurses openssl@3 perl pkg-config python-setuptools [email protected] [email protected] readline sqlite unzip xz zlib zstd

but not really installed, at least the gcc configure phase does not find it

  checking for gm4... no
  checking for gnum4... no
  checking for m4... no

When adding m4 as a build dependency, linux CI succeeds. Anyway, I have now these two build dependencies and linux CI is happy

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy Relates to a versioned @ formula long build Set a long timeout for formula testing long dependent tests Set a long timeout for dependent testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants