Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbol error when calling swigibpy #44

Open
bpajusco opened this issue Mar 1, 2016 · 3 comments
Open

Undefined symbol error when calling swigibpy #44

bpajusco opened this issue Mar 1, 2016 · 3 comments

Comments

@bpajusco
Copy link

bpajusco commented Mar 1, 2016

I've tried to install the module in several ways on different versions of Python (2.7.10, 3.4 and 3.5) on Ubuntu 15.10 locally and in anaconda; I've tried pip install and a manual installation (setup install) but it makes no difference to the final result which is an import error. Incidentally, I'm able to use the IB API using ibpy and the Java interface but I'm really interested in getting your code to work. For completeness here is the full stack with the error message:

(py3k)bruno@bruno-VGN-SZ791N:~/IBJts$ python -c 'import swigibpy as ib; print(ib.version)'
Traceback (most recent call last):
File "", line 1, in
File "/home/bruno/anaconda/envs/py3k/lib/python3.5/site-packages/swigibpy-0.5.0-py3.5-linux-x86_64.egg/swigibpy.py", line 43, in
_swigibpy = swig_import_helper()
File "/home/bruno/anaconda/envs/py3k/lib/python3.5/site-packages/swigibpy-0.5.0-py3.5-linux-x86_64.egg/swigibpy.py", line 39, in swig_import_helper
_mod = imp.load_module('_swigibpy', fp, pathname, description)
File "/home/bruno/anaconda/envs/py3k/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/bruno/anaconda/envs/py3k/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/bruno/anaconda/envs/py3k/lib/python3.5/site-packages/swigibpy-0.5.0-py3.5-linux-x86_64.egg/_swigibpy.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE

@moconnell
Copy link

moconnell commented Oct 2, 2016

I see the same on Arch Linux, with Anaconda2 and regular Python 2.7 distro.

The build didn't look that healthy:

Searching for swigibpy
Reading https://pypi.python.org/simple/swigibpy/
Downloading https://pypi.python.org/packages/ea/1e/be62bba0191ecea775916ec4d335a637babb501b60d5c8649cc6059b1912/swigibpy-0.4.1.tar.gz#md5=2dee942f21c2e57ef50c024562005449
Best match: swigibpy 0.4.1
Processing swigibpy-0.4.1.tar.gz
Writing /tmp/easy_install-swbrsN/swigibpy-0.4.1/setup.cfg
Running swigibpy-0.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-swbrsN/swigibpy-0.4.1/egg-dist-tmp-r4pXz2
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
IB/swig_wrap.cpp: In function 'PyObject* _wrap_isPrice(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:36558:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClient_eConnect(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:20301:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClient_serverVersion(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3978:24: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyInt_FromLong((long) value);
          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
IB/swig_wrap.cpp:20414:7: note: 'result' was declared here
   int result;
       ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClient_checkMessages(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:21052:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_eConnect(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:23072:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_clientId(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3978:24: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyInt_FromLong((long) value);
          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
IB/swig_wrap.cpp:23185:7: note: 'result' was declared here
   int result;
       ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_isConnected(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:23233:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_isInBufferEmpty(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:23281:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_isOutBufferEmpty(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:23329:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_serverVersion(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3978:24: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyInt_FromLong((long) value);
          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
IB/swig_wrap.cpp:23377:7: note: 'result' was declared here
   int result;
       ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EClientSocketBase_checkMessages(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:24015:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EPosixClientSocket_eConnect(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:36146:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EPosixClientSocket_isSocketOK(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:36259:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EPosixClientSocket_fd(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3978:24: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyInt_FromLong((long) value);
          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
IB/swig_wrap.cpp:36307:7: note: 'result' was declared here
   int result;
       ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_EPosixClientSocket_handleSocketError(PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:36496:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_ComboLeg___eq__(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:16217:8: note: 'result' was declared here
   bool result;
        ^~~~~~
IB/swig_wrap.cpp: In function 'PyObject* _wrap_OrderComboLeg___eq__(PyObject*, PyObject*, PyObject*)':
IB/swig_wrap.cpp:3913:25: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return PyBool_FromLong(value ? 1 : 0);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
IB/swig_wrap.cpp:27770:8: note: 'result' was declared here
   bool result;
        ^~~~~~
zip_safe flag not set; analyzing archive contents...
swigibpy: module references __file__
creating /usr/lib/anaconda2/lib/python2.7/site-packages/swigibpy-0.4.1-py2.7-linux-x86_64.egg
Extracting swigibpy-0.4.1-py2.7-linux-x86_64.egg to /usr/lib/anaconda2/lib/python2.7/site-packages
Adding swigibpy 0.4.1 to easy-install.pth file

Then, attempting to use:

[root@c4d0886edda2 aim-common]# python
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from aim.broker.gateway import Gateway
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/aim-common/aim/broker/gateway.py", line 13, in <module>
    from swigibpy import Order, EWrapper, EPosixClientSocket, Contract as IbContract
  File "/usr/lib/anaconda2/lib/python2.7/site-packages/swigibpy.py", line 34, in <module>
    _swigibpy = swig_import_helper()
  File "/usr/lib/anaconda2/lib/python2.7/site-packages/swigibpy.py", line 30, in swig_import_helper
    _mod = imp.load_module('_swigibpy', fp, pathname, description)
ImportError: /usr/lib/anaconda2/lib/python2.7/site-packages/_swigibpy.so: undefined symbol: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE

@0liu
Copy link

0liu commented Oct 29, 2016

The same error happened on my Ubuntu 16.10 when trying to import swigibpy. Installing swigibpy was ok without any error.

Traceback:

Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:53:06) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import swigibpy
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-91bf51c164c9> in <module>()
----> 1 import swigibpy

/home/jesse/apps/anaconda3/lib/python3.5/site-packages/swigibpy.py in <module>()
     32                 fp.close()
     33             return _mod
---> 34     _swigibpy = swig_import_helper()
     35     del swig_import_helper
     36 else:

/home/jesse/apps/anaconda3/lib/python3.5/site-packages/swigibpy.py in swig_import_helper()
     28         if fp is not None:
     29             try:
---> 30                 _mod = imp.load_module('_swigibpy', fp, pathname, description)
     31             finally:
     32                 fp.close()

/home/jesse/apps/anaconda3/lib/python3.5/imp.py in load_module(name, file, filename, details)
    240                 return load_dynamic(name, filename, opened_file)
    241         else:
--> 242             return load_dynamic(name, filename, file)
    243     elif type_ == PKG_DIRECTORY:
    244         return load_package(name, filename)

/home/jesse/apps/anaconda3/lib/python3.5/imp.py in load_dynamic(name, path, file)
    340         spec = importlib.machinery.ModuleSpec(
    341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
    343 
    344 else:

ImportError: /home/jesse/apps/anaconda3/lib/python3.5/site-packages/_swigibpy.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE

@0liu
Copy link

0liu commented Oct 31, 2016

This is specific for Anaconda 4.2.0. The error does not show up with Anaconda 4.1.1, Intel Python, or Ubuntu/Debian official python.
A similar issue: ContinuumIO/anaconda-issues#1172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants