cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

import sage.all: undefined symbol: gdImageCreate #454

Closed krisk0 closed 7 years ago

krisk0 commented 7 years ago

Yersterday 06 Feb I took fresh versions of science and sage-on-gentoo overlays from github, then installed sage-7.5.1-r1:

# equery l -f '.*/sage-.*'
[I--] [??] sci-mathematics/sage-7.5.1-r1:0
[I--] [??] sci-mathematics/sage-data-combinatorial_designs-20140630:0
[I--] [??] sci-mathematics/sage-data-conway_polynomials-0.4-r3:0
[I--] [??] sci-mathematics/sage-data-elliptic_curves-0.8:0
[I--] [??] sci-mathematics/sage-data-graphs-20161026:0
[I--] [??] sci-mathematics/sage-data-polytopes_db-20120220:0

Today I tried to use Sage as a python package and found out that import sage.all does not work:

...
  File "sage/matrix/matrix_mod2_dense.pxd", line 4, in init sage.matrix.matrix_integer_dense (/tmp/portage/sci-mathematics/sage-7.5.1-r1/work/sage-7.5.1/src-python2_7/build/cythonized/sage/matrix/matrix_integer_dense.c:56543)
ImportError: /usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so: undefined symbol: gdImageCreate

I think I did Sage installation by the book. Used gcc-5.3.0. And media-libs/gd-2.0.35-r4:2 is installed. And /usr/lib64/libgd.so.2.0.0 defines gdImageCreate.

Will someone please help me, I want to do some linear algebra with Sage.

kiwifb commented 7 years ago

What does

ldd -r /usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so

and

readelf -d /usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so

report?

krisk0 commented 7 years ago

ldd:

    linux-vdso.so.1 (0x00007fff643fe000)
    libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007f5bf2e13000)
    libm4ri-0.0.20140914.so => /usr/lib64/libm4ri-0.0.20140914.so (0x00007f5bf2be1000)
    libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007f5bf2a01000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f5bf2664000)
    libpng16.so.16 => /usr/lib64/libpng16.so.16 (0x00007f5bf262f000)
    libgomp.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libgomp.so.1 (0x00007f5bf2603000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5bf23e8000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f5bf21e4000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007f5bf1fe0000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f5bf1ce5000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5bf3119000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f5bf1ccf000)
undefined symbol: gdImageCreate (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageColorAllocate  (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageFilledRectangle    (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageSetPixel   (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImagePngPtr (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdFree    (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageDestroy    (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageCreateFromPngPtr   (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageGetPixel   (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImagePng    (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)
undefined symbol: gdImageCreateFromPng  (/usr/lib64/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so)

readelf:


Dynamic section at offset 0x3b000 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000003 (PLTGOT)             0x3b3a0
 0x0000000000000002 (PLTRELSZ)           3672 (bytes)
 0x0000000000000017 (JMPREL)             0x5f48
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000007 (RELA)               0x2678
 0x0000000000000008 (RELASZ)             14544 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          558
 0x0000000000000006 (SYMTAB)             0x190
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x14b0
 0x000000000000000a (STRSZ)              3960 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x2428
 0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.10]
 0x0000000000000001 (NEEDED)             Shared library: [libm4ri-0.0.20140914.so]
 0x0000000000000001 (NEEDED)             Shared library: [libpython2.7.so.1.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x6da0
 0x000000000000000d (FINI)               0x345d8
 0x000000000000001a (FINI_ARRAY)         0x468c8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000019 (INIT_ARRAY)         0x468d0
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000006ffffff0 (VERSYM)             0x2490
 0x000000006ffffffc (VERDEF)             0x2628
 0x000000006ffffffd (VERDEFNUM)          1
 0x000000006ffffffe (VERNEED)            0x2644
 0x000000006fffffff (VERNEEDNUM)         1
 0x0000000000000000 (NULL)               0x0
kiwifb commented 7 years ago

libgd wasn't linked, this is strange, output of

pkg-config --libs gdlib
krisk0 commented 7 years ago

-lgd

kiwifb commented 7 years ago

That's all very curious. I cannot understand why it is not linked. What are your LDFLAGS? Do you use the gold or bfd linker (if you know)? Do you have a build log of sage?

krisk0 commented 7 years ago

Strange that Sage successfully installed via emerge -q sci-mathematics/sage without dependency media-libs/gd[jpeg,png]. At that moment media-libs/gd was compiled without jpeg and png flags. Portage package manager malfunctioned?

kiwifb commented 7 years ago

Possible. Underlinking a .so doesn't result in an error so it wouldn't have stopped the build. But portage should have ensured it was present at build time.

kiwifb commented 7 years ago

Need to get some sleep, try to emerge sage again to see if it goes away.

krisk0 commented 7 years ago

I re-installed gd with correct USE flags, then recompiled sage. The problem went away. I cannot understand why portage did not automagically rebuild media-libs/gd yersterday. Looks like packet db failure or portage bug. Thanks for help, kiwifb .