Bug#855078: giac: FTBFS: [algo.pdf] Error 139 (Segmentation fault)

Ximin Luo infinity0 at debian.org
Wed Feb 15 17:04:00 UTC 2017


On Mon, 13 Feb 2017 16:12:14 -0500 "Aaron M. Ucko" <ucko at debian.org> wrote:
> [..]
> 
>   xvfb-run ../../src/icas "algo.tex"
>   ./algo.tex:4: Warning: Command not found: \textheight
>   /usr/share/hevea/hyperref.hva:65: Warning: Ignoring option: 'pdftex'
>   /usr/share/hevea/hyperref.hva:65: Warning: Ignoring option: 'colorlinks'
>   ./algo.tex:33: Warning: Application of '\~' on 'p' failed
>   Exclude comment 'comment'
>   // Using locale /usr/share/locale/
>   // C
>   // /usr/share/locale/
>   // giac
>   // UTF-8
>   // Maximum number of parallel threads 3
>   // Unable to find keyword file doc/en/keywords
>   Help file doc/en/aide_cas not found
>   Added 0 synonyms
>   Giac pdflatex and HTML5 output
>   Partly inspired from pgiac by Jean-Michel Sarlat
>   Segmentation fault
>   Makefile:648: recipe for target 'algo.pdf' failed
>   make[4]: *** [algo.pdf] Error 139
>   make[4]: *** Waiting for unfinished jobs....
> 
> [..]

I was unable to get to the bottom of this, however here are my findings so far:

