apaffenholz / homebrew-polymake

3 stars 0 forks source link

Apple M1: homebrew "brew install apaffenholz/polymake/polymake" fails (/usr/local instead of /opt/homebrew) #3

Closed GMS103 closed 1 year ago

GMS103 commented 2 years ago

It seems to me that /opt/homebrew/lib should be picked instead of /usr/local/lib for the native version of homebrew on Apple M1:

$ brew install apaffenholz/polymake/polymake
[...]
==> Installing polymake from apaffenholz/polymake
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> yes | perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Build.PL --install_base /opt/homebrew/Cellar/polymake/4.5/libexec
==> ./Build
==> ./Build test
==> ./Build install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> yes 'n' | perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5
==> make install
==> perl Makefile.PL INSTALL_BASE=/opt/homebrew/Cellar/polymake/4.5/libexec/perl5 --includedir=/opt/homebrew/opt/readline/include --libdir=/opt/homebrew/opt/readline/lib
==> make install
==> ./configure --prefix=/opt/homebrew/Cellar/polymake/4.5 --without-bliss --without-java --without-scip --without-soplex --without-singular --with-brew=bottle
Last 15 lines from /Users/gms/Library/Logs/Homebrew/polymake/219.configure:
2022-01-17 02:56:47 +0000

./configure
--prefix=/opt/homebrew/Cellar/polymake/4.5
--without-bliss
--without-java
--without-scip
--without-soplex
--without-singular
--with-brew=bottle

checking C++ compiler ... ok (clang++ is Apple CLANG (roughly 10.0) from Xcode 13.0.0)
checking C++ library ... ok (libc++ 12000, C++ 201402)
checking for package manager ... Homebrew installation seems corrupt: no shared libraries found in /usr/local/lib

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/apaffenholz/homebrew-polymake/issues

These open issues may also help:
Brewing polymake on Apple Silicon / M1 / arm https://github.com/apaffenholz/homebrew-polymake/issues/2
$ 
GMS103 commented 2 years ago

In fact, after cd /usr/local ; ln -s /opt/homebrew/lib lib, everything works: the end of brew install apaffenholz/polymake/polymake gives this:

==> ./configure --prefix=/opt/homebrew/Cellar/polymake/4.5 --without-bliss --without-java --without-scip --without-soplex --without-singular --with-brew=bottle
==> ninja -C build/Opt install
==> Caveats
Note: This version comes without support for SVG export.

If you had any other version of polymake installed on your Mac
(both previous versions installed via Homebrew or any other installations)
you must start polymake once with
"polymake --reconfigure"
to remove the configuration of SVG support from your local
polymake setup. Afterwards you can use "polymake" as usual.
==> Summary
🍺  /opt/homebrew/Cellar/polymake/4.5: 3,355 files, 156.0MB, built in 11 minutes 34 seconds
==> Running `brew cleanup polymake`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
$ 
mkoeppe commented 2 years ago

@apaffenholz The brew prefix is hardcoded in https://github.com/apaffenholz/homebrew-polymake/blob/master/Formula/polymake.rb#L638, that should probably be corrected

apaffenholz commented 2 years ago

Thanks for testing on M1.

I have replaced the fixed path with the corresponding env variable from homebrew. This works on intel macs. I don't have a mac with an M1, so I can't test on one.

GMS103 commented 2 years ago

Thanks for the quick reaction. Nothing has changed for M1. In fact, the file homebrew-polymake-polymake-4.6/Formula/polymake.rb in https://github.com/apaffenholz/homebrew-polymake/releases/tag/polymake-4.6 still has /usr/local. (But perhaps I should do something else than brew install apaffenholz/polymake/polymake?)

apaffenholz commented 2 years ago

True. brew has a nice command that uploads bottles and creates the corresponding commit and release in one go, but the source packages are apparently from github, so the sources must be commited beforehand to create the correct packages. Never thought about this before. Now the sources should be correct.

But brew install apaffenholz/polymake/polymake should clone the repo (by default into /usr/local/Homebrew/Library/Taps/apaffenholz/, at least on intel), and use the formula in the repo. Which contained the env variable instead of the fixed path already after my first commit of the new bottles. I don't know how you ended up with the sources in https://github.com/apaffenholz/homebrew-polymake/releases/tag/polymake-4.6.

apaffenholz commented 2 years ago

Sorry, this won't work either. And I could have realized this much earlier by reading the output you provided more carefully.

The path /usr/local is hard coded already into the polymake sources. We didn't bother to make this a variable that can be provided by the user or that is somehow deduced from the system, as, at least for homebrew on intel macs, there are several packages that polymake depends on that can only be installed into the default location for homebrew. Which is /usr/local. So there was no point for us to spend time to be more flexible.

This has been there for such a long time that I completely forgot about it.

