sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

Create a giac package #12375

Closed frederichan-IMJPRG closed 9 years ago

frederichan-IMJPRG commented 12 years ago

The build of the GUI (xcas) has been disabled in the spkg-install to minimize the dependencies.

Sage packages:


The Sage giac package was built with spkg-src from the original giac 1.2.0-13 source: http://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_1.2.0-13.tar.gz


giacpy-sage git repository: https://gitlab.math.univ-paris-diderot.fr/han/giacpy-sage

worksheets and pdf examples https://www.imj-prg.fr/~frederic.han/xcas/giacpy/

Some interresting applications

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/grobner-libgiac.sws or https://www.imj-prg.fr/~frederic.han/xcas/giacpy/grobner-libgiac.pdf

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/giacpy-cubics.sws or https://www.imj-prg.fr/~frederic.han/xcas/giacpy/giacpy-cubics.pdf

Depends on #18494

Component: packages: optional

Keywords: giac

Author: Frederic Han

Branch: c7f6087

Reviewer: Dima Pasechnik, Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/12375

frederichan-IMJPRG commented 12 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,6 @@
 -submit an spkg for giac-0.9.5. (current stable version)

 NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.
+
+-the file (22MB) can be downloaded here:
+http://people.math.jussieu.fr/~han/xcas/giac-0.9.5.spkg
frederichan-IMJPRG commented 12 years ago

a copy of the SPKG.txt file included.

frederichan-IMJPRG commented 12 years ago

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
--submit an spkg for giac-0.9.5. (current stable version)
+-submit an spkg for giac-0.9.6. (current stable version)

 NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.

 -the file (22MB) can be downloaded here:
-http://people.math.jussieu.fr/~han/xcas/giac-0.9.5.spkg
+http://people.math.jussieu.fr/~han/xcas/giac-0.9.6.spkg
frederichan-IMJPRG commented 12 years ago
comment:4

Attachment: SPKG.txt

-update to giac 0.9.6

-The CFLAGS and CXXFLAGS settings in spkg-install had been removed because it was not necessary to force their values.

frederichan-IMJPRG commented 12 years ago
comment:5

The 0.9.6 had a bad choice of algorithm with big polynomials. Ex the test with (x+y+z+1)^n+1. for n>34.

frederichan-IMJPRG commented 12 years ago

Description changed:

--- 
+++ 
@@ -4,3 +4,6 @@

 -the file (22MB) can be downloaded here:
 http://people.math.jussieu.fr/~han/xcas/giac-0.9.6.spkg
+
+add the 0.9.7 version. (5 april 2012 version- testing branch)
+http://people.math.jussieu.fr/~han/xcas/giac-0.9.7.spkg
jdemeyer commented 12 years ago
comment:6

Please fill in your real name as Author.

frederichan-IMJPRG commented 12 years ago

Author: Han Frederic

frederichan-IMJPRG commented 12 years ago
comment:8

Updated to giac 0.9.8 (current stable) http://people.math.jussieu.fr/~han/xcas/giac-0.9.8.spkg

frederichan-IMJPRG commented 11 years ago

Description changed:

--- 
+++ 
@@ -1,9 +1,8 @@
--submit an spkg for giac-0.9.6. (current stable version)
+-submit an spkg for giac.

 NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.

--the file (22MB) can be downloaded here:
-http://people.math.jussieu.fr/~han/xcas/giac-0.9.6.spkg
+-the file (29MB) can be downloaded here:
+http://www.math.jussieu.fr/~han/xcas/sage/giac-1.0.0.spkg

-add the 0.9.7 version. (5 april 2012 version- testing branch)
-http://people.math.jussieu.fr/~han/xcas/giac-0.9.7.spkg
+
frederichan-IMJPRG commented 11 years ago
comment:9

upgrade the spkg to the current version of giac: 1.0.0

frederichan-IMJPRG commented 11 years ago
comment:12

Update to version 1.1 of giac.

http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.0.spkg

