jamiebullock / LibXtract

LibXtract is a simple, portable, lightweight library of audio feature extraction functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python bindings

hannahwolfe opened this issue · comments

Hi, I am trying to get this working with python but when I type "make swig" I get the error

make[1]: Entering directory '/home/wolfie/code/LibXtract/src'
make[1]: 'libxtract.a' is up to date.
make[1]: Leaving directory '/home/wolfie/code/LibXtract/src'
make[1]: Entering directory '/home/wolfie/code/LibXtract/swig'
../include/xtract/libxtract.h:300: Warning 314: 'def' is a python keyword, renaming to '_def'
cc: error: Accelerate: No such file or directory
cc: error: unrecognized command line option ‘-framework’
Makefile:21: recipe for target 'python' failed
make[1]: *** [python] Error 1
make[1]: Leaving directory '/home/wolfie/code/LibXtract/swig'
Makefile:23: recipe for target 'swig' failed
make: *** [swig] Error 2

I modified the makefile to -DUSE_OOURA, and it built, but xtract.py gives me the error:

Traceback (most recent call last):
File "xtract.py", line 28, in
_xtract = swig_import_helper()
File "xtract.py", line 24, in swig_import_helper
_mod = imp.load_module('_xtract', fp, pathname, description)
ImportError: ./_xtract.so: undefined symbol: xtract_free_window

Hi,

I ran into the exact same problem (Linux / GCC 4.9.2).

Problem finally solved by modifying swig/Makefile l.23, replace:
@$(CC) $(LDFLAGS) ../src/lib$(NAME).a $(NAME)_wrap.o -o _$(NAME).so -framework Accelerate

By:
@$(CC) $(LDFLAGS) -o _$(NAME).so $(NAME)_wrap.o ../src/lib$(NAME).a

Which solves two issues:

  1. "-framework" should apparently be used only on Darwin platforms
  2. arguments order matters. From what I've understood, the _wrap.o object file must appear before the .a archive library, otherwise the linker won't search in the .a archive for the symbols defined in the object file -- which results in _xtract.so incorrectly linked/with undefined symbols

People might also be interested in a modified swig/test.py, compliant with Python 3.5 syntax
test.py.txt