Ximin Luo on Sun, 05 Feb 2017 13:28:46 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Giac for Debian: test suite segfaults with pthread pari


(please keep me in CC, I am not subscribed)

Hi all,

I'm trying to package Giac for Debian. The final motivation is for Sage 7.5.1, but in Debian we want to make these packages useful for non-Sage users as well, since they are independent from Sage.

In Sage, as well as Giac upstream, they build Giac with pari but without pthreads. It works fine, and the Gentoo packager for Sage has also got this working in Gentoo (including tests).

In Debian pari is compiled with pthreads. To make the compilation succeed, we need to patch Giac like this: https://git.archlinux.org/svntogit/community.git/tree/trunk/giac-pari-thread.patch?h=packages/giac

however I still get segfaults when running Giac's test suite. Stack thread is at the end of this email, but basically I think the reason is that 

src/kernel/none/level1.h:106
  if (x > (avma-pari_mainstack->bot) / sizeof(long))

here pari_mainstack is either NULL or uninitialised. So I guess we need to add some initialisation functions to Giac, to fix this problem. But I'm not familiar with pari, so I don't know what to do here. Any help or guidance would be appreciated.

Thanks!

Ximin

$ LANG= LC_MESSAGES= ../src/icas 
[..]
Reading symbols from /home/infinity0/var/lib/sage/giac/src/.libs/icas...done.
(gdb) run testcas
Starting program: /home/infinity0/var/lib/sage/giac/src/.libs/icas testcas
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffec4bf700 (LWP 11585)]
[New Thread 0x7fffebcbe700 (LWP 11586)]
[New Thread 0x7fffe94bd700 (LWP 11587)]
// Using locale /usr/share/locale/
// C
// /usr/share/locale/
// giac
// UTF-8
// Maximum number of parallel threads 4
Help file doc/local/aide_cas not found
Added 0 synonyms
Help file aide_cas not found
// Success

[..]

// Time 0
[New Thread 0x7fffa2c17700 (LWP 11738)]

Thread 155 "icas" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa2c17700 (LWP 11738)]
0x00007ffff774d0bb in new_chunk (x=3) at ../src/kernel/none/level1.h:106
106	../src/kernel/none/level1.h: No such file or directory.
(gdb) bt
#0  0x00007ffff774d0bb in new_chunk (x=3) at ../src/kernel/none/level1.h:106
#1  cgetg (y=1, x=3) at ../src/kernel/none/level1.h:154
#2  giac::zint2GEN (g=...) at pari.cc:426
#3  giac::ingen2GEN (e=..., vars=..., contextptr=contextptr@entry=0x0) at pari.cc:529
#4  0x00007ffff774dfd7 in giac::gen2GEN (e=..., vars=..., contextptr=contextptr@entry=0x0) at pari.cc:563
#5  0x00007ffff774e0a7 in giac::pari_isprime (e=..., certif=certif@entry=0) at pari.cc:597
#6  0x00007ffff7898beb in giac::_is_prime (args0=..., contextptr=0x7fffffffd2d0) at usual.cc:6331
#7  0x00007ffff788b2b4 in giac::unary_function_eval::operator() (this=this@entry=0x7ffff7dd4ba0 <giac::__is_prime>, arg=..., context_ptr=context_ptr@entry=0x7fffffffd2d0) at unary.h:200
#8  0x00007ffff71aafd2 in giac::symbolic::eval (this=<optimized out>, level=level@entry=25, contextptr=contextptr@entry=0x7fffffffd2d0) at symbolic.cc:1444
#9  0x00007ffff7983dba in giac::gen::in_eval (this=this@entry=0x7fffa2c167a0, level=level@entry=25, evaled=..., contextptr=0x7fffffffd2d0) at gen.cc:2109
#10 0x00007ffff798587a in giac::gen::eval (this=this@entry=0x7fffa2c167a0, level=level@entry=25, contextptr=contextptr@entry=0x7fffffffd2d0) at gen.cc:1893
#11 0x00007ffff770baf0 in giac::protecteval (g=..., level=25, contextptr=contextptr@entry=0x7fffffffd2d0) at prog.cc:7001
#12 0x00007ffff74e582b in giac::in_thread_eval (arg=0x555555972478) at global.cc:3467
#13 0x00007ffff338a424 in start_thread (arg=0x7fffa2c17700) at pthread_create.c:333
#14 0x00007ffff0ed79bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
(gdb) 

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git