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

nsound does not work with swig3, ubuntu 16 #5

Open
weegreenblobbie opened this Issue Jun 25, 2016 · 23 comments

Comments

Projects
None yet
1 participant
@weegreenblobbie
Owner

weegreenblobbie commented Jun 25, 2016

I'm having all kinds of problems on ubuntu 16 out of the box:

Ubuntu 16 default swig package is 3.X, which doesn't seem to work with nsound 0.9.4. After building and installing the python package with swig3, I get strange errors, as simple trying to construct a Sine generator:

import Nsound as ns
g = ns.Sine(44100)
#...
AttributeError: type object 'object' has no attribute '__getattr__'

Nsound partially works after installing the swig2.0 package:

sudo apt-get install swig2.0

Running unit tests from the git clone works as expeted:

python -m unittest discover
.....................................
----------------------------------------------------------------------
Ran 37 tests in 2.971s

OK

However trying to run one of the examples hangs in what appears to be an infinite loop:

cd src/examples
python example1.py
# no output, just hangs

Please fix for Ubuntu 16!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 10, 2017

Hello, wegreenblobbie.

I'm having the same issue in Fedora 24. Is there any solution at this moment besides downgrading swig?
Cheers

ghost commented Feb 10, 2017

Hello, wegreenblobbie.

I'm having the same issue in Fedora 24. Is there any solution at this moment besides downgrading swig?
Cheers

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 10, 2017

Owner

I haven't looked into this, I could take a look this weekend.

Owner

weegreenblobbie commented Feb 10, 2017

I haven't looked into this, I could take a look this weekend.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 11, 2017

That would be awesome!

ghost commented Feb 11, 2017

That would be awesome!

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 11, 2017

Owner

Partial success. It turns out that swig 3.08 (the packaged version in ubuntu 16.04) is buggy.

I manually installed swig 3.0.12, some things are working, unit tests are passing (I don't have much coverage), but some of the examples still hang.

Owner

weegreenblobbie commented Feb 11, 2017

Partial success. It turns out that swig 3.08 (the packaged version in ubuntu 16.04) is buggy.

I manually installed swig 3.0.12, some things are working, unit tests are passing (I don't have much coverage), but some of the examples still hang.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 11, 2017

I searched similar errors online and swig does seem buggy. I think this is useful:
swig/swig#553

ghost commented Feb 11, 2017

I searched similar errors online and swig does seem buggy. I think this is useful:
swig/swig#553

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 11, 2017

Owner

Yeah, I saw that too, but the -modern doesn't seem to have any impact with swig 3.0.12.

Owner

weegreenblobbie commented Feb 11, 2017

Yeah, I saw that too, but the -modern doesn't seem to have any impact with swig 3.0.12.

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 12, 2017

Owner

work in progress ...

Owner

weegreenblobbie commented Feb 12, 2017

work in progress ...

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 13, 2017

Owner

@respinha try out the branch "bugfix/issue5", you will need swig 3.0.12, let me know if it works for you.

My long term plan is to completely rewrite Nsound in c++14, the existing code base is very old and difficult to maintain. SWIG is also very painful, I may look into alternatives like cython, boost::python, or pybind11.

:)

Owner

weegreenblobbie commented Feb 13, 2017

@respinha try out the branch "bugfix/issue5", you will need swig 3.0.12, let me know if it works for you.

My long term plan is to completely rewrite Nsound in c++14, the existing code base is very old and difficult to maintain. SWIG is also very painful, I may look into alternatives like cython, boost::python, or pybind11.

:)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 13, 2017

@weegreenblobbie I removed the previously generated python files with a 'pip uninstall' and then tried the new branch and still doesn't work when I create a Sine.

PS: indeed, swig seems troublesome.

ghost commented Feb 13, 2017

@weegreenblobbie I removed the previously generated python files with a 'pip uninstall' and then tried the new branch and still doesn't work when I create a Sine.

PS: indeed, swig seems troublesome.

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 13, 2017

Owner

How did you install? You can check what version is installed by looking at Nsound.__version__. Make sure it reports 0.9.5.dev1.

You can also try to see if the unittests run with: scons --pytest

Owner

weegreenblobbie commented Feb 13, 2017

How did you install? You can check what version is installed by looking at Nsound.__version__. Make sure it reports 0.9.5.dev1.

You can also try to see if the unittests run with: scons --pytest

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 14, 2017

I installed as you suggest in the INSTALL file, running scons and then sudo python setup.py install.
I also tried running unittests and they all fail with the same error.

PS: yes, my version is 0.9.5.dev1

ghost commented Feb 14, 2017

I installed as you suggest in the INSTALL file, running scons and then sudo python setup.py install.
I also tried running unittests and they all fail with the same error.

PS: yes, my version is 0.9.5.dev1

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 14, 2017

Owner

Perhaps there is another issue, can you paste in the error. I'll try to run Fedora 24 in a VM to see if I can duplicate the error you're seeing.

Owner

weegreenblobbie commented Feb 14, 2017

Perhaps there is another issue, can you paste in the error. I'll try to run Fedora 24 in a VM to see if I can duplicate the error you're seeing.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 14, 2017

@weegreenblobbie it's the same error in all tests. Whenever an object of any type is created, it always crashes with this stacktrace:

File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 7522, in __init__
    self.this.append(this)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 7515, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Sine, name)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 74, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 69, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)

ghost commented Feb 14, 2017

@weegreenblobbie it's the same error in all tests. Whenever an object of any type is created, it always crashes with this stacktrace:

File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 7522, in __init__
    self.this.append(this)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 7515, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Sine, name)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 74, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
  File ".local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg/Nsound.py", line 69, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)
