Install with Homebrew

Questions and problems about using polymake go here.
misha
Posts: 5
Joined: 21 Apr 2024, 21:41

Install with Homebrew

Postby misha » 21 Apr 2024, 21:45

I try to install polymake 4.11 using Homebrew tap with perl version 5.38, but I cannot load polymake and get the following error message. My MacOS is Sonoma 14.4.1

Code: Select all

Can't locate loadable object for module Polymake::Ext in @INC (@INC contains: /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib /opt/homebrew/Cellar/polymake/4.11/lib/polymake/perlx /opt/homebrew/Cellar/polymake/4.11/libexec/perl5/lib/perl5/darwin-thread-multi-2level /opt/homebrew/Cellar/polymake/4.11/libexec/perl5/lib/perl5 /opt/homebrew/opt/perl/lib/perl5/site_perl/5.38/darwin-thread-multi-2level /opt/homebrew/opt/perl/lib/perl5/site_perl/5.38 /opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level /opt/homebrew/opt/perl/lib/perl5/5.38 /opt/homebrew/lib/perl5/site_perl/5.38) at /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib/Polymake/Namespaces.pm line 18. Compilation failed in require at /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib/Polymake/Namespaces.pm line 18. BEGIN failed--compilation aborted at /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib/Polymake/Namespaces.pm line 18. Compilation failed in require at /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib/Polymake.pm line 29. BEGIN failed--compilation aborted at /opt/homebrew/Cellar/polymake/4.11/share/polymake/perllib/Polymake.pm line 29. Compilation failed in require at /opt/homebrew/Cellar/polymake/4.11/libexec/perl5/bin/polymake line 156. BEGIN failed--compilation aborted at /opt/homebrew/Cellar/polymake/4.11/libexec/perl5/bin/polymake line 156.
What should I do? I try to uninstall --force and reinstall, but keep getting the same error message as above.

Thanks for helping in advance!

misha
Posts: 5
Joined: 21 Apr 2024, 21:41

install using binary

Postby misha » 22 Apr 2024, 22:15

I realized that Polymake is not compatible with Perl 5.38.2, so I tried to install perlbrew and perl 5.36.1 and switch to this older version. Then when I "./configure", I got this

Code: Select all

checking C++ compiler ... ok (g++ is Apple CLANG (roughly 10.0) from Xcode 15.0.0) checking C++ library ... ok (libc++ 170006, C++ 201402) checking for package manager ... no package manager specified determining architecture ... ok (darwin.arm64) determining compiler flags ... ok CFLAGS= CXXFLAGS= -std=c++14 -Wno-logical-op-parentheses -Wno-shift-op-parentheses -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-error=unneeded-internal-declaration -Wshadow -Wconversion -Wno-sign-conversion -Wzero-as-null-pointer-constant LDFLAGS= checking gmp installation ... Could not compile a test program checking for the GNU Multiprecision Library (GMP). The most probable reasons are that the library is installed at a non-standard location, lacking developer's subpackage or missing at all. Please refer to the installation instructions at http://www.polymake.org/doku.php/howto/install. The complete error log follows: g++ -std=c++14 -Wno-logical-op-parentheses -Wno-shift-op-parentheses -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-error=unneeded-internal-declaration -Wshadow -Wconversion -Wno-sign-conversion -Wzero-as-null-pointer-constant -o /var/folders/5r/bp47lxys6kb2h5vb6dqn3dyw0000gn/T//polymake_2424_configure /var/folders/5r/bp47lxys6kb2h5vb6dqn3dyw0000gn/T//polymake_2424_configure.cc -lgmp -lc++ /var/folders/5r/bp47lxys6kb2h5vb6dqn3dyw0000gn/T//polymake_2424_configure.cc:2:10: fatal error: 'gmp.h' file not found #include <gmp.h> ^~~~~~~ 1 error generated.
I installed gmp via Homebrew in /opt/homebrew and even if I exported /opt/homebrew in the PATH variable in the .profile in my home folder, Polymake in my home folder is still unable to find gmp.

