chokkan / simstring

SimString
http://www.chokkan.org/software/simstring/
Other
114 stars 51 forks source link

Build error with Swig > 2.04 #7

Open esbullington opened 12 years ago

esbullington commented 12 years ago

Thanks for a great string retrieval package! Been using it with C++ and am setting it up to work with Python.

However, I was unable to build simstring for use with Python using Swig 2.04. My problem relates to the following issues, which were described in the Swig CHANGE doc for version 2.05:

2012-03-20: wsfulton Fix #3487706 and #3391906 - missing stddef.h include for ptrdiff_t when using %import for STL containers and compiling with g++-4.6. An include of stddef.h is now only generated when SWIG generates STL helper templates which require ptrdiff_t. If you were previously relying on "#include " always being generated when using a %include of an STL header, you may now need to add this in manually.

I was able to build simstring with Swig using the method recommended above: specifically, manually placing a "#include " in the "export_wrap.cpp" file. I don't know Swig well enough to propose a patch which would generate this automatically.

Thanks again.

geovedi commented 9 years ago

I'm using SWIG 2.0.10 and managed to solve this problem by adding -I/usr/include/sys in prepare.sh.

diff --git a/swig/python/prepare.sh b/swig/python/prepare.sh
index 2bf1095..e5a9ddd 100755
--- a/swig/python/prepare.sh
+++ b/swig/python/prepare.sh
@@ -7,5 +7,5 @@ ln -s ../export.i

 if [ "$1" = "--swig" ];
 then
-    swig -c++ -python -o export_wrap.cpp export.i
+    swig -c++ -I/usr/include/sys -python -o export_wrap.cpp export.i
 fi