d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.24k stars 175 forks source link

[Build Failure]: cp: invalid option #688

Closed 5183nischal closed 1 week ago

5183nischal commented 3 weeks ago

Version

emacs-plus@30

Make sure to follow these steps before submitting the issue

What happened?

$ brew install emacs-plus@30
Command output

==> Installing emacs-plus@30 from d12frosted/emacs-plus
==> Patching
cp: invalid option -- 'c'
Try 'cp --help' for more information.

  

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae! This means they were either deleted or installed manually. You should find replacements for the following formulae: python-platformdirs python-distlib python-filelock universal-ctags python-markupsafe

Warning: Some installed formulae are deprecated or disabled. You should find replacements for the following formulae: mcfly exa geoip gumbo-parser llvm@11 mysql@5.7 neofetch openssl@1.1 python-psutil python-pytz python-typing-extensions sphinx spotify-tui

brew config output

HOMEBREW_VERSION: 4.3.5-91-g9aeba61 ORIGIN: https://github.com/Homebrew/brew HEAD: 9aeba61fadc95fa7d84f7581cff2bc11cf3b64fd Last commit: 64 minutes ago Core tap JSON: 13 Jun 19:54 UTC Core cask tap JSON: 13 Jun 19:54 UTC HOMEBREW_PREFIX: /opt/homebrew HOMEBREW_BAT_THEME: Catppuccin-macchiato HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: nvim HOMEBREW_MAKE_JOBS: 8 HOMEBREW_SORBET_RUNTIME: set Homebrew Ruby: 3.3.2 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/bin/ruby CPU: octa-core 64-bit arm_firestorm_icestorm Clang: 15.0.0 build 1500 Git: 2.45.2 => /opt/homebrew/bin/git Curl: 8.6.0 => /usr/bin/curl macOS: 14.5-arm64 CLT: 15.3.0.0.1.1708646388 Xcode: 15.4 Rosetta 2: false

Any extra information

Was working literally a week ago. Not sure what I did to my computer in the meanwhile.. Any help is much appreciated. Thanks! P.S. I added coreutils to the PATH and "which cp" results in "/opt/homebrew/opt/coreutils/libexec/gnubin/cp" but that didn't resolve it.

sudo-human commented 3 weeks ago

I'm also facing this issue, and cp has a -c option

sudo-human commented 3 weeks ago

The coreutils cp doesn't support -c option, I tried the following it gave me the same error:


/opt/homebrew/opt/coreutils/libexec/gnubin/cp -c ~/asdf ~/Downloads
/opt/homebrew/opt/coreutils/libexec/gnubin/cp: invalid option -- 'c'
Try '/opt/homebrew/opt/coreutils/libexec/gnubin/cp --help' for more information.
suzuki commented 3 weeks ago

I have the same problem. My workaround is renaming the cp in the coreutils:

$ cd /usr/local/Cellar/coreutils/9.5/bin/
$ mv gcp gcp_

I use an Intel Mac, so the Homebrew directory and cp command name are as above.

d12frosted commented 3 weeks ago

I am pretty sure it's related to the fact that we are using standard env. See point (2) on how to switch to superenv, which should work. It's a workaround, I will think about fixing it properly without giving up on standard env.

gjpsquare commented 3 weeks ago

https://github.com/Homebrew/brew/pull/17373

bleppie commented 2 weeks ago

I am pretty sure it's related to the fact that we are using standard env. See point (2) on how to switch to superenv, which should work. It's a workaround, I will think about fixing it properly without giving up on standard env.

Hi, wame problem here. I tried commenting out the "env :std" line and it gets further but craps out when installing:

.brew install emacs-plus@30
==> Downloading https://formulae.brew.sh/api/cask.jws.json

==> Fetching d12frosted/emacs-plus/emacs-plus@30 ==> Cloning https://github.com/emacs-mirror/emacs.git Updating /Users/bleppie/Library/Caches/Homebrew/emacs-plus@30--git ==> Checking out branch master Already on 'master' Your branch is up to date with 'origin/master'. HEAD is now at 9e8c0ec9918 Fix problem with recently-added defcustom's ==> Installing emacs-plus@30 from d12frosted/emacs-plus ==> 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 ==> ./configure --disable-silent-rules --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp --infodir=/opt/homebrew/Ce ==> gmake ==> gmake install ==> Injecting PATH value to Emacs.app/Contents/Info.plist Error: An exception occurred within a child process: NoMethodError: undefined method `+' for nil