@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 14, 2017

Owner

What does swig -version report?

Owner

weegreenblobbie commented Feb 14, 2017

What does swig -version report?

@ghost

This comment has been minimized.

Show comment
Hide comment

ghost commented Feb 14, 2017

3.0.8

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 14, 2017

Owner

3.0.8 is buggy, can you install the latest? 3.012?

Owner

weegreenblobbie commented Feb 14, 2017

3.0.8 is buggy, can you install the latest? 3.012?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 14, 2017

Updated swig, removed all instances of Nsound and installed 0.9.5.dev1 and it still doesn't work.

ghost commented Feb 14, 2017

Updated swig, removed all instances of Nsound and installed 0.9.5.dev1 and it still doesn't work.

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 14, 2017

Owner

Same error? I guess I'll just have to get fedora 24 and see what's up. Thanks for the testing.

Owner

weegreenblobbie commented Feb 14, 2017

Same error? I guess I'll just have to get fedora 24 and see what's up. Thanks for the testing.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 14, 2017

I really doubt that it's something to do with Fedora but you can always check it out! I am planning to get started on the 'audio programming' world and Nsound really seems an interesting solution.

ghost commented Feb 14, 2017

I really doubt that it's something to do with Fedora but you can always check it out! I am planning to get started on the 'audio programming' world and Nsound really seems an interesting solution.

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 15, 2017

Owner

@respinha I just built nsound in a docker container using fedora:24, unittests ran fine. I suspect that swig 3.0.8 is somehow still getting used during the build. Here's my Dockerfile:

FROM fedora:24


RUN \
    dnf install  -vy     \
        gcc-c++.x86_64 \
        make.x86_64 \
        pcre-devel.x86_64 \
        python-devel.x86_64 \
        python.x86_64 \
        python2-matplotlib-tk.x86_64 \
        python2-numpy.x86_64 \
        redhat-rpm-config.noarch \
        scons.noarch \
        tar.x86_64 \
        unzip.x86_64 \
        wget.x86_64


RUN \
    cd /tmp/                                                              && \
    export SWIG_URL='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%3Fuse_mirror%3Dsuperb-sea2&ts=1487115624&use_mirror=svwh' && \
    wget -O swig-3.0.12.tar.gz "$SWIG_URL"                                && \
    tar xf swig*                                                          && \
    cd swig*                                                              && \
    ./configure --prefix=/usr                                             && \
    make -j 4                                                             && \
    make install


RUN \
    cd /tmp/                                                              && \
    wget https://github.com/weegreenblobbie/nsound/archive/bugfix/issue5.zip && \
    unzip issue5.zip                                                      && \
    ls -lh                                                                && \
    cd nsound*                                                            && \
    scons --pytest

Here's the output:

# ...
creating dist
creating 'dist/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
creating /root/.local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
Extracting Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg to /root/.local/lib/python2.7/site-packages
Adding Nsound 0.9.5.dev1 to easy-install.pth file

Installed /root/.local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
Processing dependencies for Nsound==0.9.5.dev1
Finished processing dependencies for Nsound==0.9.5.dev1
.........sss.........................
----------------------------------------------------------------------
Ran 37 tests in 0.591s

OK (skipped=3)
Owner

weegreenblobbie commented Feb 15, 2017

@respinha I just built nsound in a docker container using fedora:24, unittests ran fine. I suspect that swig 3.0.8 is somehow still getting used during the build. Here's my Dockerfile:

FROM fedora:24


RUN \
    dnf install  -vy     \
        gcc-c++.x86_64 \
        make.x86_64 \
        pcre-devel.x86_64 \
        python-devel.x86_64 \
        python.x86_64 \
        python2-matplotlib-tk.x86_64 \
        python2-numpy.x86_64 \
        redhat-rpm-config.noarch \
        scons.noarch \
        tar.x86_64 \
        unzip.x86_64 \
        wget.x86_64


RUN \
    cd /tmp/                                                              && \
    export SWIG_URL='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%3Fuse_mirror%3Dsuperb-sea2&ts=1487115624&use_mirror=svwh' && \
    wget -O swig-3.0.12.tar.gz "$SWIG_URL"                                && \
    tar xf swig*                                                          && \
    cd swig*                                                              && \
    ./configure --prefix=/usr                                             && \
    make -j 4                                                             && \
    make install


RUN \
    cd /tmp/                                                              && \
    wget https://github.com/weegreenblobbie/nsound/archive/bugfix/issue5.zip && \
    unzip issue5.zip                                                      && \
    ls -lh                                                                && \
    cd nsound*                                                            && \
    scons --pytest

Here's the output:

# ...
creating dist
creating 'dist/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
creating /root/.local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
Extracting Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg to /root/.local/lib/python2.7/site-packages
Adding Nsound 0.9.5.dev1 to easy-install.pth file

Installed /root/.local/lib/python2.7/site-packages/Nsound-0.9.5.dev1-py2.7-linux-x86_64.egg
Processing dependencies for Nsound==0.9.5.dev1
Finished processing dependencies for Nsound==0.9.5.dev1
.........sss.........................
----------------------------------------------------------------------
Ran 37 tests in 0.591s

OK (skipped=3)
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 15, 2017

It seems like I hadn't totally removed swig 3.0.8. It is now working!

ghost commented Feb 15, 2017

It seems like I hadn't totally removed swig 3.0.8. It is now working!

@weegreenblobbie

This comment has been minimized.

Show comment
Hide comment
@weegreenblobbie

weegreenblobbie Feb 15, 2017

Owner

Who hoo! 😎

Owner

weegreenblobbie commented Feb 15, 2017

Who hoo! 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment