While I was exploring Computer Algebra Systems I came along Fricas, and got interested.
I decided to install it on my MacBook Pro with Mac OS 10.10 (Yosemite).
I could have installed the binary, but as this is about two years old, I decided to install from source. I downloaded
https://sourceforge.net/projects/fricas/files/fricas/1.3.2/fricas-1.3.2-full.tar.bz2 and started from there. I made a command line installation, not an Application bundle.
I installed in a separate ax-build directory as recommended.
I used sbcl 1.3.19 (installed with macports).
There were, however, problems with GMP support.
Here are a couple of observations:
1. First I installed without GMP support, and later I decided to add GMP support. I did a 'make clean' in between. However, it appeared that GMP was not used (this is hard to find out, by the way).
I found that ax-build/src/lisp/num_gmp.lisp was still the old one from the non-GMP build. After deleting that file and re-running 'make' I was one step further towards using GMP, but some other hurdles still had to be taken.
Solution: 'make clean' in src/lisp/Makefile.in should also remove num_gmp.lisp.
2. I have GMP installed by macports, hence it is in a non-standard location (/opt/local). This makes that configure doesn't find it. This can easily be solved by using
CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib ../configure ...
or setting these environment variables before starting configure.
(But see also point 3)
3. That is, however, not sufficient to compile ax-build/src/lib/gmp_wrap.so.
It needs this in the Makefile:
$(GMP_WRAP_SO): $(srcdir)/gmp_wrap.c
$(CC) -I/opt/local/include -L/opt/local/lib -g -fPIC $(SOLIB_FLAGS) $< $(GMP_LIB) -o $@
This is a bit harder, as then configure must patch the Makefile. But configure doesn't know the location of GMP.
Another option is:
$(GMP_WRAP_SO): $(srcdir)/gmp_wrap.c
$(CC) %(CPPFLAGS) $(LDFLAGS) -g -fPIC $(SOLIB_FLAGS) $< $(GMP_LIB) -o $@
and running 'make' with these environment variables set.
I think the best solution would be to add options -gmp-includes and -gmp-libraries to configure, similar to -x-includes and -x-libraries. Then configure can put this information in the Makefile.
This would also be useful for point 4.
4. In src/lisp/num_gmp.lisp, in init-gmp the statement
(setf *gmp-multiplication-initialized* t)
is the 'else' branch of the last 'if'. I think it should be part of the 'then' branch, like
(if (ignore-errors
(|quiet_load_alien| wrapper-lib) t)
(progn
(install-gmp-multiplication)
(setf *gmp-multiplication-initialized* t))))))
Alternatively, 'when' could be used instead of 'if'.
5. On Mac OS, the gmp dynamic library, is called "libgmp.dylib", not "libgmp.so".
So, this must be patched in init-gmp. Moreover, as in my system it is in a non-standard location, either the full path name must be given, or the directory /opt/local/lib must be given in the environment variable LD_LIBRARY_PATH.
I have tried both: use in init-gmp:
(if (ignore-errors (|quiet_load_alien| "/opt/local/lib/libgmp.dylib") t)
or add
LD_LIBRARY_PATH=/opt/local/lib
export LD_LIBRARY_PATH
to the 'fricas' shell script.
In either case, configure must know the location, so this asks for the -gmp-libraries option mentioned in point 3 above.
With all changes mentioned above, fricas runs on Mac OS, with GMP support. The speedup with GMP is not as dramatic as mentioned in some previous messages, however. For example, on my MacBook, calculating 10^6 digits of 'e' goes from 354 sec. to 135 sec. I don't know if this means that the GMP is not working completely?
I am planning to make a macports port for fricas. As macports has a provision to provide patches for the build process, the problems mentioned above can be solved. However, for stand-alone builds, some changes should be made to the original sources.
--
Piet van Oostrum <
pi...@vanoostrum.org>
WWW:
http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]