ImportError: /usr/lib64/libsvn_swig_py-1.so.0: undefined symbol: PyCapsule_Import

jontron
jontron
I just installed svn 1.8.14, and the python bindings appear to be broken on Red Hat Enterprise Linux Server release 6.7 (Santiago).  When running a hook script, the is the error that from google searches points to the bindings being compiled with a later version of python (rather than 2.6).     Commit blocked by pre-commit hook (exit code 1) with output: Traceback (most recent call last):  File "/svn/hooks/contrib/hook-scripts/case-insensitive.py", line 67, in    from svn import repos, fs  File "/usr/lib64/python2.6/site-packages/svn/repos.py", line 26, in   from libsvn.repos import *  File "/usr/lib64/python2.6/site-packages/libsvn/repos.py", line 26, in    _repos = swig_import_helper()  File "/usr/lib64/python2.6/site-packages/libsvn/repos.py", line 22, in  swig_import_helper  _mod = imp.load_module('_repos', fp, pathname, description) ImportError: /usr/lib64/libsvn_swig_py-1.so.0: undefined symbol:  PyCapsule_Import     Here is the rpm information:   # rpm -qiv subversion Name : subversion Relocations: /usr Version : 1.8.14 Vendor: WANdisco Inc Release : 1 Build Date: Thu 13 Aug 2015 07:56:14 AM MDT Install Date: Fri 21 Aug 2015 10:45:23 AM MDT Build Host: centos-60-x86-64.shdc.wandisco.com Group : Utilities/System Source RPM: subversion-1.8.14-1.src.rpm Size : 7864595 License: Apache 2.0 Signature : DSA/SHA1, Fri 14 Aug 2015 03:57:18 AM MDT, Key ID e9f0e9223bbf077a Packager : WANdisco Inc  URL : http://www.wandisco.com   # rpm -qiv subversion-python Name : subversion-python Relocations: /usr Version : 1.8.14 Vendor: WANdisco Inc Release : 1 Build Date: Thu 13 Aug 2015 07:56:14 AM MDT Install Date: Fri 21 Aug 2015 10:45:24 AM MDT Build Host: centos-60-x86-64.shdc.wandisco.com Group : Utilities/System Source RPM: subversion-1.8.14-1.src.rpm Size : 6313643 License: Apache 2.0 Signature : DSA/SHA1, Fri 14 Aug 2015 03:57:19 AM MDT, Key ID e9f0e9223bbf077a Packager : WANdisco Inc  URL : http://www.wandisco.com Summary : Allows Python scripts to directly use Subversion repositories.   % svn --version svn, version 1.8.14 (r1692801)  % python --version Python 2.6.6   Is there a way to find out how the bindings were compiled, or does anybody have an idea how I can fix this issue?   Thank you, Jon

Last updated

EBorisch
EBorisch
Just adding a "me, too" here. CentOS 6.; 2.6.32-573.3.1.el6.x86_64; up-to-date as of 8/31/2015.  Downgrading to 1.8.13-1 fixes things. Looks like Amazon had similar issues ( https://forums.aws.amazon.com/thread.jspa?threadID=174605 ) a few months ago...
drees
drees
Another "me, too". Also downgraded to 1.8.13-1.
svnsatya
svnsatya
I thought I had posted this earlier, but couldn't find it. Subversion now uses the PyCapsule API which is only available in Python 2.7. I was able to work around the API incompatibility for python2.6 by following the guide at https://docs.python.org/2/howto/cporting.html for supporting Capsule API in Python 2.6.  I am posting here in the hope this can be included in future builds and to help other users.  capsulethunk.h: https://hg.python.org/cpython/raw-file/2.7/Doc/includes/capsulethunk.h capsulethunk.patch:  --- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2015-12-15 19:40:06.000000000 -0800 +++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2015-12-15 19:34:05.000000000 -0800 @@ -39,6 +39,8 @@  #include "svn_client.h"  #include "svn_repos.h"   +#include "capsulethunk.h" +  /* Define DLL export magic on Windows. */  #ifdef __cplusplus  extern "C" {  find_python.patch:  --- build/find_python.sh 2015-12-15 20:07:28.000000000 -0800 +++ build/find_python.sh 2015-12-15 20:07:45.000000000 -0800 @@ -21,7 +21,7 @@  #    # Required version of Python -VERSION=${1:-0x2070000} +VERSION=${1:-0x2060000}    for pypath in "$PYTHON" "$PYTHON2" "$PYTHON3" python python2 python3; do  if [ "x$pypath" != "x" ]; then   subversion-1.9.x.spec.patch:  --- subversion-1.9.x.spec 2015-12-08 08:59:20.000000000 -0800 +++ subversion-1.9.x.spec 2015-12-15 20:09:01.000000000 -0800 @@ -10,6 +10,10 @@  %define swig_version 1.3.29  %define apache_dir /usr  %define pyver 2.6 +%define svn_version 1.9.3 +%define svn_source subversion-%{svn_version}.tar.gz +%define svn_rc "" +%define svn_release 1    %define perl_siteprefix %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)   @@ -24,10 +28,13 @@  Source: %{svn_source}  Source1: sqlite-amalgamation-3071602.zip  Source2: subversion.conf +Source3: capsulethunk.h    %if %{with timestamp}  Patch0: timestamp-replication-v5-1.8.txt  %endif +Patch1: capsulethunk.patch +Patch2: find_python.patch    Vendor: WANdisco Inc  Packager: WANdisco Inc  @@ -73,7 +80,7 @@    *** Note: This is a relocatable package; it can be installed anywhere you like  with the "rpm -Uvh --prefix /your/favorite/path" command. This is useful -if you don't have root access on your machine but would like to use this +if you do not have root access on your machine but would like to use this  package.    %if !%{without devel} @@ -147,6 +154,9 @@  %prep  %setup -n subversion-%{version}%{svn_rc}  %{?_with_timestamp:%patch0 -p0} +cp %SOURCE3 subversion/bindings/swig/python/libsvn_swig_py/ +%patch1 -p0 +%patch2 -p0    echo "Putting SQLite in to place"  rm -rf sqlite-amalgamation @@ -170,7 +180,7 @@  --with-apache-libexecdir=yes \  --with-gnome-keyring \  --enable-javahl \ - --with-jdk=/opt/jdk \ + --with-jdk=/usr/java/latest \  --without-jikes \  --with-sqlite=sqlite-amalgamation/sqlite3.c \  --enable-runtime-module-search \   Regards, Satya 

1-4 of 4

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.