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

Install --with-native-comp fails #508

Open
briansniffen opened this issue Sep 22, 2022 · 16 comments
Open

Install --with-native-comp fails #508

briansniffen opened this issue Sep 22, 2022 · 16 comments

Comments

@briansniffen
Copy link

briansniffen commented Sep 22, 2022

brew install emacs-plus@29 --with-native-comp fails with the error:

Error: invalid option: --with-native-comp

And a Usage message for brew install listing of options that does not include the options from the brewfile.

brew install emacs-plus@29 --with-native-nonsense fails with the error:

Error: invalid option: --with-native-nonsense

And a Usage message for brew install listing of options that does include the options from the brewfile.

Here's a brew config; any ideas where I can look next to debug this?
HOMEBREW_VERSION: 3.6.2-24-g3452176
ORIGIN: https://github.com/Homebrew/brew
HEAD: 34521764a659fdce4861a2c1ff0662fe8186c446
Last commit: 5 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: cc6abf752cdff1737a9c3856ee86c0bcdd1add13
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /Users/bsniffen/homebrew
HOMEBREW_REPOSITORY: /Users/bsniffen/homebrew
HOMEBREW_CELLAR: /Users/bsniffen/homebrew/Cellar
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.37.0 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.6-arm64
CLT: 14.0.0.0.1.1661618636
Xcode: N/A
Rosetta 2: false

Thanks for your work on this amazingly useful project!

@d12frosted
Copy link
Owner

🤔 Might be some issue with brew. I will upgrade later this day and see what's wrong.

@d12frosted
Copy link
Owner

Upgraded and it works. Can you try with any other formula that has custom options? Though it's hard to find them, as the homebrew core doesn't allow options. You can create a file called Foo.rb with the following content:

class Foo < Formula
  desc ""
  homepage ""
  url "https://example.com/foo-0.1.tar.gz"
  sha256 "85cc828a96735bdafcf29eb6291ca91bac846579bcef7308536e0c875d6c81d7"

  # depends_on "cmake" => :build

  option "with-ham", "Description of the option"
  option "without-spam", "Another description"

  if build.with? "ham"
    puts ">>> with-ham"
  else
    puts ">>> without-ham"
  end

  def install
    # ENV.deparallelize
    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}"
    # system "cmake", ".", *std_cmake_args
    system "make", "install"
  end

  test do
    system "false"
  end
end

And then install it with brew install --formula Foo.rb --with-ham. It should fail due to 404 error when downloading archive, but at least it should print >>> with ham instead of yelling at you regarding unknown option.

@briansniffen
Copy link
Author

That works fine, printing >>> with ham and failing as you predict. brew install emacs-plus@29 --with-native-comp produces a Usage message ending with Error: invalid option: --with-native-comp. And I copied and pasted those strings to be sure. My brew installation is in my homedir for Reasons, and I wonder if that's related. Thanks for your help; I'll keep poking.

@d12frosted
Copy link
Owner

Not sure if related. As a workaround, clone this repository and install it using brew install --formula Formula/[email protected] --with-native-comp.

@briansniffen
Copy link
Author

Thanks for the idea, but same error message. I did some more digging, and have a theory: brew was installing (upgrading) libgccjit, and the option was being passed to it also. Of course, it doesn't support any options. That, in turn, has been failing because of a linker error; see iains/gcc-12-branch#6 — but neither of these is your problem. It looks like a reasonable workaround for installing formulae with options is to install dependencies first without options, then install the formula with options.

I spent an hour looking at Brew code to see where options were being propagated to dependencies, but haven't found it. Thanks for the support & for your work on this tap!

@agzam
Copy link

agzam commented Sep 27, 2022

I don't get it, why then emacs-plus@28 ---with-native-comp works (if 29 doesn't)?

@d12frosted
Copy link
Owner

All I can say, brew position towards options is a twisted one. They keep them, but they advocate for not using them. Since official formulas don't have options, it's not a "well tested feature" that breaks time to time in unexpected ways. Not saying that this is the case, but it might be.

reasonable workaround for installing formulae with options is to install dependencies first without options, then install the formula with options.

I guess, in that case we can provide better instructions. The same way as we advocate for not using reinstall command ever.

@agzam
Copy link

agzam commented Sep 28, 2022

The same way as we advocate for not using reinstall command ever.

Oh, really? So how do you update emacs installed from --HEAD?

@d12frosted
Copy link
Owner

Oh, really? So how do you update emacs installed from --HEAD?

You can find more some details in the README. In short, options do not properly propagate during reinstall. More or less it was fixed by not using external resources (e.g. patches, icons). Maybe if you are using only --HEAD, then you are fine.

@agzam
Copy link

agzam commented Sep 29, 2022

Oh, I guess my question came out wrong. What's the proper/guranteed way of updating emacs-plus@29, so it fetches the latest from master and builds it? brew uninstall and then install again?

@d12frosted
Copy link
Owner

@agzam as far as I remember, reinstall handles fetching of the latest master. But there are troubles if you are using any options, that's why I advise to use combination of uninstall and install. That allows you to upgrade and properly propagate all options.

P.S. I feel like I need to taste this again, it's possible that they fixed the old behaviour.

@agzam
Copy link

agzam commented Sep 29, 2022

Yeah, because I remember using reinstall and haven't noticed any problems, I dunno. Maybe I simply wasn't paying attention? My usual flags are --with-native-comp --with-xwidgets --with-modern-papirus-icon --verbose. But thank you for the heads up. Next time I'll keep a closer eye.

@n14s
Copy link

n14s commented Oct 5, 2022

Got the same issue. Have you made any progress @briansniffen ?

@briansniffen
Copy link
Author

briansniffen commented Oct 5, 2022 via email

@n14s
Copy link

n14s commented Oct 8, 2022

Thanks for your answer.
I installed libgccjit without options in a seperate brew command as described in your earlier comment.
That didn't do the trick, since following up with installing emacs with options fails with the same error.

I didn't downgrade xcode-cli, though, as I don't really know what exactly was mean't by that.
Disclaimer: I'm new to MacOS, coming from Linux.

@briansniffen
Copy link
Author

briansniffen commented Oct 8, 2022 via email

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

No branches or pull requests

4 participants