Is /opt/homebrew/ the "default" prefix on macs with M1, or on MacOS 12? In that case we need to fix this in polymake and changing the homebrew formula won't help. This will take a while.

GMS103 commented 2 years ago

All right, that makes sense. Yes, in an M1 Mac, you have

/opt/homebrew/.dockerignore
/opt/homebrew/.editorconfig
/opt/homebrew/.git
/opt/homebrew/.github
/opt/homebrew/.gitignore
/opt/homebrew/.shellcheckrc
/opt/homebrew/.sublime
/opt/homebrew/.vale.ini
/opt/homebrew/.vscode
/opt/homebrew/CHANGELOG.md
/opt/homebrew/CONTRIBUTING.md
/opt/homebrew/Caskroom
/opt/homebrew/Cellar
/opt/homebrew/Dockerfile
/opt/homebrew/Frameworks
/opt/homebrew/LICENSE.txt
/opt/homebrew/Library
/opt/homebrew/README.md
/opt/homebrew/SECURITY.md
/opt/homebrew/bin
/opt/homebrew/completions
/opt/homebrew/docs
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/manpages
/opt/homebrew/opt
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var

while in /usr/local there is only (in my case)

/usr/local/bin
/usr/local/share
/usr/local/texlive
mkoeppe commented 2 years ago

Yes, /opt/homebrew is the default on M1 for all macOS versions, and /usr/local is still the default on x86_64 for all macOS versions.

GMS103 commented 2 years ago

I am available to test whenever you are done with the updating.

apaffenholz commented 2 years ago

As there aren't any M1-bottles for polymake the formula would compile the sources anyway. So you could instead use the polymake sources from the polymake repo instead. Instructions are here (written for the previous version). The configure command for polymake has an option --with-brew=<path> where you can provide /opt/homebrew. That is probably not tested very thoroughly.

mkoeppe commented 2 years ago

Of course in Sage we also have build scripts for polymake; using the existing homebrew bottle is merely a convenience for users.

apaffenholz commented 2 years ago

I will leave a comment here once I (think I) have fixed this. I won't be able to test myself.

GMS103 commented 2 years ago

As there aren't any M1-bottles for polymake the formula would compile the sources anyway. So you could instead use the polymake sources from the polymake repo instead.

As Matthias said, I do not really need to compile polymake (I was trying to build SageMath). But I shall test the formula when it is ready and let you know.

NicoleYueqiLi commented 2 years ago

I have the same issue too.

selmanipek commented 1 year ago

Hi, is there any progress on this? Perhaps it is above but I couldn't quite follow.

apaffenholz commented 1 year ago

Not really. We still cannot provide M1/M2 bottles or test the formula.

mikestillman commented 1 year ago

Hi, I'm trying to install polymake on my apple M1 as well (with the hope to get it to play nicely with Macaulay2 on apple M1's). The location for brew is /opt/homebrew, not /usr/local, as mentioned above. Is there anything I can test?

mikestillman commented 1 year ago

Here is the error I get when I try using brew to install polymake:

==> ./configure --prefix=/opt/homebrew/Cellar/polymake/4.6 --without-bliss --without-java --without-scip --without
Last 15 lines from /Users/mike/Library/Logs/Homebrew/polymake/219.configure:
2023-03-10 11:13:32 +0000

./configure
--prefix=/opt/homebrew/Cellar/polymake/4.6
--without-bliss
--without-java
--without-scip
--without-soplex
--without-singular
--with-brew=bottle

checking C++ compiler ... ok (clang++ is Apple CLANG (roughly 10.0) from Xcode 14.0.0)
checking C++ library ... ok (libc++ 13000, C++ 201402)
checking for package manager ... Homebrew installation seems corrupt: no shared libraries found in /usr/local/lib

There is essentially nothing in /usr/local/lib, all libraries are in /opt/homebew/lib

Also, I would rather be installing the latest version of polymake (4.9?).

@apaffenholz @lkastner I would be willing to try to help get it working on apple M1 macs

apaffenholz commented 1 year ago

This project is currently more or less unmaintained. I have no recent Mac, and also no Mac with an M1. So I have no posibility to reproduce any errors.

I can update the formula for polymake 4.9 . This will, however, most likely not fix the wrong libdir.

This location is set by homebrew in the variable libexec, and the build formula for polymake uses that variable for compilation and installation. /usr/local/lib ist the correct choice for intel Macs, while /opt/homebrew/lib is the corresponding location on Macs with an M1. I have no idea why homebrew should provide the wrong one.

apaffenholz commented 1 year ago

This should be fixed now.

The error was in the configuration of polymake. With the build options defined in the formula the configuration set the homebrew base path to /usr/local without checking.

Until the next release of polymake the polymake configure script is patched in the formula.