Upstream attempts to optimise on space, defining SMARTPTR64 when it is possible 
to store pointers in less than 64 bits. From src/gen.h:

    /* Warning: the size of a gen depend on the architecture and of compile-time flags
       Define -DSMARTPTR64 on 64 bit CPU if the pointers allocated by new are 48 bits
       this will make sizeof(gen)==8 instead of 16
    [..]

This *appears* to be force-disabled on ppc64el. From src/first.h:

    #ifndef __x86_64__
    #ifdef SMARTPTR64
    #undef SMARTPTR64
    #endif // SMARTPTR64
    [..]

Further evidence that it is force-disabled:

    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac$ uname -a
    Linux plummer 3.16.0-4-powerpc64le #1 SMP Debian 3.16.39-1 (2016-12-30) ppc64le GNU/Linux

    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac$ cat test.cc
    #include "src/giac/giac.h"
    #include <stdio.h>
    int main() { printf("%d\n", SMARTPTR64); }

    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac$ g++ test.cc
    test.cc: In function 'int main()':
    test.cc:3:29: error: 'SMARTPTR64' was not declared in this scope
     int main() { printf("%d\n", SMARTPTR64); }
                                 ^~~~~~~~~~
    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac$ g++ -DSMARTPTR64 test.cc
    test.cc: In function 'int main()':
    test.cc:3:29: error: 'SMARTPTR64' was not declared in this scope
     int main() { printf("%d\n", SMARTPTR64); }
                                 ^~~~~~~~~~
    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac$ g++ -DSMARTPTR64=1 test.cc
    test.cc: In function 'int main()':
    test.cc:3:29: error: 'SMARTPTR64' was not declared in this scope
     int main() { printf("%d\n", SMARTPTR64); }
                                 ^~~~~~~~~~

By editing src/icas one can run the failing build command in gdb:

    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac/doc/fr$ diff -ru ../../src/icas{.orig,}
    --- ../../src/icas.orig 2017-02-15 16:48:15.962658720 +0000
    +++ ../../src/icas      2017-02-15 16:48:29.294839196 +0000
    @@ -114,7 +114,7 @@
             $ECHO "icas:icas:$LINENO: newargv[0]: $progdir/$program" 1>&2
             func_lt_dump_args ${1+"$@"} 1>&2
           fi
    -      exec "$progdir/$program" ${1+"$@"}
    +      exec gdb -q -d ../../src "$progdir/$program" ${1+"$@"}
     
           $ECHO "$0: cannot exec $program $*" 1>&2
           exit 1

    (sid_ppc64el-dchroot)infinity0 at plummer:~/giac/doc/fr$ xvfb-run ../../src/icas
    Reading symbols from /home/infinity0/giac/src/.libs/icas...done.
    (gdb) run algo.tex
    Starting program: /home/infinity0/giac/src/.libs/icas algo.tex
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1".
    // Using locale /usr/share/locale/
    // C
    // /usr/share/locale/
    // giac
    // UTF-8
    // Maximum number of parallel threads 16
    // Unable to find keyword file doc/en/keywords
    Help file doc/en/aide_cas not found
    Added 0 synonyms
    Giac pdflatex and HTML5 output
    Partly inspired from pgiac by Jean-Michel Sarlat
    [New Thread 0x3fffb4f7eaa0 (LWP 17730)]

    Thread 2 "icas" received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0x3fffb4f7eaa0 (LWP 17730)]
    giac::gen::in_eval (this=0x5e38b0b8, level=<optimized out>, evaled=..., contextptr=0x3fffffff59f8) at gen.cc:2105
    2105                evaled=(*Sommet.ptr())(evaled,contextptr);
    (gdb) bt
    #0  giac::gen::in_eval (this=0x5e38b0b8, level=<optimized out>, evaled=..., contextptr=0x3fffffff59f8) at gen.cc:2105
    #1  0x00003fffb7d3b3e8 in giac::eval_VECT (g=..., evaled=..., subtype=<optimized out>, level=<optimized out>, contextptr=0x3fffffff59f8) at gen.cc:1755
    #2  0x00003fffb7d391cc in giac::in_eval_vect (g=..., evaled=..., level=25, contextptr=0x3fffffff59f8) at gen.cc:2025
    #3  0x00003fffb7d3aa34 in giac::gen::in_eval (this=0x5e38b4f0, level=25, evaled=..., contextptr=0x3fffffff59f8) at gen.cc:2046
    #4  0x00003fffb7d3adb8 in giac::gen::in_eval (this=0x5e38b518, level=<optimized out>, evaled=..., contextptr=0x3fffffff59f8) at gen.cc:2099
    #5  0x00003fffb7d3b3e8 in giac::eval_VECT (g=..., evaled=..., subtype=<optimized out>, level=<optimized out>, contextptr=0x3fffffff59f8) at gen.cc:1755
    #6  0x00003fffb7d391cc in giac::in_eval_vect (g=..., evaled=..., level=25, contextptr=0x3fffffff59f8) at gen.cc:2025
    #7  0x00003fffb7d3aa34 in giac::gen::in_eval (this=0x3fffb4f7dfa8, level=<optimized out>, evaled=..., contextptr=0x3fffffff59f8) at gen.cc:2046
    #8  0x00003fffb7d3bea4 in giac::gen::eval (this=0x3fffb4f7dfa8, level=<optimized out>, contextptr=<optimized out>) at gen.cc:1893
    #9  0x00003fffb7ac1b34 in giac::protecteval (g=..., level=<optimized out>, contextptr=<optimized out>) at prog.cc:7001
    #10 0x00003fffb78f7b6c in giac::in_thread_eval (arg=0x5e38a788) at global.cc:3467
    #11 0x00003fffb5c3809c in start_thread () from /lib/powerpc64le-linux-gnu/libpthread.so.0
    #12 0x00003fffb5631364 in clone () from /lib/powerpc64le-linux-gnu/libc.so.6
    (gdb) p contextptr
    $1 = (const giac::context *) 0x3fffffff59f8
    (gdb) p evaled
    $2 = (giac::gen &) @0x3fffb4f7d148: {type = 7 '\a', type_unused = 0 '\000', subtype = 1 '\001', reserved = 0, {val = -1342174656, __ZINTptr = 0x3fffb0000a40, __REALptr = 0x3fffb0000a40, __CPLXptr = 0x3fffb0000a40, 
        __IDNTptr = 0x3fffb0000a40, __SYMBptr = 0x3fffb0000a40, __MODptr = 0x3fffb0000a40, __EXTptr = 0x3fffb0000a40, __FRACptr = 0x3fffb0000a40, __POLYptr = 0x3fffb0000a40, __VECTptr = 0x3fffb0000a40, 
        __SPOL1ptr = 0x3fffb0000a40, __STRNGptr = 0x3fffb0000a40, _FUNC_ = 2952792640, __USERptr = 0x3fffb0000a40, __MAPptr = 0x3fffb0000a40, __EQWptr = 0x3fffb0000a40, __GROBptr = 0x3fffb0000a40, 
        __POINTERptr = 0x3fffb0000a40}}
    (gdb) p Sommet
    $3 = (giac::unary_function_ptr &) @0x5e38b5e8: {_ptr = 0x3fffb7f8bdf0 <giac::__pow>}
    (gdb) p Sommet.ptr()
    Cannot evaluate function -- may be inlined
    (gdb) p p gen::reserved
    No symbol "p" in current context.
    (gdb) p gen::reserved
    $4 = 65535
    (gdb) p gen::__SYMBptr
    There is no field named __SYMBptr
    (gdb) p gen::ref_SYMBptr()
    Cannot resolve method giac::gen::ref_SYMBptr to any overloaded instance
    (gdb) p &((ref_symbolic*)(* (ulonglong *) this >> 16))->s
    $5 = (giac::symbolic *) 0x40000007
    (gdb) p &__SYMBptr->s
    No symbol "__SYMBptr" in current context.

This highly suggests that SMARTPTR64 is in fact *enabled*, if you look at the 
definitions of

ref_SYMBptr in src/gen.h line 1470 onwards
__SYMBptr   in src/gen.h line 521 onwards

The last two commands I gave gdb, are the definitions of ref_SYMBptr() when 
SMARTPTR64 is enabled and disabled respectively.

I'll forward my findings upstream when I next have some more time.


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



More information about the debian-science-maintainers mailing list