initial giac spkg

10 views
Skip to first unread message

Ondrej Certik

unread,
Aug 17, 2008, 2:56:02 PM8/17/08
to sage-...@googlegroups.com
Hi,

I went ahead and created the initial giac spkg here:

http://sage.math.washington.edu/home/ondrej/spkg/giac-0.8.0.spkg

Bernard, here is some info how to work with it:

http://www.sagemath.org/doc/prog/node24.html

Basically you just do:

$ sage -f giac-0.8.0.spkg

currently it fails right at the beginning with:

g++ -DHAVE_CONFIG_H -I. -I. -I.. -I. -I.. -g -O2 -c sym2poly.cc -fPIC
-DPIC -o .libs/sym2poly.lo
In file included from sym2poly.h:25,
from sym2poly.cc:32:
gen.h:28:18: error: mpfr.h: No such file or directory

but I think there should be mpfr.h in Sage. Giac builds on my Debian sid.

If you figure out what to pass to the configure to make this work,
please put your corrected package somewhere, or send me a mercurial
patch. When it builds, I'll write some Cython wrappers for it, so that
one can use it easily in Sage.

Thanks,
Ondrej

parisse

unread,
Aug 18, 2008, 12:54:19 PM8/18/08
to sage-devel

Thanks! I'm on vacation hence I can not make test during a few days.
It seems strange that the library mpfr is located by the configure
script but the header file is not. One way to force it is to modify
CXXFLAGS and add a -I flag to a path where mpfr.h is installed
(something like export CXXFLAGS='-I/usr/local/include/
custom_mpfr_install'). Unfortunately I don't know how to automate this
before ./configure is called using the spkg mechanism, and I must wait
a few days before being able to do tests. ANother solution which will
take more time is for me to add a --disable-mpfr flag (currently not
implemented) in configure.in.

Bernard

parisse

unread,
Aug 18, 2008, 12:55:16 PM8/18/08
to sage-devel
P.S.: if you succeed, before doing bindings, please switch to 0.8.1,
since some headers have been modified to allow execution of
independant sessions in parallel.

Ondrej Certik

unread,
Aug 18, 2008, 1:07:17 PM8/18/08
to sage-...@googlegroups.com
On Mon, Aug 18, 2008 at 6:54 PM, parisse
<bernard...@ujf-grenoble.fr> wrote:
>
>
> Thanks! I'm on vacation hence I can not make test during a few days.
> It seems strange that the library mpfr is located by the configure
> script but the header file is not. One way to force it is to modify
> CXXFLAGS and add a -I flag to a path where mpfr.h is installed
> (something like export CXXFLAGS='-I/usr/local/include/
> custom_mpfr_install'). Unfortunately I don't know how to automate this
> before ./configure is called using the spkg mechanism, and I must wait
> a few days before being able to do tests. ANother solution which will
> take more time is for me to add a --disable-mpfr flag (currently not
> implemented) in configure.in.

Ok, thanks for the reply. the spkg-install is just a bash-script, so
whatever you do in a script is possible. Here is how it looks like
currently:

http://sage.math.washington.edu/home/ondrej/spkg/giac-0.8.0/spkg-install

so I'll try your suggestion when I get some free while.

Ondrej

Martin Albrecht

unread,
Aug 18, 2008, 1:11:17 PM8/18/08
to sage-...@googlegroups.com
> Ok, thanks for the reply. the spkg-install is just a bash-script, so
> whatever you do in a script is possible. Here is how it looks like
> currently:
>
> http://sage.math.washington.edu/home/ondrej/spkg/giac-0.8.0/spkg-install

According to http://wiki.sagemath.org/SPKG_Audit this is what a standard/bare
minimum spkg-install script should look like.
---------------------------------------------------
#!/usr/bin/env bash

if [ "$SAGE_LOCAL" = "" ]; then
echo "SAGE_LOCAL undefined ... exiting";
echo "Maybe run 'sage -sh'?"
exit 1
fi

cd src

./configure --prefix="$SAGE_LOCAL"
if [ $? -ne 0 ]; then
echo "Error configuring PACKAGE_NAME."
exit 1
fi

make
if [ $? -ne 0 ]; then
echo "Error building PACKAGE_NAME."
exit 1
fi

make install
if [ $? -ne 0 ]; then
echo "Error installing PACKAGE_NAME."
exit 1
fi
---------------------------------------------------

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de

Ondrej Certik

unread,
Aug 18, 2008, 1:19:14 PM8/18/08
to sage-...@googlegroups.com

Ah I see thanks. I used some other spkg package as a template.

Ondrej

Martin Albrecht

unread,
Aug 18, 2008, 1:29:48 PM8/18/08
to sage-...@googlegroups.com
> Ah I see thanks. I used some other spkg package as a template.

Which one? It needs to be fixed :-)

Martin

Ondrej Certik

unread,
Aug 18, 2008, 1:37:34 PM8/18/08
to sage-...@googlegroups.com
On Mon, Aug 18, 2008 at 7:29 PM, Martin Albrecht
<ma...@informatik.uni-bremen.de> wrote:
>
>> Ah I see thanks. I used some other spkg package as a template.
>
> Which one? It needs to be fixed :-)

