pytries / hat-trie

HAT-Trie for Python
MIT License
86 stars 21 forks source link

Unable to build on linux #14

Closed desilinguist closed 10 years ago

desilinguist commented 10 years ago

When I clone the repo and run python setup.py build, I get the error below. I am on a 64-bit machine running RHEL 6.5 and gcc version 4.4.7.

running build
running build_ext
cythoning src/hat_trie.pyx to src/hat_trie.c
building 'hat_trie' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/hat-trie
creating build/temp.linux-x86_64-2.7/hat-trie/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ihat-trie/src -I/opt/python/2.7/include/python2.7 -c src/hat_trie.c -o build/temp.linux-x86_64-2.7/src/hat_trie.o
src/hat_trie.c: In function ‘__pyx_gb_8hat_trie_8BaseTrie_20generator’:
src/hat_trie.c:2082: warning: assignment discards qualifiers from pointer target type
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ihat-trie/src -I/opt/python/2.7/include/python2.7 -c hat-trie/src/ahtable.c -o build/temp.linux-x86_64-2.7/hat-trie/src/ahtable.o
In file included from hat-trie/src/ahtable.h:28,
                 from hat-trie/src/ahtable.c:8:
hat-trie/src/pstdint.h:457: error: conflicting types for ‘int64_t’
/usr/include/sys/types.h:198: note: previous declaration of ‘int64_t’ was here
error: command 'gcc' failed with exit status 1
kmike commented 10 years ago

Hi,

The error seems to be in bundled hat-trie C library. I think the proper place to fix it is https://github.com/dcjones/hat-trie/

desilinguist commented 10 years ago

Actually, I am able to clone and build the hat-trie C library from that URL just fine. Is it possible that the bundled C library is out of sync?

kmike commented 10 years ago

It is out of sync, but not much - recent changes to hat-trie C library didn't change anything code-wise. I believe pstdint.h file which caused an exception didn't change. It could be the case distutils uses gcc not the same as makefile from C library repo does, I'm not sure.

Could you please try building this wrapper without the latest commit (https://github.com/kmike/hat-trie/commit/b30b294d1c079e18068f8ddef7acfa2713cc427f)?

desilinguist commented 10 years ago

Thanks! I tried that and am still getting the same error. Is there a way to compile the wrapper with a pre-compiled version of the C library instead of using the one bundled with the wrapper?

mheilman commented 10 years ago

Updating pstdint.h to this version seems to fix this. I submitted a PR upstream: https://github.com/dcjones/hat-trie/pull/18

mheilman commented 10 years ago

That PR was merged, and I've submitted this one here to bring in the recent (minor) changes: #15.

desilinguist commented 10 years ago

Glad to see this has been resolved. Any chance we could do a new release so I can make a conda package via pypi? I can make one manually but it would be nice to be able to use pypi.

kmike commented 10 years ago

I've release hat-trie 0.2. Thanks for the help! Does it work for you?

desilinguist commented 10 years ago

It works perfectly! Thanks!