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

python bindings #93

Open
hannahwolfe opened this issue May 7, 2016 · 1 comment
Open

python bindings #93

hannahwolfe opened this issue May 7, 2016 · 1 comment

Comments

@hannahwolfe
Copy link

hannahwolfe commented May 7, 2016

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

@sei-nicolas
Copy link

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

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

2 participants