Well, some unofficial one:

http://sage.math.washington.edu/home/gfurnish/spkg/glib-2.14.5.spkg

I thought that's the way to do spkg packages.

Ondrej

mabshoff

unread,
Aug 18, 2008, 1:54:55 PM8/18/08
to sage-devel


On Aug 18, 10:37 am, "Ondrej Certik" <ond...@certik.cz> wrote:
> On Mon, Aug 18, 2008 at 7:29 PM, Martin Albrecht

Hi,

> <m...@informatik.uni-bremen.de> wrote:
>
> >> Ah I see thanks. I used some other spkg package as a template.
>
> > Which one? It needs to be fixed :-)

Yes :)

> Well, some unofficial one:
>
> http://sage.math.washington.edu/home/gfurnish/spkg/glib-2.14.5.spkg
>
> I thought that's the way to do spkg packages.

Nope, that one is likely a bad example.

> Ondrej

In general the issue you are hitting with Giac are bugs in its build
system. Setting CXXFLAGS work around those issues, but the proper fix
is that have a --with-$FOO=$LOCATION flag that then adds proper -I and
-L locations in the makefiles.

Cheers,

Michael

Ondrej Certik

unread,
Aug 19, 2008, 11:19:47 AM8/19/08
to sage-...@googlegroups.com
On Mon, Aug 18, 2008 at 7:54 PM, mabshoff <mabs...@googlemail.com> wrote:
>
>
>
> On Aug 18, 10:37 am, "Ondrej Certik" <ond...@certik.cz> wrote:
>> On Mon, Aug 18, 2008 at 7:29 PM, Martin Albrecht
>
> Hi,
>
>> <m...@informatik.uni-bremen.de> wrote:
>>
>> >> Ah I see thanks. I used some other spkg package as a template.
>>
>> > Which one? It needs to be fixed :-)
>
> Yes :)
>
>> Well, some unofficial one:
>>
>> http://sage.math.washington.edu/home/gfurnish/spkg/glib-2.14.5.spkg
>>
>> I thought that's the way to do spkg packages.
>
> Nope, that one is likely a bad example.

Next time I'll start from some of your spkg packages. :)

>
>> Ondrej
>
> In general the issue you are hitting with Giac are bugs in its build
> system. Setting CXXFLAGS work around those issues, but the proper fix
> is that have a --with-$FOO=$LOCATION flag that then adds proper -I and
> -L locations in the makefiles.

Yep. Bernard fixed that, so I updated the package:

http://sage.math.washington.edu/home/ondrej/spkg/giac-unstable.spkg

Now it fails with:

$ sage -f giac-unstable.spkg
[...]
Configuration done. Now type "make".
make all-recursive
make[1]: Entering directory
`/home/ondrej/ext/sage-3.1/spkg/build/giac-unstable/src'
Making all in src
make[2]: Entering directory
`/home/ondrej/ext/sage-3.1/spkg/build/giac-unstable/src/src'
/bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I.


-I.. -g -O2 -c sym2poly.cc

mkdir .libs


g++ -DHAVE_CONFIG_H -I. -I. -I.. -I. -I.. -g -O2 -c sym2poly.cc -fPIC
-DPIC -o .libs/sym2poly.lo

In file included from gen.h:39,


from sym2poly.h:25,
from sym2poly.cc:32:

