If you’re building a swig Python module and encounter errors like:
1 |
AttributeError: 'Foobar' object has no attribute 'this' |
where Foobar is some class that is being wrapped, then you are encountering a swig-3.08 bug. Unfortunately this is still the official package in Ubuntu 16.04. You can vote for the issue here.
Until the package is updated, one can download and manually install an updated swig package by following the following recipe:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# install prerequisite sudo apt-get install libpcre3-dev # download swig 3.0.12 wget -O swig-3.0.12.tar.gz https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fswig%2Ffiles%2Fswig%2Fswig-3.0.12%2Fswig-3.0.12.tar.gz%2Fdownload&ts=1486782132&use_mirror=superb-sea2 # extract and configure tar xf swig-3.0.12.tar.gz cd swig-3.0.12 ./configure --prefix=/usr # build make -j 4 # install sudo make install # check version reported swig -version SWIG Version 3.0.12 Compiled with g++ [x86_64-pc-linux-gnu] Configured options: +pcre Please see http://www.swig.org for reporting bugs and further information |