You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Brandon Ehle <be...@pipedreaminteractive.com> on 2002/12/09 03:51:36 UTC

Re: Can't build SWIG python bindings

> 
>
>>>ld: can't locate file for: -lsvn_swig_py-1
>>>error: command 'gcc' failed with exit status 1
>>>make: *** [swig-py-ext] Error 1
>>>
>>>There appears to be no file named 'svn_swig_py-1.dylib' anywhere in
>>>the source/build tree.
>>>
>>>Mac OS X 10.2.2, GCC 3.1, Python 2.2.2, SWIG 1.3.17, Subversion
>>>r4069.
>>>      
>>>
>>Did you verify that 'make' built the svn_swig_py-1.dylib library?  Did
>>you configure with --with-swig?
>>    
>>
>
>Read the FAQ I just attached to the bottom of bindings/swig/INSTALL.
>  
>
If all else fails, I've got some patches that fix this issue at:
http://fishbowl.digitalbytes.net:81/svn/scripts/redhat8/subversion/

I believe the one in question is this:
http://fishbowl.digitalbytes.net:81/svn/scripts/redhat8/subversion/svn-py-swig.patch




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Can't build SWIG python bindings

Posted by Nicholas Riley <nj...@uiuc.edu>.
On Tue, Dec 10, 2002 at 09:06:53AM -0800, Brandon Ehle wrote:
> Its a difference in the latest SWIG version, you don't need the 
> underscore in the .i files, there is a patch in my directory for fixing 
> that too.

Bingo, thanks (swig-ignore-hack.patch was it).  The moral of the story
appears to be "don't use SWIG 1.3.17, use 1.3.16 if you want to build
without patches".  I thought it was just an omission and the configure
script meant to say "1.3.16 or later".  There were a couple of other
doc mentions that made me think the configure script was aat fault.
subversion/bindings/swig/INSTALL includes:

  Step 1:  Build & install the proper version of SWIG (which is
           currently swig 1.3.14 or greater).

and subversion/bindings/swig/README begins:

  NOTE: the bindings code is being developed using SWIG 1.3.12.
  Earlier versions of SWIG will simply *not* work.

So either the README and INSTALL files should change, or the configure
script and code should change to support >= 1.3.16 (or 1.3.17?)

-- 
=Nicholas Riley <nj...@uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Can't build SWIG python bindings

Posted by Brandon Ehle <be...@pipedreaminteractive.com>.
> 
>
>% mv _ra.so __ra.so
>% python
>Python 2.2.2 (#14, Nov 30 2002, 15:47:39)
>[GCC 3.1 20020420 (prerelease)] on darwin
>Type "help", "copyright", "credits" or "license" for more information.
>  
>
>>>>import __ra
>>>>dir(__ra)
>>>>        
>>>>
>['SVN_RA_ABI_VERSION', '__doc__', '__file__', '__name__', 'delete_svn_ra_callbacks_t', 'delete_svn_ra_plugin_t', 'delete_svn_ra_reporter_t', 'delete_svn_ra_simple_password_authenticator_t', 'delete_svn_ra_username_authenticator_t', 'new_svn...
>
>But obviously this is not a permanent solution.  Any idea where the
>extra underscore is coming from?
>
>  
>
Its a difference in the latest SWIG version, you don't need the 
underscore in the .i files, there is a patch in my directory for fixing 
that too.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Can't build SWIG python bindings

Posted by Nicholas Riley <nj...@uiuc.edu>.
On Sun, Dec 08, 2002 at 10:51:36PM -0500, Brandon Ehle wrote:
> >>Did you verify that 'make' built the svn_swig_py-1.dylib library?  Did
> >>you configure with --with-swig?

This was the first problem - configure only was accepting SWIG 1.3.16,
not 1.3.17 as I was using.  Fixed this in the m4 file, did an
autogen/configure/make/make install, and I got further.

> I believe the one in question is this:
> http://fishbowl.digitalbytes.net:81/svn/scripts/redhat8/subversion/svn-py-swig.patch

Thanks!  This patch looked like it should resolve the second problem I
ran into - svn_ra.i/svn_ra.c was not including swigutil_py.h (though
it should through its import of svn_types.i).  I tried removing the
#ifdefs around the #include in svn_types.i, but the #include was still
not present in the generated svn_ra.c.  Finally I included it
explicitly in svn_ra.i in a %{ %} block:

%module _ra
%include typemaps.i

%{
#include "swigutil_py.h"
%}
[...]

which worked for compilation albeit with a warning about a function
definition that appeared harmless.  But then I got a link error:

gcc -Wl,-F. -Wl,-flat_namespace,-U,_environ -bundle -framework Python /Users/nicholas/src/svn/obj/subversion/bindings/swig/python/build/temp.darwin-6.2-Power Macintosh-2.2/svn_ra.o -L/usr/local/encap/subversion/lib -L/usr/local/encap/httpd-2.0/lib -L/usr/local/encap/swig-1.3.17/lib -lsvn_ra-1 -lswigpy -o /Users/nicholas/src/svn/obj/subversion/bindings/swig/python/build/lib.darwin-6.2-Power Macintosh-2.2/svn/_ra.so
ld: warning multiple definitions of symbol _BC
/usr/local/fink/lib/libreadline.4.dylib(terminal.so) definition of _BC
/usr/local/fink/lib/libncurses.dylib.5(lib_termcap.o) definition of _BC
ld: warning multiple definitions of symbol _UP
/usr/local/fink/lib/libreadline.4.dylib(terminal.so) definition of _UP
/usr/local/fink/lib/libncurses.dylib.5(lib_termcap.o) definition of _UP
ld: warning multiple definitions of symbol _PC
/usr/local/fink/lib/libreadline.4.dylib(terminal.so) definition of _PC
/usr/local/fink/lib/libncurses.dylib.5(lib_tputs.o) definition of _PC
ld: Undefined symbols:
_acquire_py_lock
_release_py_lock
error: command 'gcc' failed with exit status 1

acquire_py_lock and release_py_lock are, of course, defined in
swigutil_py.c.  From your patch it was clear I needed to add
swigutil_py.c to the _ra compile line as well.  Compilation worked
fine at that point, but the module was built incorrectly somehow:

% python
Python 2.2.2 (#14, Nov 30 2002, 15:47:39)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _ra
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Loaded module does not contain symbol _init_ra
>>>

The problem appears to be that the symbol is not called _init_ra, but
rather _init__ra:

% file _ra.so
_ra.so: Mach-O bundle ppc
% nm _ra.so | grep init
00004854 t __wrap_svn_ra_dav_init
00004bd8 t __wrap_svn_ra_init_ra_libs
00004980 t __wrap_svn_ra_local_init
00004aac t __wrap_svn_ra_svn_init
         U _apr_initialize
00000f04 T _init__ra

I was able to fix the problem thusly:

% mv _ra.so __ra.so
% python
Python 2.2.2 (#14, Nov 30 2002, 15:47:39)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __ra
>>> dir(__ra)
['SVN_RA_ABI_VERSION', '__doc__', '__file__', '__name__', 'delete_svn_ra_callbacks_t', 'delete_svn_ra_plugin_t', 'delete_svn_ra_reporter_t', 'delete_svn_ra_simple_password_authenticator_t', 'delete_svn_ra_username_authenticator_t', 'new_svn...

But obviously this is not a permanent solution.  Any idea where the
extra underscore is coming from?

-- 
=Nicholas Riley <nj...@uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org