Is there a way to let it find gmp installed by homebrew? =

paffenholz
Developer
Posts: 213
Joined: 24 Dec 2010, 13:47

Re: Install with Homebrew

Postby paffenholz » 23 Apr 2024, 13:08

The homebrew tap uses the perl from homebrew, so this should work, if that perl is the one in your $PATH in the terminal you start polymake in.

To compile from scratch on Silicon Macs currently requires the option "--with-brew=/opt/homebrew" for configure. This is currently not correctly detected in the configuration script, and will be fixed with the next version of polymake. If you have the latest MacOS version and XCode, then you probably also have to edit the file build/config.ninja and remove "-L/usr/local/lib" from LDFLAGS and add "-Wno-unused" to CFLAGS and CXXFLAGS (due to some older code bundled with polymake that newer clang versions now complain about).

Andreas

misha
Posts: 5
Joined: 21 Apr 2024, 21:41

Re: Install with Homebrew

Postby misha » 06 May 2024, 21:48

Thank you so much!

misha
Posts: 5
Joined: 21 Apr 2024, 21:41

Re: Install with Homebrew

Postby misha » 06 May 2024, 22:54

The homebrew tap uses the perl from homebrew, so this should work, if that perl is the one in your $PATH in the terminal you start polymake in.

To compile from scratch on Silicon Macs currently requires the option "--with-brew=/opt/homebrew" for configure. This is currently not correctly detected in the configuration script, and will be fixed with the next version of polymake. If you have the latest MacOS version and XCode, then you probably also have to edit the file build/config.ninja and remove "-L/usr/local/lib" from LDFLAGS and add "-Wno-unused" to CFLAGS and CXXFLAGS (due to some older code bundled with polymake that newer clang versions now complain about).

Andreas
My config.ninja file looks like

Code: Select all

CC = cc CXX = g++ CFLAGS = -I/opt/homebrew/include CXXFLAGS = -std=c++14 -I/opt/homebrew/include -Wno-logical-op-parentheses -Wno-shift-op-parentheses -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-error=unneeded-internal-declaration -Wshadow -Wconversion -Wno-sign-conversion -Wzero-as-null-pointer-constant -DPOLYMAKE_WITH_FLINT ARCHFLAGS = CsharedFLAGS = -fPIC -pipe CXXOPT = -O3 CXXDEBUG = -g CXXCOV = --coverage -O1 CXXSANITIZE = -fno-omit-frame-pointer -O1 -g CflagsSuppressWarnings = -Wno-unused -Wno-empty-body -Wno-format-extra-args CLANGversion = 10.0 CPPStd = 201402 XcodeVersion = 15.0.0 LDFLAGS = -L/opt/homebrew/lib LDsharedFLAGS = -mmacosx-version-min=14.2 -bundle -undefined dynamic_lookup -fstack-protector-strong LDcallableFLAGS = -mmacosx-version-min=14.2 -dynamiclib -undefined dynamic_lookup -fstack-protector-strong -mmacosx-version-min=14.2 -fstack-protector-strong LDsonameFLAGS = -install_name /usr/local/lib/
Everything is using opt/homebrew/lib and opt/homebrew/include

Shall I still remove them to "wno-unused" or something?

Thank you so much!

User avatar
gawrilow
Main Author
Posts: 425
Joined: 25 Dec 2010, 17:40

Re: Install with Homebrew

Postby gawrilow » 11 May 2024, 23:52

Everything is using opt/homebrew/lib and opt/homebrew/include

Shall I still remove them to "wno-unused" or something?
No, homebrew directories should be fine. -Wno-unused is not about directories, it's rather to suppress warnings about some unused variables in legacy code. It's harmless to add to CXXFLAGS as long as you are not developing your own code.


Return to “Helpdesk”