* g++ libstdc++ linker question. @ 2012-04-30 12:40 F. Heitkamp 2012-04-30 17:28 ` Jonathan Wakely 0 siblings, 1 reply; 7+ messages in thread From: F. Heitkamp @ 2012-04-30 12:40 UTC (permalink / raw) To: gcc-help 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. 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? Fred ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 2012-04-30 12:40 g++ libstdc++ linker question F. Heitkamp @ 2012-04-30 17:28 ` Jonathan Wakely 2012-04-30 17:47 ` Jonathan Wakely ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Jonathan Wakely @ 2012-04-30 17:28 UTC (permalink / raw) To: F. Heitkamp; +Cc: gcc-help 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 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:02 ` F. Heitkamp 2012-05-03 12:14 ` F. Heitkamp 2 siblings, 1 reply; 7+ messages in thread From: Jonathan Wakely @ 2012-04-30 17:47 UTC (permalink / raw) To: F. Heitkamp; +Cc: gcc-help On 30 April 2012 18:28, Jonathan Wakely <jwakely.gcc@gmail.com> 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. P.S. you can check the DT_NEEDED tags by running: readelf -d /usr/lib/python2.6/site-packages/matplotlib/_path.so > 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 matplotlib I use is built with: python setupegg.py build_ext \ --rpath=/opt/gcc-4.4.3/lib64 python setupegg.py build python setupegg.py install --user The --rpath option ensures the right libstdc++.so is found at runtime (we have several installed). That build works here, and is linked to libstdc++.so. Unfortunately it builds matplotlib as a python egg, which is a very annoying package format. I'd rather not install it via egg, but have no experience doing so and can't suggest why your build was not linked to libstdc++. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 2012-04-30 17:47 ` Jonathan Wakely @ 2012-05-02 11:14 ` F. Heitkamp 2012-05-02 11:37 ` Andrew Haley 0 siblings, 1 reply; 7+ messages in thread From: F. Heitkamp @ 2012-05-02 11:14 UTC (permalink / raw) To: Jonathan Wakely; +Cc: gcc-help On 04/30/12 13:47, Jonathan Wakely wrote: > On 30 April 2012 18:28, Jonathan Wakely<jwakely.gcc@gmail.com> wrote: >> On 30 April 2012 13:39, F. Heitkamp wrote: >> > The matplotlib I use is built with: > > python setupegg.py build_ext \ > --rpath=/opt/gcc-4.4.3/lib64 > python setupegg.py build > python setupegg.py install --user > > The --rpath option ensures the right libstdc++.so is found at runtime > (we have several installed). That build works here, and is linked to > libstdc++.so. Unfortunately it builds matplotlib as a python egg, > which is a very annoying package format. I'd rather not install it > via egg, but have no experience doing so and can't suggest why your > build was not linked to libstdc++. > This last suggestion did not work for me. I got the same undefined symbol error. My linux setup is a 64 bits kernel running on sort of a hybrid 32/64 bits system. By that I mean I have some 64 bits userland along with the 32bits. When I configure python programs using the usual commands it comes back with arch x86_64. Anyway I guess this is getting off topic for this list now, but suggestions are welcome nonetheless. Fred ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 2012-05-02 11:14 ` F. Heitkamp @ 2012-05-02 11:37 ` Andrew Haley 0 siblings, 0 replies; 7+ messages in thread From: Andrew Haley @ 2012-05-02 11:37 UTC (permalink / raw) To: gcc-help On 05/02/2012 12:14 PM, F. Heitkamp wrote: > On 04/30/12 13:47, Jonathan Wakely wrote: >> On 30 April 2012 18:28, Jonathan Wakely<jwakely.gcc@gmail.com> wrote: >>> On 30 April 2012 13:39, F. Heitkamp wrote: >>> >> The matplotlib I use is built with: >> >> python setupegg.py build_ext \ >> --rpath=/opt/gcc-4.4.3/lib64 >> python setupegg.py build >> python setupegg.py install --user >> >> The --rpath option ensures the right libstdc++.so is found at runtime >> (we have several installed). That build works here, and is linked to >> libstdc++.so. Unfortunately it builds matplotlib as a python egg, >> which is a very annoying package format. I'd rather not install it >> via egg, but have no experience doing so and can't suggest why your >> build was not linked to libstdc++. > > This last suggestion did not work for me. I got the same undefined > symbol error. My linux setup is a 64 bits kernel running on sort of a > hybrid 32/64 bits system. By that I mean I have some 64 bits userland > along with the 32bits. When I configure python programs using the usual > commands it comes back with arch x86_64. Anyway I guess this is getting > off topic for this list now, but suggestions are welcome nonetheless. We really need you to answer this question: > Is _path.so a 32-bit or 64-bit library? From the missing symbol I'm > assuming 32-bit. And if it is compiled 32-bit, we need to know why. Andrew. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 2012-04-30 17:28 ` Jonathan Wakely 2012-04-30 17:47 ` Jonathan Wakely @ 2012-05-02 11:02 ` F. Heitkamp 2012-05-03 12:14 ` F. Heitkamp 2 siblings, 0 replies; 7+ messages in thread From: F. Heitkamp @ 2012-05-02 11:02 UTC (permalink / raw) To: Jonathan Wakely; +Cc: gcc-help 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: g++ libstdc++ linker question. 2012-04-30 17:28 ` Jonathan Wakely 2012-04-30 17:47 ` Jonathan Wakely 2012-05-02 11:02 ` F. Heitkamp @ 2012-05-03 12:14 ` F. Heitkamp 2 siblings, 0 replies; 7+ messages in thread From: F. Heitkamp @ 2012-05-03 12:14 UTC (permalink / raw) To: aph; +Cc: gcc-help We really need you to answer this question: > Is _path.so a 32-bit or 64-bit library? From the missing symbol I'm > assuming 32-bit. And if it is compiled 32-bit, we need to know why. It is 32 bit. Probably because the Python it's compiled against is 32 bit? I don't understand why the build process is not pulling in libstdc++ if _path.so needs it. Fred ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-03 12:14 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-30 12:40 g++ libstdc++ linker question 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 2012-05-03 12:14 ` F. Heitkamp
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).