Making a C++ program with the Giac library
Windows
:
If you are compiling with cygwin, the dll is installed by
the Xcas installer. If you are compiling with an other compiler,
you should use these DLL:
win32 dll,
win64 dll
Mingw 32 bits: get CodeBlocks
32 bits, install it, get
mingw giac 32 bits,
unzip it in your CodeBlocks/MinGW directory then you can
link a console project with giac by adding in Settings
Compiler, Linker settings in the libraries giacdll.
Or adapt this
example.
Mac OS
:
Follow these instructions
Linux
:
The easiest way if you have a Debian-based distribution (debian,
ubuntu, ...) is to install the giac debian package if your
distribution is supported or follow the quick debian/ubuntu install below.
On other distributions, you will have to compile giac from
source.
Example
The source code of giac has an
examples/demo folder, where you will find a test program
named pgcd.cc that you should
be able to compile (g++ pgcd.cc -lgiac -lgmp) once all
headers are correctly installed.
Now look at the info documentation of Giac
for data structures (like the gen type), etc.
Compiling Giac from source
-
Stable source
You can get the
latest stable source or
browse the directory of sources for a specific
version number.
These sources should compile with gcc from version 3.4.
-
Latest evolving source (version)
Available here (HTTP)
or
from Geogebra GIT.
- A
script
to compile Xcas under Unix
in your home directory, if you don't have root access.
If you do not have wget installed, download the
source file archive
with your browser and comment the wget line from the script with a #.
After compilation, run ~/runxcas.
- QT windows:
See this blog by
Zoltán Kovács, from the Geogebra dev team
-
SageMath users:
Frederic Han's giac bindings are now part of sage.
Just install the linux package of giac and install sage,
then giac(something) will convert from sage to giac.
For more information see
Frederic Han page
- Quick ubuntu/debian install
- Open a terminal and copy-paste the following commands:
sudo apt-get install gcc g++ libgmp-dev libmpfr-dev libmpfi-dev libpari-dev libgsl0-dev libxext-dev libpng-dev libjpeg-dev libreadline-dev libncurses5-dev mesa-common-dev libx11-dev libxt-dev libxft-dev libntl-dev libgl1-mesa-dev libgl-dev libao-dev hevea debhelper libecm1-dev libcliquer-dev libresample1-dev libxinerama-dev libsamplerate0-dev libfltk1.3-dev texlive-science
wget https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/giac-1.9.0.tar.gz
tar xfa giac-1.9.0.tar.gz
cd giac-1.9.0
./mkdebian
cd ..
sudo dpkg -i giac*deb
(N.B.: libpari-dev is sometimes named libpari1-dev).
Install libfltk1.3-dev (with sudo apt-get install)
or compile FLTK (see below).
-
Optionnaly install more up-to-date versions of the softwares below
-
Run ./mkdebian from giac directory.
-
Installing the required and optional libraries
- GMP (required),
or get it on
your distribution (apt-get install libgmp-dev on Debian)
- MPFR (highly recommended), or get it on
your distribution (apt-get install libmpfr-dev on Debian)
- NTL (recommended).
Untar, cd src and compile with
./configure NTL_GMP_LIP=on NTL_STD_CXX=on
make && make install
- PARI 2.x (recommended),
- GSL (recommended),
or get it on
your distribution (apt-get install libgsl0-dev on Debian)
- FLTK (required), you need FLTK 1.3.2
(sudo apt-get install libfltk1.3-dev) or compile this
patched 1.3 version.
- vectorclass (optionnal)
by Agner Fog, run export CXXFLAGS='-O2 -g -mfma -mavx2 -fabi-version=0'
before ./configure
-
Compiling GIAC
Once you have installed all the required libraries, to compile giac type
-
tar xvfz giac_unstable.tgz
(or tar xvfz giac_stable.tgz)
-
cd giac-1.9.0
(or cd giac-a.b.c)
-
sh configure
-
make
-
su
-
make install