public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "F. Heitkamp" <heitkamp@ameritech.net>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: g++ libstdc++ linker question.
Date: Wed, 02 May 2012 11:02:00 -0000	[thread overview]
Message-ID: <4FA11442.9050001@ameritech.net> (raw)
In-Reply-To: <CAH6eHdTKUTYEvhS1mHGGS5LV7K6h+N5_qi1iyKXmNiXCLMpBYw@mail.gmail.com>

On 04/30/12 13:28, Jonathan Wakely wrote:
> On 30 April 2012 13:39, F. Heitkamp wrote:
>> People will tell me to ask on matplotlib list but I believe this a more
>> generic GNU C++ question.
>> I have been trying to run matplotlib that I built from source on my linux
>> from scratch like box.
>>
>> When I try to run an example I get:
>>
>> bash-4.2$ python2.6 matplotlib-ex1.py
>> Traceback (most recent call last):
>>   File "matplotlib-ex1.py", line 13, in<module>
>>     import matplotlib.pyplot as plt
>>   File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 23, in
>> <module>
>>     from matplotlib.figure import Figure, figaspect
>>   File "/usr/lib/python2.6/site-packages/matplotlib/figure.py", line 16, in
>> <module>
>>     import artist
>>   File "/usr/lib/python2.6/site-packages/matplotlib/artist.py", line 6, in
>> <module>
>>     from transforms import Bbox, IdentityTransform, TransformedBbox,
>> TransformedPath
>>   File "/usr/lib/python2.6/site-packages/matplotlib/transforms.py", line 34,
>> in<module>
>>     from matplotlib._path import affine_transform
>> ImportError: /usr/lib/python2.6/site-packages/matplotlib/_path.so: undefined
>> symbol:
>> _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
>>
>> I see this symbol is in 32 bits libstdc++ library, but does not seem to
>> appear in 64 bits versions.
> Right, the equivalent symbol in the 64-bit lib ends in _l instead of _i
>
>> bash-4.2$ ldd /usr/lib/python2.6/site-packages/matplotlib/_path.so
>>     linux-gate.so.1 =>    (0xffffe000)
>>     libpython2.6.so.1.0 =>  /usr/lib/libpython2.6.so.1.0 (0xf74f7000)
>>     libgcc_s.so.1 =>  /lib/libgcc_s.so.1 (0xf74de000)
>>     libpthread.so.0 =>  /lib/libpthread.so.0 (0xf74c4000)
>>     libc.so.6 =>  /lib/libc.so.6 (0xf7367000)
>>     libdl.so.2 =>  /lib/libdl.so.2 (0xf7362000)
>>     libutil.so.1 =>  /lib/libutil.so.1 (0xf735e000)
>>     libm.so.6 =>  /lib/libm.so.6 (0xf7338000)
>>     /lib/ld-linux.so.2 (0xf77d1000)
>>
>> libstdc++ is not shown as being linked with _path.so
>>
>> Any thoughts?
> Is _path.so a 32-bit or 64-bit library?  From the missing symbol I'm
> asuming 32-bit.
>
> It would appear it wasn't correctly linked, so its dependency on
> libstdc++.so isn't recorded in the library by a DT_NEEDED entry.
>
> Does it help if you tell the dynamic linker to preload libstdc++.so?
>
> LD_PRELOAD=/usr/lib/libstdc++.so python2.6 matplotlib-ex1.py
The answers to your questions are bellow.
The LD_PRELOAD comand worked (after changing the backend to PyQT4).
bash-4.2$ file /usr/lib/python2.6/site-packages/matplotlib/_path.so
/usr/lib/python2.6/site-packages/matplotlib/_path.so: ELF 32-bit LSB 
shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, 
not stripped


bash-4.2$ readelf -d  /usr/lib/python2.6/site-packages/matplotlib/_path.so

Dynamic section at offset 0xfb980 contains 26 entries:
   Tag        Type                         Name/Value
  0x00000001 (NEEDED)                     Shared library: 
[libpython2.6.so.1.0]
  0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
  0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
  0x00000001 (NEEDED)                     Shared library: [libc.so.6]
  0x0000000c (INIT)                       0x53d18
  0x0000000d (FINI)                       0xdaba8
  0x00000019 (INIT_ARRAY)                 0xfc1c8
  0x0000001b (INIT_ARRAYSZ)               36 (bytes)
  0x00000004 (HASH)                       0xd4
  0x00000005 (STRTAB)                     0x1261c
  0x00000006 (SYMTAB)                     0x552c
  0x0000000a (STRSZ)                      142332 (bytes)
  0x0000000b (SYMENT)                     16 (bytes)
  0x00000003 (PLTGOT)                     0xfcc88
  0x00000002 (PLTRELSZ)                   2160 (bytes)
  0x00000014 (PLTREL)                     REL
  0x00000017 (JMPREL)                     0x534a8
  0x00000011 (REL)                        0x36d08
  0x00000012 (RELSZ)                      116640 (bytes)
  0x00000013 (RELENT)                     8 (bytes)
  0x00000016 (TEXTREL)                    0x0
  0x6ffffffe (VERNEED)                    0x36c38
  0x6fffffff (VERNEEDNUM)                 3
  0x6ffffff0 (VERSYM)                     0x35218
  0x6ffffffa (RELCOUNT)                   1709

  0x00000000 (NULL)                       0x0
bash-4.2$


bash-4.2$ LD_PRELOAD=/lib/libstdc++.so python2.6 matplotlib-ex1.py
Traceback (most recent call last):
   File "matplotlib-ex1.py", line 13, in <module>
     import matplotlib.pyplot as plt
   File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 
95, in <module>
     new_figure_manager, draw_if_interactive, _show = pylab_setup()
   File 
"/usr/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 
25, in pylab_setup
     globals(),locals(),[backend_name])
   File 
"/usr/lib/python2.6/site-packages/matplotlib/backends/backend_wx.py", 
line 45, in <module>
     raise ImportError(missingwx)
ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8


  parent reply	other threads:[~2012-05-02 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 12:40 F. Heitkamp
2012-04-30 17:28 ` Jonathan Wakely
2012-04-30 17:47   ` Jonathan Wakely
2012-05-02 11:14     ` F. Heitkamp
2012-05-02 11:37       ` Andrew Haley
2012-05-02 11:02   ` F. Heitkamp [this message]
2012-05-03 12:14   ` F. Heitkamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA11442.9050001@ameritech.net \
    --to=heitkamp@ameritech.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).