I have disabled pari in this spkg to avoid conflicts when using the giac library from cython such as in giacpy. (cf http://www.math.jussieu.fr/~han/xcas/giacpy/)

jondo commented 10 years ago
comment:15

Would this make giac available in the provided Sage VMs?

(Context: "Solving rational inequality should give simplified result")

frederichan-IMJPRG commented 10 years ago
comment:16

Replying to @jondo:

Would this make giac available in the provided Sage VMs?

(Context: "Solving rational inequality should give simplified result")

I believe that these examples are using the pexpect (communications through string) giac interface that is already in sage. So you just need an external giac program in your path. It could be installed from this spkg but by other ways also.

But you also need to create the following directory in you sage install:

  sage/local/share/sage/ext/giac  and   sage/local/share/sage/ext/giac/user 

I have added a new version of the spkg with 1.1.1 giac sources. http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.1.spkg

Best regards

frederichan-IMJPRG commented 10 years ago

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@

 NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.

--the file (29MB) can be downloaded here:
-http://www.math.jussieu.fr/~han/xcas/sage/giac-1.0.0.spkg
+-the file (48MB) can be downloaded here:
+http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.1.spkg
jondo commented 10 years ago
comment:18

In the mentioned sage-devel thread Dima Pasechnik asked: "Was there a vote carried out for inclusion of such an spkg?"

dimpase commented 10 years ago
comment:19

There are C++ errors when I try building this. One should use http://www.cplusplus.com/reference/unordered_map/unordered_map/ nowadays, not hash_map, which is gone for good.

See the attached log.

dimpase commented 10 years ago

log of the build attempt (on Sage 6.3.beta5), OSX 10.9

frederichan-IMJPRG commented 10 years ago
comment:20

Attachment: builderr.log

Replying to @dimpase:

There are C++ errors when I try building this. One should use http://www.cplusplus.com/reference/unordered_map/unordered_map/ nowadays, not hash_map, which is gone for good.

See the attached log.

Thank you for the feedback, I have reported this upstream because it is not a typical problem of the spkg. http://xcas.e.ujf-grenoble.fr/XCAS/viewtopic.php?f=4&t=1518

Best regards, Frederic

vbraun commented 10 years ago
comment:21

Since there is a Cython interface it would be much preferable to include that. Expect is always slow and prone to pty/synchronization bugs.

frederichan-IMJPRG commented 10 years ago
comment:22

Of course I agree that its better to have a cython interface, Feel free to add your comments on it here

https://github.com/sagemath/sage/issues/15226

I will be happy to have feedback and help! NB: I'am leaving in vacation tonight with bad or no internet, but after I will be happy to work on this

frederichan-IMJPRG commented 10 years ago

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@

 NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.

--the file (48MB) can be downloaded here:
-http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.1.spkg
+-the file (43MB) can be downloaded here:
+http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.2.spkg
frederichan-IMJPRG commented 10 years ago
comment:25

I have updated the giac spkg to the current giac version (1.1.2 testing) but I have tested this only on linux, in particular I don't have informations on os 10.9 (although I can compile this giac version on freebsd11) https://www.imj-prg.fr/~frederic.han/xcas/sage/giac-1.1.2.spkg

I have also done an spkg of the cython interface and called it giacpy. https://www.imj-prg.fr/~frederic.han/xcas/sage/giacpy-0.4.spkg

sample test:

from giacpy import *
libgiac.solve(x-x*exp(x/100-1)>0, x)

should give:

list[((x>0) and (x<100))]
dimpase commented 10 years ago
comment:26

Replying to Han Frederic:

I have updated the giac spkg to the current giac version (1.1.2 testing) but I have tested this only on linux, in particular I don't have informations on os 10.9 (although I can compile this giac version on freebsd11)

It does not work on OSX 10.9, with "standard" Sage complier, i.e. gcc 4.7.3. I still get things like

index.h:559:11: error: 'hash_map' in namespace 'std' does not name a type

(I also tried on Linux with gcc 4.8.something, and it worked there) I'll try the experimental Sage gcc 4.8.1 package, see if it helps.

frederichan-IMJPRG commented 10 years ago
comment:27

thank you, it could be a configure problem. could you have a look in your src/src/config.h about the values of this define

/* Define if <unordered_map> header is available */
#define C11_UNORDERED_MAP 1

...

/* Define if <ext/hash_map> header is aviailable */
#define EXT_HASH_MAP 1

/* Define if <hash_map> header is aviailable */
/* #undef HASH_MAP */

...

/* Define if <tr1/unordered_map> header is available */
#define UNORDERED_MAP 1

or try to force to

include

in src/src/index.h to see if the compilation goes on?

dimpase commented 10 years ago
comment:28

Replying to Han Frederic:

thank you, it could be a configure problem. could you have a look in your src/src/config.h about the values of this define

/* Define if <unordered_map> header is available */
#define C11_UNORDERED_MAP 1

...

/* Define if <ext/hash_map> header is aviailable */
#define EXT_HASH_MAP 1

/* Define if <hash_map> header is aviailable */
/* #undef HASH_MAP */

...

/* Define if <tr1/unordered_map> header is available */
#define UNORDERED_MAP 1

the 1st of these is undefined, the rest are defined in my case.

Probably your (and Redhat's) version of g++ is somehow different from the "normal" g++, and this makes the difference.

by the way, https://www.imj-prg.fr/~frederic.han/xcas/sage/giac-1.1.2.spkg is down. Could you host it somewhere else?

frederichan-IMJPRG commented 10 years ago
comment:29

On linux ubuntu 12.04 with gcc I have the same config.h as yours. (the previous config posted was with clang on freebsd, sorry I though it was closer to yours)

But I could have the same error as yours on os 10.7 with sage 5.6 and the sage gcc. I believe that the problem is this !defined(APPLE) line 47 of index.h

#if defined UNORDERED_MAP && !defined(__APPLE__) && !defined(__clang__) && !defined(VISUALC)

so it blocks the use of tr1/unordered_map.

I'have got success with the spkg and sage 5.6 on os 10.7 by changing line 47 with:

#if defined UNORDERED_MAP && !defined(__clang__) && !defined(VISUALC)

does it works for you also?

NB: The link seems repaired, sorry I still have bad internet now.

dimpase commented 10 years ago
comment:30

Replying to Han Frederic:

On linux ubuntu 12.04 with gcc I have the same config.h as yours. (the previous config posted was with clang on freebsd, sorry I though it was closer to yours)

But I could have the same error as yours on os 10.7 with sage 5.6 and the sage gcc. I believe that the problem is this !defined(APPLE) line 47 of index.h

#if defined UNORDERED_MAP && !defined(__APPLE__) && !defined(__clang__) && !defined(VISUALC)

so it blocks the use of tr1/unordered_map.

I'have got success with the spkg and sage 5.6 on os 10.7 by changing line 47 with:

#if defined UNORDERED_MAP && !defined(__clang__) && !defined(VISUALC)

does it works for you also?

yes it does.

The spkg still needs a bit of cleaning though. Also, currently it is an "old style" spkg.

If there is a "canonical" version of giac-1.1.2 somewhere it's better to provide it as the upstream tarball, and create patches; this is the "new style" of spkgs. See http://sagemath.org/doc/developer/packaging.html

frederichan-IMJPRG commented 10 years ago
comment:31

hello, so I have worked (and generated checksums) with the following upstream source

http://www-fourier.ujf-grenoble.fr/~parisse/giac/giac-1.1.1.tar.gz

(closed the 9 july 2014) because the 1.1.2 file will still evolve.

I have put the spkg scripts there:

https://www.imj-prg.fr/~frederic.han/xcas/sage/giac.tar.bz2

For the cython interface giacpy, I have put the upstream source file:

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/sage/giacpy-0.4.tar.gz

and the spkg scripts there:

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/sage/giacpy.tar.bz2

is it the correct way to distribute new spkg?

I got success with sage 6.2 on ubuntu 12.04 amd64 and osx 10.7.

frederichan-IMJPRG commented 10 years ago

Description changed:

--- 
+++ 
@@ -1,8 +1,5 @@
 -submit an spkg for giac.

-NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependecies.
-
--the file (43MB) can be downloaded here:
-http://www.math.jussieu.fr/~han/xcas/sage/giac-1.1.2.spkg
+NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependencies.
dimpase commented 10 years ago
comment:33

Replying to Han Frederic:

hello, so I have worked (and generated checksums) with the following upstream source

http://www-fourier.ujf-grenoble.fr/~parisse/giac/giac-1.1.1.tar.gz

(closed the 9 july 2014) because the 1.1.2 file will still evolve.

I have put the spkg scripts there:

https://www.imj-prg.fr/~frederic.han/xcas/sage/giac.tar.bz2

For the cython interface giacpy, I have put the upstream source file:

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/sage/giacpy-0.4.tar.gz

and the spkg scripts there:

https://www.imj-prg.fr/~frederic.han/xcas/giacpy/sage/giacpy.tar.bz2

is it the correct way to distribute new spkg?

Did you look at

http://sagemath.org/doc/developer/packaging.html

The scripts should come as a git branch for the Sage git tree, so that they can be "installed" by doing git checkout, more or less, and certainly not by untarring tarballs...

frederichan-IMJPRG commented 10 years ago

Branch: u/HanFrederic/submit_a_giac__spkg

frederichan-IMJPRG commented 10 years ago

Changed branch from u/HanFrederic/submit_a_giac__spkg to none

frederichan-IMJPRG commented 10 years ago

Branch: public/giac_spkg

frederichan-IMJPRG commented 10 years ago
comment:36

u/Han Frederic/submit_a_giac__spkg

frederichan-IMJPRG commented 10 years ago
comment:37

Sorry for this mess with the git branch, but I am lost. I first could do:

git trac checkout 12375

but I failed to push (I though it was a space problem so I tried to change the branch name) but now I have a Couldn't find remote ref public/giac_spkg

I have also tried to create a new one with: git trac create 'giac new style spkg' -b public/giac_spkg (ticket 16771) and I could do: git trac checkout 16771

but when I do

git trac push

I have:

Pushing to Trac #16771...
Guessed remote branch: u/Han Frederic/giac_new_style_spkg
Traceback (most recent call last):
  File "/usr/local/sage-6.2/local/bin/git-trac", line 18, in <module>
    cmdline.launch()
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/cmdline.py", line 132, in launch
    app.push(ticket_number)
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/app.py", line 147, in push
    self.repo.push(remote)
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/git_repository.py", line 150, in push
    self.git.echo.push('trac', 'HEAD:'+remote_branch)
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/git_interface.py", line 355, in meth
    return self.execute(git_cmd, *args, **kwds)
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/git_interface.py", line 98, in execute
    popen_stderr=subprocess.PIPE)
  File "/usr/local/sage-6.2/local/lib/python2.7/site-packages/git_trac/git_interface.py", line 262, in _run
    raise GitError(result)
git_trac.git_error.GitError: git returned with non-zero exit code (128) when executing "git push trac HEAD:u/Han Frederic/giac_new_style_spkg"
    STDERR: fatal: remote part of refspec is not a valid name in HEAD:u/Han Frederic/giac_new_style_spkg
dimpase commented 10 years ago
comment:38

Do you use git trac extension (https://github.com/sagemath/git-trac-command) ?

Do you have your ssh key etc already uploaded to trac, and are able to checkout stuff?

If this is working, the usual guess would be that one cannot have a space in the branch name. You may try pushing to public/blah instead.

frederichan-IMJPRG commented 10 years ago
comment:39

Yes I have used git-trac and uploaded my pub key, but most likely I have an ssh problem. I have made many tries, and may be my key manager started to offer the bad keys but now here is my last situation from start:

macbookito(fred)$ git-trac config --user 'Han Frederic' --pass 'XXXXXXXXXX'
Saved trac username.
Saved trac password.
Trac xmlrpc URL:
    http://trac.sagemath.org/xmlrpc (anonymous)
    http://trac.sagemath.org/login/xmlrpc (authenticated)
    realm sage.math.washington.edu
Username: Han Frederic
Password: XXXXXXXXX
Retrieving SSH keys...
    2048 b4:a3:58:12:d8:ae:5d:51:36:1b:99:4b:77:1a:d3:b9  fred@macbookito (RSA)
macbookito(fred)$ git remote -v
origin  https://github.com/sagemath/git-trac-command.git (fetch)
origin  https://github.com/sagemath/git-trac-command.git (push)
trac    git://trac.sagemath.org/sage.git (fetch)
trac    git@trac.sagemath.org:sage.git (push)
macbookito(fred)$ 

so trac found my public key and to check that I have the corresponding private key:

macbookito(fred)$ ssh-keygen -l 
Enter file in which the key is (/home/fred/.ssh/id_rsa): /home/fred/.ssh/id_rsa-trac
2048 b4:a3:58:12:d8:ae:5d:51:36:1b:99:4b:77:1a:d3:b9  fred@macbookito (RSA)

but if I try to test ssh as in the sage doc the offering key fails

macbookito(fred)$ ssh -v -i ~/.ssh/id_rsa-trac git@trac.sagemath.org info
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/fred/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to trac.sagemath.org [128.208.178.249] port 22.
debug1: Connection established.
debug1: identity file /home/fred/.ssh/id_rsa-trac type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/fred/.ssh/id_rsa-trac-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.3
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 21:ba:10:2a:59:cd:7d:36:f7:4c:52:bf:fc:5e:0e:07
debug1: Host 'trac.sagemath.org' is known and matches the ECDSA host key.
debug1: Found key in /home/fred/.ssh/known_hosts:54
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/fred/.ssh/id_rsa-trac
debug1: Authentications that can continue: publickey,password
...

could my key manager (during my first tries) had started to offer too many bad keys so that I am blacklisted or I may have miss some config problem.

dimpase commented 10 years ago
comment:40

So you never see

debug1: Server accepts key: ...

in the log above?

When I try the same, I see

debug1: Server host key: RSA 97:e0:9a:4e:40:7f:00:63:f7:b9:e6:cf:dd:cb:d2:6c

seems like we are connecting to different ssh servers...

dimpase commented 10 years ago
comment:41

The RSA/ECDSA thing was due to me having stored the RSA key of the host previously. Nothing weird here...

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Commit: 9562050

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

9562050add giac and giacpy pkg scripts
dimpase commented 10 years ago
comment:43

to get giac to compile on my Debian system, I had to

apt-get install libtool gettext

Is this (more precisely, what extra libs need to be installed, compared to the standard Sage setup) mentioned in the spkg docs?

In giac's SPKG.txt I see

== Dependencies == 
  * gettext, readline, gmp 
  * giac will benefits of ntl, pari, mpfr, gsl, lapack but they should be already installed by sage.

gmp (more precisely, its clone) is provided by Sage (and so it should be removed from the fist *'d line.

the 2nd *'d line has a typo: "benefits" -> "benefit"

dimpase commented 10 years ago
comment:44
sage -t --optional=sage,giac src/sage/interfaces/giac.py

produces several errors:

**********************************************************************
File "src/sage/interfaces/giac.py", line 38, in sage.interfaces.giac
Failed example:
    giac.fsolve('x^2=cos(x)+4', 'x','0..5')         # optional - giac
Expected:
    1.9140206190...
Got:
    [1.91402061903]
**********************************************************************
File "src/sage/interfaces/giac.py", line 229, in sage.interfaces.giac.Giac
Failed example:
    giac('assume(y>0)'); giac('y^2=3').solve('y')  #optional - giac
Expected:
    y
    [sqrt(3)]
Got:
    y
    list[sqrt(3)]
**********************************************************************
File "src/sage/interfaces/giac.py", line 257, in sage.interfaces.giac.Giac
Failed example:
    a=sqrt(2);giac('Digits:=30;a:=5');a,giac('a'),giac(a),giac(a).evalf()  # optional - giac
Expected:
    [...]
    (sqrt(2), 5, sqrt(2), 1.414213562373095048801688724209)
Got:
    30
    (sqrt(2), 5, sqrt(2), 1.41421356237309504880168872421)
**********************************************************************
File "src/sage/interfaces/giac.py", line 309, in sage.interfaces.giac.Giac._keyboard_interrupt
Failed example:
    try:                                   # optional - giac
        giac._keyboard_interrupt()
    except KeyboardInterrupt:
        pass
Exception raised:
    Traceback (most recent call last):
      File "/home/dima/sage/sage-6.3.beta7/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/dima/sage/sage-6.3.beta7/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.interfaces.giac.Giac._keyboard_interrupt[1]>", line 2, in <module>
        giac._keyboard_interrupt()
      File "/home/dima/sage/sage-6.3.beta7/local/lib/python2.7/site-packages/sage/interfaces/giac.py", line 322, in _keyboard_interrupt
        raise RuntimeError("Ctrl-c pressed while running %s"%self)
    RuntimeError: Ctrl-c pressed while running Giac
**********************************************************************
File "src/sage/interfaces/giac.py", line 986, in sage.interfaces.giac.GiacElement._latex_
Failed example:
    print latex(giac('(x^4 - y)/(y^2-3*x)'))      # optional - giac
Expected:
    "\frac{(x^{4}-y)}{(y^{2}-3 x)}"
Got:
    "\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"
**********************************************************************
File "src/sage/interfaces/giac.py", line 1042, in sage.interfaces.giac.GiacElement._sage_
Failed example:
    m.trigexpand().sage()                              # optional - giac
Expected:
    2*(cos(1/x) - 1)^2*sin(sqrt(-x^2 + 1))*cos(sqrt(-x^2 + 1))
Got:
    2*cos(sqrt(-x^2 + 1))*cos(1/x)^2*sin(sqrt(-x^2 + 1)) - 4*cos(sqrt(-x^2 + 1))*cos(1/x)*sin(sqrt(-x^2 + 1)) + 2*cos(sqrt(-x^2 + 1))*sin(sqrt(-x^2 + 1))
**********************************************************************
File "src/sage/interfaces/giac.py", line 1084, in sage.interfaces.giac.GiacElement.integral
Failed example:
    f.evalf(100)                                              # optional - giac
Expected:
    1.4626517459071819025155758073473096674669301007326185820691973210905694258465619632003390265815626744
Got:
    1.4626517459072
**********************************************************************
6 items had failures:
   1 of  22 in sage.interfaces.giac
   2 of  12 in sage.interfaces.giac.Giac
   1 of   4 in sage.interfaces.giac.Giac._keyboard_interrupt
   1 of   2 in sage.interfaces.giac.GiacElement._latex_
   1 of   5 in sage.interfaces.giac.GiacElement._sage_
   1 of   6 in sage.interfaces.giac.GiacElement.integral
    [159 tests, 7 failures, 3.36 s]
----------------------------------------------------------------------
sage -t src/sage/interfaces/giac.py  # 7 doctests failed

they should be fixed there.

frederichan-IMJPRG commented 10 years ago
comment:46

Yes I can reproduce all these diffs outside sage so it is not a problem of the spkg. For the loss in precision I have reported it on xcas forum to know if it is a long term change or a bug so I wait a little to know if it should be changed in giac.py.

But I have also looked at the cython interface and I found a problem that I didn't have with sage 5.11.

in the .pyx module I did:

cdef extern from "csage/interrupt.h":
    void setup_sage_signal_handler "setup_sage_signal_handler"()
setup_sage_signal_handler()

and it worked fine with sage 5.11. But with my sage 6.2, even if I do this in an empty module tutu.pyx, then after doing in sage:

import tutu

hitting a control-c in the prompt quits sage. Is there some way to set the good signal handler for interruptions?

dimpase commented 10 years ago
comment:47

Replying to @frederichan-IMJPRG:

Yes I can reproduce all these diffs outside sage so it is not a problem of the spkg. For the loss in precision I have reported it on xcas forum to know if it is a long term change or a bug so I wait a little to know if it should be changed in giac.py.

you can just set up higher tolerance in the corresponding doctests.

But I have also looked at the cython interface and I found a problem that I didn't have with sage 5.11.

in the .pyx module I did:

cdef extern from "csage/interrupt.h":
    void setup_sage_signal_handler "setup_sage_signal_handler"()
setup_sage_signal_handler()

and it worked fine with sage 5.11. But with my sage 6.2, even if I do this in an empty module tutu.pyx, then after doing in sage:

import tutu

hitting a control-c in the prompt quits sage. Is there some way to set the good signal handler for interruptions?

did you check in http://www.sagemath.org/doc/developer/coding_in_cython.html#interrupt-and-signal-handling

It could be that things got changed there since 5.11 (I don't know for sure; ask on sage-develop if problems persist here). Do you do sign_on and sign_off ?

jdemeyer commented 10 years ago
comment:48

Replying to @frederichan-IMJPRG:

In the .pyx module I did:

cdef extern from "csage/interrupt.h":
    void setup_sage_signal_handler "setup_sage_signal_handler"()
setup_sage_signal_handler()

Delete that and try again. Let me know if it still doesn't work.

Of course you need to add sig_on() and sig_off() around the C function calls, as explained in http://www.sagemath.org/doc/developer/coding_in_cython.html#using-sig-on-and-sig-off

jdemeyer commented 10 years ago

Description changed:

--- 
+++ 
@@ -1,5 +1 @@
--submit an spkg for giac.
-
-NB: the built of the gui (xcas) has been disabled in the  spkg-install to minimize the dependencies.
-
-
+The build of the GUI (`xcas`) has been disabled in the `spkg-install` to minimize the dependencies.
frederichan-IMJPRG commented 10 years ago
comment:50

Thank you for your answers, I have found more hints. In fact it is not a problem of sage 5.11 versus sage 6.2 but:

If giac is compiled without pari support then all is fine (without setup_sage_signal_handler()) while if I compile giac with pari support then I have the following problem (after hitting control-c).

sage: import giacpy
// Giac share root-directory:/usr/local/sage-6.2/local/share/giac/
// Using keyword file /usr/local/sage-6.2/local/share/giac/doc/fr/keywords
// Giac share root-directory:/usr/local/sage-6.2/local/share/giac/
Help file /usr/local/sage-6.2/local/share/giac/doc/fr/aide_cas not found
Added 0 synonyms
sage:   ***   user interrupt.

so it seems that my problem is that pari got the signal (there is no such message in giac sources). is there a way to restore the signal to sage?

jdemeyer commented 10 years ago
comment:51

Please add a link to the correct giac tarball in the ticket description, such that I can at least try it.