Closed GoogleCodeExporter closed 8 years ago
While compiling, it can't find mpfr.h and mpc.h. Do you have them installed on
your system?
If so, in which directory?
Can you try "python setup.py build_ext -Ddir=/... install" where /... is the
directory where gmp, mpfr, and mpc reside?
I think the Detailed instructions sections from
https://gmpy2.readthedocs.org/en/latest/intro.html#installing-gmpy2-on-unix-linu
x
should apply.
Original comment by casevh
on 19 Feb 2013 at 7:08
Fink (/sw) has gmp 5.1.0. I have no idea what lives in /usr/local. The output
is the same for python setup.py build_ext -Ddir=/usr/local/ install and python
setup.py build_ext -Ddir=/sw/lib/ install, though.
Original comment by asmeurer@gmail.com
on 19 Feb 2013 at 7:21
Attachments:
It is failing to find the MPFR and MPC libraries. Are they available via Fink?
(Their website appears to be down at the moment...) If the directory structure
is /sw/lib adn /sw/include, the correct command is "python setup.py build_ext
-Ddir=/sw install". "dir" should be set to the top-level directory.
gmpy2 will try to build without MPFR and MPC but that option was intended for
testing during development and it is broken at the moment (and will probably be
removed).
Original comment by casevh
on 20 Feb 2013 at 4:13
Thanks that worked (-Ddir=/sw). There was just one compiler warning. I'm
pasting the clang version as it's more useful, but it seems to have worked both
in Python 2 and Python 3. Python 2 is still using gcc and Python 3 clang (I'm
pretty sure that is some weird artifact of my particular setup). The same
compiler warning appears in gcc.
In file included from src/gmpy2.c:467:
src/gmpy_basic.c:62:27: warning: unused variable 'paz' [-Wunused-variable]
PympzObject *rz = 0, *paz = 0, *pbz = 0;
^
src/gmpy_basic.c:62:37: warning: unused variable 'pbz' [-Wunused-variable]
PympzObject *rz = 0, *paz = 0, *pbz = 0;
^
I know extremely little about C libraries, so I can't really say if this is
something that is your fault or mine. It would be nice if this worked
automatically, though. Note that both Pythons are coming from Fink.
Original comment by asmeurer@gmail.com
on 20 Feb 2013 at 5:57
That error message you are seeing occurs if you compile without MPFR and MPC.
The primary change in gmpy2 is support for the MPFR and MPC libraries and
although it compiles if they aren't present, I don't test it often. This
warning slipped through the cracks. Once Fink's site is back, can you check
which, if any, version of MPFR and MPC they have available?
Original comment by casevh
on 20 Feb 2013 at 6:33
Sorry, I was going to post this before
~$fink list mpc
Information about 6844 packages read in 1 seconds.
libmpc2 0.9-2 Multi-precision complex lib
i libmpc2-shlibs 0.9-2 Multi-precision complex lib
i libmpc3 1.0.1-1 Multi-precision complex lib
i libmpc3-shlibs 1.0.1-1 Multi-precision complex lib
libmpcdec5 1.2.6-1 Musepack audio compression library
libmpcdec5-shlibs 1.2.6-1 Shared libraries for libmpcdec
~$fink list mpfr
Information about 6844 packages read in 1 seconds.
i libmpfr4 3.1.1-1 C floating-point math lib
i libmpfr4-shlibs 3.1.1-1 Shared libraries for mpfr package
The i in the left column means that it is installed.
Original comment by asmeurer@gmail.com
on 21 Feb 2013 at 12:17
libmpc3 and libmpfr4 should satisfy the requirements. With -Ddir=/sw, the
setup.py script looks for /sw/include/mpfr.h, /sw/include/mpc.h,
/sw/lib/libmpfr.a, and /sw/lib/libmpc.a. Do those file names exist or do they
have different names/locations?
Original comment by casevh
on 21 Feb 2013 at 3:29
Those files are there (/sw/include). To be clear, it does build now, and it
seems to work just fine. I am just getting a compiler warning about an unused
variable. You can probably close this.
Original comment by asmeurer@gmail.com
on 22 Feb 2013 at 1:02
The only way the error you reported can occur is if the MPFR library is not
found by setup.py. Since sympy only exercises the GMP related code in gmpy2,
everything will appear to work but I'd like to see if I can make gmpy2 work
properly on a Mac.
What does gmpy2.mpfr_version() return? If an empty string is returned, then
MPFR support is missing.
What are the exact names of the files in /sw/lib?
Original comment by casevh
on 22 Feb 2013 at 5:47
It gives None, in both Python 2 and 3.
$ls /sw/include/mp*
-rw-r--r-- 1 root admin 12K Sep 23 13:49 /sw/include/mpc.h
-rw-r--r-- 1 root admin 6.1K Aug 16 2012 /sw/include/mpf2mpfr.h
-rw-r--r-- 1 root admin 50K Aug 16 2012 /sw/include/mpfr.h
Original comment by asmeurer@gmail.com
on 22 Feb 2013 at 5:50
What do you get for ls /sw/lib/libmp* ?
Original comment by casevh
on 22 Feb 2013 at 6:34
-rwxr-xr-x 1 root admin 80K Aug 16 2012 /sw/lib/libmpc.2.dylib*
-rwxr-xr-x 1 root admin 89K Sep 23 13:49 /sw/lib/libmpc.3.dylib*
-rw-r--r-- 1 root admin 155K Sep 23 13:49 /sw/lib/libmpc.a
lrwxr-xr-x 1 root admin 14B Sep 23 13:49 /sw/lib/libmpc.dylib@ ->
libmpc.3.dylib
-rwxr-xr-x 1 root admin 914B Sep 23 13:49 /sw/lib/libmpc.la*
-rwxr-xr-x 1 root admin 343K Aug 16 2012 /sw/lib/libmpfr.4.dylib*
lrwxr-xr-x 1 root admin 15B Aug 16 2012 /sw/lib/libmpfr.dylib@ ->
libmpfr.4.dylib
-rwxr-xr-x 1 root admin 918B Aug 16 2012 /sw/lib/libmpfr.la*
In case you're wondering about the ls output, I have ls aliased to ls -AG@Flha.
Original comment by asmeurer@gmail.com
on 22 Feb 2013 at 11:40
setup.py looks for libmpc.a (which it finds) and libmpfr.a (which does not
exist). I don't know if that is a bug in the MPFR installation or not.
Can you try deleting the following lines from setup.py and rebuild gmpy2?
# Verify that MPFR and MPC exist in the same directory
if not os.path.isfile(lookin + '/libmpfr.a'):
use_mpfr = False
if not os.path.isfile(lookin + '/libmpc.a'):
use_mpc = False
Removing these lines will allow the compilation to proceed if the .a files
can't be found. The existence of the .dylib file may be sufficient.
Original comment by casevh
on 23 Feb 2013 at 5:45
That doesn't seem to work. I still get those compiler warnings and
gmpy2.mpfr_version() == None.
Original comment by asmeurer@gmail.com
on 24 Feb 2013 at 2:07
By the way, you need to update your setup.py clean. I had to redownload the
source each time to test this, as it otherwise wouldn't recompile.
Original comment by asmeurer@gmail.com
on 24 Feb 2013 at 2:10
Can you replace setup.py with the attached file? It's a complete re-write and
should generate useful error messages if it can't find the files. By default,
it searches for the .h header files under these prefixes:
search_dirs = ['/opt/local', '/opt', '/usr/local', '/usr', '/sw']
Once gmp.h is found, the other two header files should be found in the same
directory. I've included /sw at the end of the list.
setup.py clean should now work, too.
Original comment by casevh
on 24 Feb 2013 at 6:57
Attachments:
Clean doesn't work because it raises an error before it gets far enough:
$python setup.py clean
mpfr.h is not present in /usr/local/include.
To disable support for MPFR, use the -DNOMPFR option.
To specify a directory prefix for the include and library files,
use the -DDIR=prefix option.
which probably tells you what you wanted to know anyway.
Original comment by asmeurer@gmail.com
on 25 Feb 2013 at 1:38
I did it with a fresh download, and it seems to have worked
>>> gmpy2.mpfr_version()
'MPFR 3.1.1'
Manually including /sw probably isn't the best solution. It is in my PATH and
so on, so it should just work. I'll run the sympy tests and see if there are
any issues.
Original comment by asmeurer@gmail.com
on 25 Feb 2013 at 1:42
Thanks for the update. I've made more changes to setup.py. In addition to a
better "clean", setup.py now prints an error if MPFR or MPC can't be found
instead of silently building a version of gmpy2 without MPFR or MPC support. It
will still be possible to pass an option to allow building with MPFR or MPC.
I'll close this issue but please report any other issues you encounter.
Original comment by casevh
on 27 Feb 2013 at 5:06
Original issue reported on code.google.com by
asmeurer@gmail.com
on 19 Feb 2013 at 5:55Attachments: