Hello
I'm trying to run the stack of tasks on ubuntu 12.04, using only the command line (or the scripts with python -i)
I am encountering some issues when importing the symbols (from any library)
from robot_simu import RobotSimu
ImportError: cannot import name RobotSimu
And this error occur for any symbol of any library.
Note that the command
From ... import *
does not crash but it does not import anything either (...)
By running the command
ldd /wrap.so
I obtain two different results whether I compile on Ubuntu 12.04
ldd dynamic_graph/tracer/wrap.so
linux-vdso.so.1 => (0x00007fff4cb43000)
libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f1d95fe2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1d95c23000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f1d959c6000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f1d955fe000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1d953e7000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1d951c9000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1d94fc5000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f1d94dc2000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1d94ac5000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1d948af000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1d96709000)
or on ubuntu 10.04
ldd dynamic_graph/tracer/wrap.so
linux-gate.so.1 => (0x00b28000)
>> tracer.so
libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x00110000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x006f2000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00364000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x008ff000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0091e000)
libdynamic-graph.so.2.5.1-19-gcfdc-dirty
libboost_filesystem.so.1.40.0 => /usr/lib/libboost_filesystem.so.1.40.0 (0x006c2000)
libboost_system.so.1.40.0 => /usr/lib/libboost_system.so.1.40.0 (0x0038a000)
libboost_thread.so.1.40.0 => /usr/lib/libboost_thread.so.1.40.0 (0x0038f000)
libboost_program_options.so.1.40.0 => /usr/lib/libboost_program_options.so.1.40.0 (0x003a4000)
libboost_unit_test_framework.so.1.40.0 => /usr/lib/libboost_unit_test_framework.so.1.40.0 (0x00832000)
liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00c86000)
libblas.so.3gf => /usr/lib/libblas.so.3gf (0x003ec000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00469000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x0046d000)
libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x004d6000)
libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x0bd0f000)
libz.so.1 => /lib/libz.so.1 (0x00486000)
libutil.so.1 => /lib/tls/i686/cmov/libutil.so.1 (0x00bae000)
/lib/ld-linux.so.2 (0x004b9000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x0068a000)
libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x0051f000)
Since the library tracer.so is only linked on ubuntu 10.04, I think this error is really similar to the one detailed by Sebastien there:
#12,
ie that the flag --as-needed prevents the library wrap.so from linking with the adequate library.
Thus, I have canceled this flag by adding the following line on python.cmake
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} "-Wl,--no-as-needed")
in the branch topic/ubuntu12_04
This cancels the default flag "--as-needed" that is added on ubuntu 12.04, for each python library wrap.so
I have tested it on ubuntu 10.04 and ubuntu 12.04, and it works well.
If you're okay with, I'll push it on jrl-cmakemodules and synchronize some repo.
François
Note: I've tried with other flags (such as -u), but it's the only one that worked.
http://stackoverflow.com/questions/11917014/enforce-linking-with-a-shared-library-with-wl-as-needed-when-only-templates