#19610: Fix dependencies on PARI
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  cython             |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jdemeyer/fix_dependencies_on_pari|  5d0e4d30588ab0f13bfc0770d2b4b407d7580035
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by fbissey):

 OK, you wanted me in on this.
 {{{
 fbissey@QCD-nzi3 ~ $ ldd -r /usr/lib64/python2.7/site-
 packages/sage/ext/interrupt/interrupt.so
         linux-vdso.so.1 (0x00007fffa4fff000)
         libpari-gmp-2.8.so.0 => /usr/lib64/libpari-gmp-2.8.so.0
 (0x00007fa7e3b1e000)
         libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0
 (0x00007fa7e375e000)
         libc.so.6 => /lib64/libc.so.6 (0x00007fa7e33c3000)
         libm.so.6 => /lib64/libm.so.6 (0x00007fa7e30bf000)
         libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007fa7e2e4e000)
         libdl.so.2 => /lib64/libdl.so.2 (0x00007fa7e2c49000)
         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa7e2a2d000)
         libutil.so.1 => /lib64/libutil.so.1 (0x00007fa7e282a000)
         /lib64/ld-linux-x86-64.so.2 (0x00007fa7e4564000)
 }}}
 but
 {{{
 fbissey@QCD-nzi3 ~ $ readelf -d /usr/lib64/python2.7/site-
 packages/sage/ext/interrupt/interrupt.so

 Dynamic section at offset 0x9d28 contains 26 entries:
   Tag        Type                         Name/Value
  0x0000000000000001 (NEEDED)             Shared library: [libpari-
 gmp-2.8.so.0]
  0x0000000000000001 (NEEDED)             Shared library:
 [libpython2.7.so.1.0]
  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
  0x000000000000000c (INIT)               0x2968
  0x000000000000000d (FINI)               0x84b4
  0x0000000000000019 (INIT_ARRAY)         0x209d10
  0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
  0x000000000000001a (FINI_ARRAY)         0x209d18
  0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
  0x000000006ffffef5 (GNU_HASH)           0x1c8
  0x0000000000000005 (STRTAB)             0xd90
  0x0000000000000006 (SYMTAB)             0x238
  0x000000000000000a (STRSZ)              1956 (bytes)
  0x000000000000000b (SYMENT)             24 (bytes)
  0x0000000000000003 (PLTGOT)             0x20a000
  0x0000000000000002 (PLTRELSZ)           2016 (bytes)
  0x0000000000000014 (PLTREL)             RELA
  0x0000000000000017 (JMPREL)             0x2188
  0x0000000000000007 (RELA)               0x1678
  0x0000000000000008 (RELASZ)             2832 (bytes)
  0x0000000000000009 (RELAENT)            24 (bytes)
  0x000000006ffffffe (VERNEED)            0x1628
  0x000000006fffffff (VERNEEDNUM)         1
  0x000000006ffffff0 (VERSYM)             0x1534
  0x000000006ffffff9 (RELACOUNT)          87
  0x0000000000000000 (NULL)               0x0
 }}}
 So `sage-on-gentoo` is built with `-Wl,--as-needed` which discard unneeded
 libraries. Because `interrupt.so` doesn't directly use `gmp` it is not
 kept. For that to work libpari has to be properly linked to libgmp - by
 that I mean, libgmp has to be in the `NEEDED` section of libpari.
 {{{
 fbissey@QCD-nzi3 ~ $ readelf -d /usr/lib64/libpari-gmp-2.8.so.0.0.0

 Dynamic section at offset 0x5ca6d8 contains 28 entries:
   Tag        Type                         Name/Value
  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
  0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
  0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.10]
  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
  0x000000000000000e (SONAME)             Library soname: [libpari-
 gmp-2.8.so.0]
  0x000000000000000c (INIT)               0x69900
  0x000000000000000d (FINI)               0x4fb194
  0x0000000000000019 (INIT_ARRAY)         0x7c98e8
  0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
  0x000000000000001a (FINI_ARRAY)         0x7c98f0
  0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
  0x000000006ffffef5 (GNU_HASH)           0x1c8
  0x0000000000000005 (STRTAB)             0x26570
  0x0000000000000006 (SYMTAB)             0x8090
  0x000000000000000a (STRSZ)              57218 (bytes)
  0x000000000000000b (SYMENT)             24 (bytes)
  0x0000000000000003 (PLTGOT)             0x7cb000
  0x0000000000000002 (PLTRELSZ)           85704 (bytes)
  0x0000000000000014 (PLTREL)             RELA
  0x0000000000000017 (JMPREL)             0x54a38
  0x0000000000000007 (RELA)               0x36e10
  0x0000000000000008 (RELASZ)             121896 (bytes)
  0x0000000000000009 (RELAENT)            24 (bytes)
  0x000000006ffffffe (VERNEED)            0x36d60
  0x000000006fffffff (VERNEEDNUM)         3
  0x000000006ffffff0 (VERSYM)             0x344f2
  0x000000006ffffff9 (RELACOUNT)          3899
  0x0000000000000000 (NULL)               0x0
 }}}

 Equivalently on OS X everything will be fine so long as all the
 `install_name`s are properly set to the right value.

 Yes it will break if your system only use static libraries. Static
 libraries don't know where to get their other needed bits - unless you
 bundle them in in the first place.

 I don't know if cygwin is properly equipped to deal with something like a
 `needed` section or even if it exists on windows (I'll confess ignorance
 in that matter). I also don't know how things will go on BSD, they are
 using elf but some bits may depend on the libc implementation and of
 course `ld`.

 Linking with `gmp` is not useful on OS X and linux but it won't hurt.

--
Ticket URL: <http://trac.sagemath.org/ticket/19610#comment:28>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to