zeek / pysubnettree

A Python Module for CIDR Lookups
Other
51 stars 20 forks source link

swig can't find header file in new location #18

Closed kitterma closed 4 years ago

kitterma commented 4 years ago

In Debian we rebuild SubnetTree_wrap.cc with swig every time we build the package, just to make sure we can with the swig version we have. With 0.32, this fails because SubnetTree.i wasn't updated for the new include directory. Please see the patch below that fixes the issue for me.

Scott K

--- pysubnettree-0.32.orig/SubnetTree.i
+++ pysubnettree-0.32/SubnetTree.i
@@ -1,8 +1,8 @@

 %module SubnetTree
 %{
-  #include "SubnetTree.h"
+  #include "include/SubnetTree.h"
 %}

-%include "SubnetTree.h"
+%include "include/SubnetTree.h"
jsiwek commented 4 years ago

Thanks for the report/patch, though that does break the CMake build, as in ./configure && ( cd build/ && make ).

Do you have an example of how you are running swig? Is it just from the Makefile? This patch may do the trick:

diff --git a/Makefile b/Makefile
index a4b22ff..88aeed5 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ TGZ=pysubnettree-$(VERSION)
 all: SubnetTree_wrap.cpp

 SubnetTree_wrap.cpp SubnetTree.py: SubnetTree.i include/SubnetTree.h
-   swig -c++ -python -o SubnetTree_wrap.cc SubnetTree.i
+   swig -c++ -python -Iinclude -o SubnetTree_wrap.cc SubnetTree.i

 clean:
    rm -rf $(CLEAN)

Let me know if that works for you. Or if you have an alternate script calling out to swig, the best thing to do may be to update it with the additional -I option.

kitterma commented 4 years ago

We build using the Makefile. That works. I'll add a patch to 0.32 to solve it that way. Thanks.

jsiwek commented 4 years ago

Release 0.33 also now exists with the Makefile patch.

kitterma commented 4 years ago

Thanks,

Scott K