Hi,
Building Subversion trunk with SWIG 4 on Windows, the following errors occur:
C:\usr\apps\python38\include\pytime.h(123,67): warning C4115: 'timeval': named
type definition in parentheses
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(3636,39):
warning C4152: nonstandard extension, function/data pointer conversion in
expression
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(3726,9):
error C2065: 'svn_argnum_swig_obj': undeclared identifier
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(3726,9):
error C2109: subscript requires array or pointer type
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(3726,9):
error C2198: 'SWIG_Python_ArgFail': too few arguments for call
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
....
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(4832,9):
error C2065: 'svn_argnum_swig_obj': undeclared identifier
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(4832,9):
error C2109: subscript requires array or pointer type
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
C:\usr\src\subversion\trunk\subversion\bindings\swig\python\core.c(4832,9):
fatal error C1003: error count exceeds 100; stopping compilation
[C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj]
The command exited with code 2.
Done executing task "CL" -- FAILED.
Done building target "ClCompile" in project "python_core.vcxproj" -- FAILED.
Done Building Project
"C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_core.vcxproj"
(default targets) -- FAILED.
Done executing task "MSBuild" -- FAILED.
Done building target "ResolveProjectReferences" in project
"python_client.vcxproj" -- FAILED.
Done Building Project
"C:\usr\src\subversion\trunk\build\win32\vcnet-vcproj\python_client.vcxproj"
(default targets) -- FAILED.
...
87 Warning(s)
102 Error(s)
Time Elapsed 00:01:26.67
Investigating the issue, I noticed generated SWIG_PY_OPTS differs between Unix
and Windows.
<SWIG_PY_OPTS>-python -py3</SWIG_PY_OPTS>
should be "-python -py3 -nofastunpack" when SWIG 4 is used.
After attached patch, no differences of SWIG_PY_OPTS between Unix and Windows.
--
Jun Omae <[email protected]> (大前 潤)
* build/generator/gen_win_dependencies.py
(_find_python): Fix differences of SWIG_PY_OPTS between Unix and Windows.
Index: build/generator/gen_win_dependencies.py
===================================================================
--- build/generator/gen_win_dependencies.py (revision 1877275)
+++ build/generator/gen_win_dependencies.py (working copy)
@@ -1038,10 +1038,22 @@
return
if sys.version_info[0] >= 3:
- self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -py3"))
+ if self.swig_version < (3, 0, 10):
+ if show_warnings:
+ print("WARNING: Subversion Python bindings for Python 3 require SWIG
3.0.10 or newer")
+ return
+ if self.swig_version < (4, 0, 0):
+ opts = "-python -py3 -nofastunpack -modern"
+ else:
+ opts = "-python -py3 -nofastunpack"
else:
- self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -classic"))
+ if not ((1, 3, 24) <= self.swig_version < (4, 0, 0)):
+ if show_warnings:
+ print("WARNING: Subversion Python bindings for Python 2 require
1.3.24 <= SWIG < 4.0.0")
+ return
+ opts = "-python -classic"
+ self.user_macros.append(UserMacro("SWIG_PY_OPTS", opts))
self._libraries['python'] = SVNCommonLibrary('python', inc_dir, lib_dir,
None,
sys.version.split(' ')[0])