modpython compilation error with swig 2.0.6 #104

Closed
opened 2026-10-05 03:59:07 +02:00 by adam · 3 comments
Owner
Generating ZNC API for python...
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (directorout) std::pair< CString,CString > = std::pair< CString,CString > &DIRECTOROUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (in) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (in) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (argout) std::pair< CString,CString > *OUTPUT = std::pair< CString,CString > *INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (argout) std::pair< CString,CString > &OUTPUT = std::pair< CString,CString > &INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (freearg) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT
/usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (freearg) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT
make[1]: *** [modpython/_znc_core.cpp] Error 11
``` Generating ZNC API for python... /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (directorout) std::pair< CString,CString > = std::pair< CString,CString > &DIRECTOROUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (in) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (in) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (argout) std::pair< CString,CString > *OUTPUT = std::pair< CString,CString > *INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (argout) std::pair< CString,CString > &OUTPUT = std::pair< CString,CString > &INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (typecheck) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (freearg) std::pair< CString,CString > *INPUT = std::pair< CString,CString > *INOUT /usr/share/swig/2.0.6/std/std_pair.i:31: Error: Can't copy typemap (freearg) std::pair< CString,CString > &INPUT = std::pair< CString,CString > &INOUT make[1]: *** [modpython/_znc_core.cpp] Error 11 ``` <!-- github-sync-id:4378227 -->
adam closed this issue 2026-10-05 03:59:08 +02:00
Author
Owner
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672035 <!-- github-comment-id:5952426 -->
Author
Owner

The following patch works around this swig problem:

Description: Qualify access to pair with std:: for SWIG.
SWIG seems to have problems with access to imported C++ namespaces.
William S. Fulton suggested to work around this by qualifying std::pair
in this email:
http://article.gmane.org/gmane.comp.programming.swig.devel/21772
.
This patch does just that and seems to fix building with SWIG 2.0.7.
In the long run this should of course be fixed in SWIG.
Author: Torsten Landschoff torsten@debian.org
Bug-Debian: http://bugs.debian.org/672035

--- znc-0.206.orig/modules/modpython/modpython.i
+++ znc-0.206/modules/modpython/modpython.i
@@ -174,10 +174,10 @@ public:

/* Web */

-%template(StrPair) pair<CString, CString>;
-%template(VPair) vector<pair<CString, CString> >;
-typedef vector<pair<CString, CString> > VPair;
-%template(VWebSubPages) vector<TWebSubPage>;
+%template(StrPair) std::pair<CString, CString>;
+%template(VPair) std::vector<std::pair<CString, CString> >;
+typedef std::vector<std::pair<CString, CString> > VPair;
+%template(VWebSubPages) std::vector<TWebSubPage>;

%inline %{
    void VPair_Add2Str_(VPair* self, const CString& a, const CString& b) {
The following patch works around this swig problem: Description: Qualify access to pair with std:: for SWIG. SWIG seems to have problems with access to imported C++ namespaces. William S. Fulton suggested to work around this by qualifying std::pair in this email: http://article.gmane.org/gmane.comp.programming.swig.devel/21772 . This patch does just that and seems to fix building with SWIG 2.0.7. In the long run this should of course be fixed in SWIG. Author: Torsten Landschoff torsten@debian.org Bug-Debian: http://bugs.debian.org/672035 ``` --- znc-0.206.orig/modules/modpython/modpython.i +++ znc-0.206/modules/modpython/modpython.i @@ -174,10 +174,10 @@ public: /* Web */ -%template(StrPair) pair<CString, CString>; -%template(VPair) vector<pair<CString, CString> >; -typedef vector<pair<CString, CString> > VPair; -%template(VWebSubPages) vector<TWebSubPage>; +%template(StrPair) std::pair<CString, CString>; +%template(VPair) std::vector<std::pair<CString, CString> >; +typedef std::vector<std::pair<CString, CString> > VPair; +%template(VWebSubPages) std::vector<TWebSubPage>; %inline %{ void VPair_Add2Str_(VPair* self, const CString& a, const CString& b) { ``` <!-- github-comment-id:6002303 -->
Author
Owner

I have merged this for now, thanks @Bluehorn. This works for SWIG 2.0.6.

I have merged this for now, thanks @Bluehorn. This works for SWIG 2.0.6. <!-- github-comment-id:6005290 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#104