d12frosted commented 2 weeks ago

==> Injecting PATH value to Emacs.app/Contents/Info.plist Error: An exception occurred within a child process: NoMethodError: undefined method `+' for nil

That's a completely different error. Please open a new issue and also provide output of brew install --verbose emacs-plus@30.

nidan841g commented 2 weeks ago

I am seeing this on an M1 Pro Macbook Pro as well. brew doctor reports "Your system is ready to brew." I did the rename gcp trick from @suzuki and then saw the

NoMethodError: undefined method `+' for nil

error. The build command was brew install -v -s emacs-plus\@29 --with-modern-sexy-v2-icon --with-poll.

siriu5b commented 2 weeks ago

Same issue here (MacBook M1)

$ brew install d12frosted/emacs-plus/emacs-plus@29 --with-native-comp
Output ``` ==> Installing d12frosted/emacs-plus/emacs-plus@29 --with-native-comp ==> Patching cp: invalid option -- 'c' Try 'cp --help' for more information. ```
Brew config ``` HOMEBREW_VERSION: 4.3.6 ORIGIN: https://github.com/Homebrew/brew HEAD: e8430b25a1d1321f32e5093d62b57b5cb7cfb3c3 Last commit: 23 hours ago Core tap JSON: 17 Jun 15:20 UTC Core cask tap JSON: 17 Jun 15:20 UTC HOMEBREW_PREFIX: /opt/homebrew HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: emacs HOMEBREW_MAKE_JOBS: 10 Homebrew Ruby: 3.3.3 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/bin/ruby CPU: 10-core 64-bit arm_firestorm_icestorm Clang: 15.0.0 build 1500 Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 8.6.0 => /usr/bin/curl macOS: 14.5-arm64 CLT: 15.3.0.0.1.1708646388 Xcode: N/A Rosetta 2: false ```

I +1 @suzuki solution with a slightly different path (see prefix from brew config).

$ wheris gcp
gcp: /opt/homebrew/bin/gcp /opt/homebrew/share/man/man1/gcp.1
$ ls -l /opt/homebrew/bin/gcp
/opt/homebrew/bin/gcp ⇒ ../Cellar/coreutils/9.5/bin/gcp
$ cd /opt/homebrew/Cellar/coreutils/9.5/bin
$ mv gcp _gcp

[Then proceeds to install with success]
KJSanchez commented 2 weeks ago

@siriu5b and @suzuki's solution worked for me, although I needed to rename a different cp binary. Steps I took were to run the build with vebose output to get the PATH variable that's used during the build.

brew install ---verbose emacs-plus@29 --with-native-comp

then copy that below to figure out which cp binary should be renamed to cp_

PATH=<whatever> which cp

For me that was /usr/local/opt/coreutils/libexec/gnubin/cp

bradhowes commented 2 weeks ago

@KJSanchez Thanks for the steps to debug this. For me on a MacBookPro M1 under macOS 15.0 I had to do the rename step to /opt/homebrew/opt/coreutils/libexec/gnubin/cp but after that (and deleting a non-beta Xcode), brew install emacs-plus --with-native-comp ran to completion.

NicholasClooney commented 2 weeks ago

Same issue here (MacBook M1)

$ brew install d12frosted/emacs-plus/emacs-plus@29 --with-native-comp

Output Brew config I +1 @suzuki solution with a slightly different path (see prefix from brew config).

$ wheris gcp
gcp: /opt/homebrew/bin/gcp /opt/homebrew/share/man/man1/gcp.1
$ ls -l /opt/homebrew/bin/gcp
/opt/homebrew/bin/gcp ⇒ ../Cellar/coreutils/9.5/bin/gcp
$ cd /opt/homebrew/Cellar/coreutils/9.5/bin
$ mv gcp _gcp

[Then proceeds to install with success]

Thanks @siriu5b. I followed your suggestion and it worked for me!

5183nischal commented 1 week ago

@siriu5b solution solved it for me too. Should the issue stay open?

thegeorgeous commented 1 week ago

I have the same issue but with /bin/cp

Update: This is an issue with homebrew itself. It was fixed in the PR reference a little above.

I solved it by switching to the master branch of homebrew from the stable branch.

MikeMcQuaid commented 1 week ago

This is released/fixed in Homebrew 4.3.7 now: https://github.com/Homebrew/brew/releases/tag/4.3.7

d12frosted commented 1 week ago

Thank you for heads up @MikeMcQuaid ❤️

Folks, just make sure to upgrade to the latest brew and try again.