vecteur.h:25:28: error: gsl/gsl_vector.h: No such file or directory
vecteur.h:26:28: error: gsl/gsl_matrix.h: No such file or directory
vecteur.h:27:33: error: gsl/gsl_permutation.h: No such file or directory
vecteur.h:270: error: expected constructor, destructor, or type
conversion before '*' token
vecteur.h:271: error: 'gsl_vector' has not been declared
vecteur.h:272: error: 'gsl_vector' has not been declared
vecteur.h:273: error: expected ',' or '...' before '*' token
vecteur.h:273: error: ISO C++ forbids declaration of 'gsl_vector' with no type
vecteur.h:274: error: 'gsl_matrix' has not been declared
vecteur.h:275: error: expected constructor, destructor, or type
conversion before '*' token
vecteur.h:276: error: expected ',' or '...' before '*' token
vecteur.h:276: error: ISO C++ forbids declaration of 'gsl_matrix' with no type
vecteur.h:277: error: expected ',' or '...' before '*' token
vecteur.h:277: error: ISO C++ forbids declaration of 'gsl_permutation'
with no type
make[2]: *** [sym2poly.lo] Error 1
make[2]: Leaving directory
`/home/ondrej/ext/sage-3.1/spkg/build/giac-unstable/src/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/ondrej/ext/sage-3.1/spkg/build/giac-unstable/src'
make: *** [all-recursive-am] Error 2
Error building giac.

real 0m33.790s
user 0m19.289s
sys 0m13.977s
sage: An error occurred while installing giac-unstable
Please email sage-devel http://groups.google.com/group/sage-devel
explaining the problem and send the relevant part of
of /home/ondrej/ext/sage/install.log. Describe your computer,
operating system, etc.
If you want to try to fix the problem, yourself *don't* just cd to
/home/ondrej/ext/sage/spkg/build/giac-unstable and type 'make'.
Instead type "/home/ondrej/ext/sage/sage -sh"
in order to set all environment variables correctly, then cd to
/home/ondrej/ext/sage/spkg/build/giac-unstable
(When you are done debugging, you can type "exit" to leave the
subshell.)

Bernard, could you please try this yourself and fix the package
yourself? First try to reproduce the above error. Then follow
the instructions that Sage printed, e.g.:

$ /home/ondrej/ext/sage/sage -sh
$ cd /home/ondrej/ext/sage/spkg/build/giac-unstable
$ ./spkg-install

Sage will of course print different paths in your case. It will
reproduce the problem and you will then look into the spkg-install
script and fix it. Your sources are in the src dir. Just send here a
patch that fixes the problem and I'll then help you create a new spkg
package if you don't figure it out yourself.

Now it's your turn. :)

Ondrej

parisse

unread,
Aug 20, 2008, 11:25:53 AM8/20/08
to sage-devel
Hi Ondrej,
Since I can't write in your folders, I had to make my own copy in
~parisse/spkg/build/giac-unstable. I added --disable-gsl --disable-
pari to the ./configure flags in spkg-install. It now builds when I
type ./spkg-install as you explained (but of course it errors at the
install step since I have no writing rights). The fixed spkg is
available at ~parisse/giac-unstable.spkg.
I will fix giac configure.in to check for GSL and PARI headers instead
of just for the libraries.
Good luck for your thesis!
Bernard

> Now it fails with:
>
> $ sage -f giac-unstable.spkg
> [...]

Ondrej Certik

unread,
Aug 20, 2008, 1:29:32 PM8/20/08
to sage-...@googlegroups.com
On Wed, Aug 20, 2008 at 5:25 PM, parisse
<bernard...@ujf-grenoble.fr> wrote:
>
> Hi Ondrej,
> Since I can't write in your folders, I had to make my own copy in
> ~parisse/spkg/build/giac-unstable. I added --disable-gsl --disable-
> pari to the ./configure flags in spkg-install. It now builds when I
> type ./spkg-install as you explained (but of course it errors at the
> install step since I have no writing rights). The fixed spkg is
> available at ~parisse/giac-unstable.spkg.
> I will fix giac configure.in to check for GSL and PARI headers instead
> of just for the libraries.
> Good luck for your thesis!
> Bernard

Great! It indeed installs fine now. Although it takes 72 minutes!

real 72m26.596s
user 56m9.639s
sys 10m44.480s

Why does it compile so slow, if ginac-lite can compile in 2 minutes?

Ondrej

parisse

unread,
Aug 20, 2008, 2:57:21 PM8/20/08
to sage-devel
> Great! It indeed installs fine now. Although it takes 72 minutes!
>
> real    72m26.596s
> user    56m9.639s
> sys     10m44.480s
>
> Why does it compile so slow, if ginac-lite can compile in 2 minutes?
>
> Ondrej

It maybe related to the use of template. sym2poly.cc and gausspol.cc
are the files which require much time to compile. One can of course
change CXXFLAGS e.g. to -g to compile it much faster, but that would
biais unfavorably the benchmarks.

Ondrej Certik

unread,
Aug 20, 2008, 4:10:54 PM8/20/08
to sage-...@googlegroups.com

Great!

Unfortunately, I won't have time soon to write some Cython wrappers
for it, but if you look at the ginac wrappers, basically you can just
copy it, e.g. look for example at this patch to get started:

http://trac.sagemath.org/sage_trac/attachment/ticket/3872/sage-3872_part1.patch

But at least we have now giac, that compiles in sage, this is a good
start. Even though I cannot continue, maybe it is already enough for
you to get started, e.g. I am sure you will not regret learning Cython
and then you have basically all you need to write Python wrappers to
giac.

Ondrej

Reply all
Reply to author
Forward
0 new messages