d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.32k stars 182 forks source link

[Build Failure]: autom4te: error: /usr/bin/gm4 failed with exit status: 1 #728

Closed elondres-mim closed 1 day ago

elondres-mim commented 5 days ago

Version

emacs-plus@30

Make sure to follow these steps before submitting the issue

What happened?

$ brew install emacs-plus@30
Command output

==> ./autogen.sh
Last 15 lines from /Users/user/Library/Logs/Homebrew/emacs-plus@30/01.autogen.sh:
2024-09-12 14:47:04 +0000

./autogen.sh

Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Building aclocal.m4 ...
Running 'autoreconf -fi -I m4' ...
/Library/Developer/CommandLineTools/usr/bin/gm4: unrecognized option `--gnu'
Try `/Library/Developer/CommandLineTools/usr/bin/gm4 --help' for more information.
autom4te: error: /usr/bin/gm4 failed with exit status: 1
autoreconf: error: /usr/local/Cellar/autoconf/2.72/bin/autoconf failed with exit status: 1

  

  

brew doctor output

lots of stuff about one other package (wkhtmltox) but that's it

brew config output

HOMEBREW_VERSION: 4.3.21-2-g9042eb9
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9042eb9347bffe84d4bbc9e74518b89392ef2c23
Last commit: 4 hours ago
Core tap JSON: 12 Sep 14:42 UTC
Core cask tap JSON: 12 Sep 14:42 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.ewSdmR7YXP/org.macports:0
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 16
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: 16-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.46.0 => /usr/local/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.6.1-x86_64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4

Any extra information

This was originally an upgrade, it worked before the latest update on my system.

crispywalrus commented 5 days ago

This is happening to me as well. I notice that the formula is trying to use /Library/Developer/CommandLineTools/usr/bin/gm4 rather than the homebrew m4 (/opt/homebrew/opt/m4/bin/m4) In addition to this I also have the system default /usr/bin/m4. Of those three versions only the homebrew version supports the --gnu flag. Not sure how to fix this to get to the correct m4 instance. neither brew link nor path changes seem to do what's needed

psadi commented 5 days ago

Im getting the same error when tying to install the stable version to gnu-emacs (29)

==> Installing d12frosted/emacs-plus/emacs-plus@29 --with-native-comp
==> Patching
==> Applying fix-window-role.patch
patching file 'src/nsterm.m'
==> Applying system-appearance.patch
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.m'
==> Applying round-undecorated-frame.patch
patching file 'src/frame.c'
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.h'
patching file 'src/nsterm.m'
==> ./autogen.sh
Last 15 lines from /Users/adithyaps/Library/Logs/Homebrew/emacs-plus@29/01.autogen.sh:
2024-09-12 19:14:07 +0000

./autogen.sh

Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Running 'autoreconf -fi -I m4' ...
/Library/Developer/CommandLineTools/usr/bin/gm4: unrecognized option `--gnu'
Try `/Library/Developer/CommandLineTools/usr/bin/gm4 --help' for more information.
autom4te: error: /usr/bin/gm4 failed with exit status: 1
autoreconf: error: /usr/local/Cellar/autoconf/2.72/bin/autoconf failed with exit status: 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/d12frosted/homebrew-emacs-plus/issues
psadi commented 5 days ago

comment from @d12frosted: ⚠️ do not use it as a workaround as you might mess your environment; the formula just lacked a dependency; the issue was resolved, so now you just need to brew update and give it another try


Manually removing gm4 from /Library/Developer/CommandLineTools/usr/bin/ path and symlinking it with the homebrew version as gm4 and m4 seems to progress further. Im not sure if this is recommended. I will undo the changes upon installation.

❯ ll /Library/Developer/CommandLineTools/usr/bin/ | rg m4
lrwxr-xr-x@    - root 13 Sep 00:52  gm4 -> /usr/local/opt/m4/bin/m4
lrwxr-xr-x@    - root 13 Sep 00:52  m4 -> /usr/local/opt/m4/bin/m4
nickdex commented 4 days ago

I ran into the same problem on M2 Air. @psadi 's solution worked for me.

elondres-mim commented 1 day ago

I can also confirm that doing what psadi suggested worked for me.

d12frosted commented 1 day ago

Can someone try by adding m4 to the list of dependencies? Something like this:

https://github.com/d12frosted/homebrew-emacs-plus/blob/c814e799b4d3491eb375d01af6cfba4fb8cca2a6/Formula/emacs-plus%4031.rb#L40

d12frosted commented 1 day ago

And also please avoid removing anything manually. You might break other things on your system. I mean - it's up to you, but this can't be a recommendation.

pauldub commented 1 day ago

Can someone try by adding m4 to the list of dependencies? Something like this:

https://github.com/d12frosted/homebrew-emacs-plus/blob/c814e799b4d3491eb375d01af6cfba4fb8cca2a6/Formula/emacs-plus%4031.rb#L40

This works as expected.

d12frosted commented 1 day ago

@pauldub thanks, will add it to deps for Emacs 30 and Emacs 31.

I don't know why (maybe I am on the old OS), but I could not reproduce the issue hence needed some help πŸ™

d12frosted commented 1 day ago

Done via 3855ebb1ec34c9c45f26c1dffe9981ec0efc99e6 and 5c03f0aefe58265a115613e63c7c8aef0696eef2.

Now you can do brew update and give it another try.

dustinfarris commented 16 hours ago

@d12frosted Can this be added to Emacs 29 as well?

d12frosted commented 16 hours ago

Yes! Send a PR if you want to get it now and not in ~12 hours πŸ™

dustinfarris commented 16 hours ago

Yes! Send a PR if you want to get it now and not in ~12 hours πŸ™

730 😁

d12frosted commented 16 hours ago

Thanks! Merged.