scoder / acora

Fast multi-keyword search engine for text strings
http://pypi.python.org/pypi/acora
BSD 3-Clause "New" or "Revised" License
247 stars 17 forks source link

Can't build Acora 1.7 #2

Closed JDonner closed 12 years ago

JDonner commented 12 years ago

I've tried to build python acora 1.7 with python 3, as follows:

jd@outcrop:~/software/acora-1.7$ rm -rf build
jd@outcrop:~/software/acora-1.7$ python3 setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.2
creating build/lib.linux-x86_64-3.2/acora
copying acora/nfa2dfa.py -> build/lib.linux-x86_64-3.2/acora
copying acora/__init__.py -> build/lib.linux-x86_64-3.2/acora
copying acora/_nfa2dfa.py -> build/lib.linux-x86_64-3.2/acora
running build_ext
building 'acora._acora' extension
creating build/temp.linux-x86_64-3.2
creating build/temp.linux-x86_64-3.2/acora
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.2mu -c acora/_acora.c -o build/temp.linux-x86_64-3.2/acora/_acora.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-3.2/acora/_acora.o -o build/lib.linux-x86_64-3.2/acora/_acora.cpython-32mu.so
building 'acora._nfa2dfa' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.2mu -c acora/_nfa2dfa.c -o build/temp.linux-x86_64-3.2/acora/_nfa2dfa.o
acora/_nfa2dfa.c: In function ‘__pyx_pf_5acora_8_nfa2dfa_8NfaState_1__init__’:
acora/_nfa2dfa.c:886:13: warning: variable ‘__pyx_v_state_id’ set but not used [-Wunused-but-set-variable]
acora/_nfa2dfa.c: In function ‘__pyx_pf_5acora_8_nfa2dfa_8NfaState_7__deepcopy__’:
acora/_nfa2dfa.c:1410:13: warning: variable ‘__pyx_v_memo’ set but not used [-Wunused-but-set-variable]
acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa__visit_all’:
acora/_nfa2dfa.c:2025:43: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’
acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa_nfa2dfa’:
acora/_nfa2dfa.c:2423:45: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’
error: command 'gcc' failed with exit status 1
jd@outcrop:~/software/acora-1.7$ echo $PYTHONPATH

jd@outcrop:~/software/acora-1.7$ python3 --version
Python 3.2

jd@outcrop:~/software/acora-1.7$ python setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/acora
copying acora/nfa2dfa.py -> build/lib.linux-x86_64-2.7/acora
copying acora/__init__.py -> build/lib.linux-x86_64-2.7/acora
copying acora/_nfa2dfa.py -> build/lib.linux-x86_64-2.7/acora
running build_ext
building 'acora._acora' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/acora
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c acora/_acora.c -o build/temp.linux-x86_64-2.7/acora/_acora.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/acora/_acora.o -o build/lib.linux-x86_64-2.7/acora/_acora.so
building 'acora._nfa2dfa' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c acora/_nfa2dfa.c -o build/temp.linux-x86_64-2.7/acora/_nfa2dfa.o
acora/_nfa2dfa.c: In function ‘__pyx_pf_5acora_8_nfa2dfa_8NfaState_1__init__’:
acora/_nfa2dfa.c:886:13: warning: variable ‘__pyx_v_state_id’ set but not used [-Wunused-but-set-variable]
acora/_nfa2dfa.c: In function ‘__pyx_pf_5acora_8_nfa2dfa_8NfaState_7__deepcopy__’:
acora/_nfa2dfa.c:1410:13: warning: variable ‘__pyx_v_memo’ set but not used [-Wunused-but-set-variable]
acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa__visit_all’:
acora/_nfa2dfa.c:2025:43: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’
acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa_nfa2dfa’:
acora/_nfa2dfa.c:2423:45: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’
error: command 'gcc' failed with exit status 1
jd@outcrop:~/software/acora-1.7$ python --version
Python 2.7.1+

Any hint? Is it environmental? As shown above, PYTHONPATH is unset.

scoder commented 12 years ago

These errors are a clear indication that you are not building from the released sources:

acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa__visit_all’:
acora/_nfa2dfa.c:2025:43: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’
acora/_nfa2dfa.c: In function ‘__pyx_f_5acora_8_nfa2dfa_nfa2dfa’:
acora/_nfa2dfa.c:2423:45: error: ‘struct __pyx_obj_5acora_6_acora__NfaState’ has no member named ‘None’

Maybe you have Cython installed and accidentally rebuilt the C code files?

JDonner commented 12 years ago

Yes, that's right. In my attempts at building I would remove the 'build' dir but not the .c files. Though, cython regenerates the .c file unintentionally (to me) if I have the cython home directory in my PYTHONPATH.

$ echo $PYTHONPATH
/home/jd/software/Cython-0.15.1:/home/jd/software/python2.7.2/site-packages:

cython can be in the PATH but as long as the cython-home is not in PYTHONPATH it's fine. Is that behavior intended? Should I repost this to the cython-users list, given that the script's detection of whether to 'cython' may be the same for other scripts?

But anyway I've got it working now, thanks for the help!

# Partial run where cythoning happens from apparently normal build; see 2nd-to-last line. 
$ python setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/acora
copying acora/nfa2dfa.py -> build/lib.linux-x86_64-2.7/acora
copying acora/__init__.py -> build/lib.linux-x86_64-2.7/acora
copying acora/_nfa2dfa.py -> build/lib.linux-x86_64-2.7/acora
running build_ext
skipping 'acora/_acora.c' Cython extension (up-to-date)
building 'acora._acora' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/acora
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c acora/_acora.c -o build/temp.linux-x86_64-2.7/acora/_acora.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/acora/_acora.o -o build/lib.linux-x86_64-2.7/acora/_acora.so
cythoning acora/_nfa2dfa.py to acora/_nfa2dfa.c
building 'acora._nfa2dfa' extension
...
scoder commented 12 years ago

You can edit comments even after posting them (or at least, I can).

But you're right. Just because Cython is importable doesn't mean it should be used - certainly not to build a release. I was relying on Cython to detect that the sources were unchanged, but I now see that the acora/_nfa2dfa.py file in the release archive has a slightly newer timestamp than the generated .c file - my mistake, I guess. That's the problem then.

I'm not planning a new release any time soon (there were no changes since the last release), but I guess I should consider one when Cython 0.16 is out, just to get this resolved and to have the new archive based on a clean and up-to-date Cython version.

JDonner commented 12 years ago

Ok cool. Yes, I can edit it, if I mouse over the right place :) I've deleted my 'oops' comment. Is it up to me to close this, since I opened it? I'll do that.

ehooo commented 12 years ago

I have the same problem. How can i fix it? Thanks

scoder commented 12 years ago

@ehooo: see the comments above.