Ask Your Question
0

Difficulty installing Sage-10.0 on Mac OS 12.6.8 'gmp.h' file not found

asked 2023-08-16 17:01:30 +0100

takashi gravatar image

I am trying to install Sage-10.0 on Mac OS 12.6.8, following the instructions at

      https://doc.sagemath.org/html/en/installation/source.html#sec-installation-from-sources

and https://github.com/sagemath/sage/#readme

I got the following fatal error during the "make" stage: Can you tell what I need to do?

[gmpy2-2.1.2] In file included from src/gmpy2.c:500: [gmpy2-2.1.2] ./src/gmpy2.h:79:12: fatal error: 'gmp.h' file not found [gmpy2-2.1.2] # include <gmp.h> [gmpy2-2.1.2] ^~~~~~~ [gmpy2-2.1.2] 1 error generated. [gmpy2-2.1.2] error: command '/usr/bin/gcc' failed with exit code 1 [gmpy2-2.1.2] error: subprocess-exited-with-error [gmpy2-2.1.2] [gmpy2-2.1.2] × python setup.py bdist_wheel did not run successfully. [gmpy2-2.1.2] │ exit code: 1 [gmpy2-2.1.2] ╰─> See above for output. [gmpy2-2.1.2] [gmpy2-2.1.2] note: This error originates from a subprocess, and is likely not a problem with pip. [gmpy2-2.1.2] full command: /Users/stephensalser/sage/sage-10.

I tried to fix it by installing gmp using "brew install gmp" but I got the following message:

Warning: gmp 6.2.1_1 is already installed and up-to-date. To reinstall 6.2.1_1, run: brew reinstall gmp

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-08-16 20:17:51 +0100

My guess is that you didn't do source SAGE_ROOT/.homebrew-build-env. This has to be done in the same Terminal session as the make command. (I actually put source SAGE_ROOT/.homebrew-build-env in my .zshrc file so that it gets run in every Terminal session, since (a) I build Sage frequently to test new beta releases and (b) it just adjusts a few environment variables, nothing that would cause problems with other things I do.)

The reason that I'm guessing this is that I tested by starting a Terminal session in which this command was not run, and I got the same compilation error.

edit flag offensive delete link more

Comments

Thank you so much. Should I drag the sage-10.0 file to the trash, empty it, and then re-expand the tarball to get a fresh start on building it? Or should I just go right to source SAGE_ROOT/.homebrew-build-env and then try the make command again? In other words, do I need to uninstall a bunch of stuff I have already done and get a fresh start, or can I immediately try your suggestion?

takashi gravatar imagetakashi ( 2023-08-16 22:46:33 +0100 )edit

You can run make distclean which should restore things to pristine status. (This has pretty much the same effect as deleting everything and unpacking the tarball again.) Then source the file and try make again.

John Palmieri gravatar imageJohn Palmieri ( 2023-08-16 23:08:17 +0100 )edit

Thanks, I tried those three steps - 1) make distclean 2) source ~/sage/sage-10.0/ .homebrew-build-env 3) make

but unfortunately I got the same error:

In file included from src/gmpy2.c:500: [gmpy2-2.1.2] ./src/gmpy2.h:79:12: fatal error: 'gmp.h' file not found [gmpy2-2.1.2] # include <gmp.h> [gmpy2-2.1.2] ^~~~~~~ [gmpy2-2.1.2] 1 error generated. [gmpy2-2.1.2] error: command '/usr/bin/gcc' failed with exit code 1 [gmpy2-2.1.2] error: subprocess-exited-with-error [gmpy2-2.1.2]
[gmpy2-2.1.2] × python setup.py bdist_wheel did not run successfully. [gmpy2-2.1.2] │ exit code: 1 [gmpy2-2.1.2] ╰─> See above for output.

takashi gravatar imagetakashi ( 2023-08-17 00:07:48 +0100 )edit

My only two further ideas are (1) restarting the computer, starting a new terminal session, and then once again trying make distclean; source .homebrew-build-env; ./.configure; make. Or (2) all of that but using ./configure --with-system-gmp=no instead of ./configure.

John Palmieri gravatar imageJohn Palmieri ( 2023-08-17 06:55:35 +0100 )edit

You could also post the question to the Google group sage-support, along with the file SAGE_ROOT/config.log.

John Palmieri gravatar imageJohn Palmieri ( 2023-08-17 17:09:17 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-08-16 17:01:30 +0100

Seen: 453 times

Last updated: Aug 16 '23