[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Tell swig to look in it's lib dir

From: Blair Zajac <blair_at_orcaware.com>
Date: 2002-11-24 01:51:21 CET

Can somebody familiar with swig help out here.

There are two issues. The first is I have my swig installed in
/opt/i386-linux/installed/swig-1.3.16 and without this patch, I get
the following error.

cd /tmp/s/subversion/bindings/swig/python; \
 /opt/i386-linux/installed/python-2.2.2/bin/python setup.py \
  -I/tmp/s/subversion/bindings/swig \
  -I/tmp/s/subversion/include \
  -I/opt/i386-linux/installed/apache-2.0-cvs-2002112300/include \
  -S/tmp/s/subversion/bindings/swig \
  -L/opt/i386-linux/installed/subversion-r3870/lib \
  -L/opt/i386-linux/installed/apache-2.0-cvs-2002112300/lib \
  build --build-base=/tmp/s/subversion/bindings/swig/python/build
running build
running build_py
creating /tmp/s/subversion/bindings/swig/python/build
creating /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2
creating /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/__init__.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/ra.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/client.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/util.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/wc.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/delta.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/fs.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
copying svn/repos.py -> /tmp/s/subversion/bindings/swig/python/build/lib.linux-i686-2.2/svn
running build_ext
building '_client' extension
swigging /tmp/s/subversion/bindings/swig/svn_client.i to
  /tmp/s/subversion/bindings/swig/python/build/svn_client.c
/tmp/s/subversion/bindings/swig/python/build/svn_client.c:258:
  warning: function declaration isn't a prototype
/usr/bin/ld: cannot find -lswigpy

Even with the patch, my bindings cannot resolve the svn the swig libraries:

% ldd /opt/i386-linux/installed/subversion-r3870/lib/python2.2/site-packages/svn/_fs.so
        libsvn_fs-1.so.0 => not found
        libsvn_swig_py-1.so.0 => not found
        libswigpy.so => not found
        libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Everything else in svn builds fine and the other .so's resolve the shared
libraries ok. How are other people getting their bindings to find the .so's?

Thanks,
Blair

Support linking against Swig shared libraries when Swig's library
directory is not a standard system library directory.

* ac-helpers/swig.m4 (SVN_FIND_SWIG):
  Define and AC_SUBST on SWIG_LIBSWIG_DIR which is the location of
    Swig's swiglib, which is the output of swig -swiglib.
  Define and AC_SUBST on SWIG_LDFLAGS which is the directory one up from
    SWIG_LIBSWIG_DIR to -L$SWIG_LIBSWIG_DIR only if SWIG_LIBSWIG_DIR
    is not /lib or /usr/lib.

* Makefile.in (swig-py-ext):
  Clean up the rule to exit immediately if SWIG is not set and let the
    rest of the rule that does the work to be normal.
  Pass $(SWIG_LDFLAGS) to setup.py.

Index: Makefile.in
===================================================================
--- Makefile.in (revision 3870)
+++ Makefile.in (working copy)
@@ -67,6 +67,7 @@
 
 SWIG = @SWIG@
 SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@
+SWIG_LDFLAGS = @SWIG_LDFLAGS@
 
 SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
 SVN_APR_PREFIX = @SVN_APR_PREFIX@
@@ -261,20 +262,19 @@
         done
 
 swig-py-ext:
- if test -n "$(SWIG)"; then \
- cd $(SWIG_SRC_DIR)/python; \
+ @if test -z "$(SWIG)"; then \
+ echo 'SWIG variable is not defined; this rule is unavailable' >&2; \
+ echo 'Re-run configure --with-swig' >&2; \
+ exit 1; \
+ fi
+ cd $(SWIG_SRC_DIR)/python; \
         $(PYTHON) setup.py \
             -I$(SWIG_SRC_DIR) \
             -I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
             -S$(SWIG_SRC_DIR) \
             -L$(DESTDIR)$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
- -s"$(SWIG)" \
- build --build-base=$(SWIG_BUILD_DIR)/python/build; \
- else \
- echo 'SWIG variable is not defined; this rule is unavailable' >&2; \
- echo 'Re-run configure --with-swig' >&2; \
- exit 1; \
- fi
+ $(SWIG_LDFLAGS) \
+ build --build-base=$(SWIG_BUILD_DIR)/python/build
 
 install-swig-py-ext:
         (cd $(SWIG_BUILD_DIR)/python; \
Index: ac-helpers/swig.m4
===================================================================
--- ac-helpers/swig.m4 (revision 3870)
+++ ac-helpers/swig.m4 (working copy)
@@ -57,6 +57,25 @@
       SWIG_BUILD_RULES="$SWIG_BUILD_RULES swig-py-lib"
       SWIG_INSTALL_RULES="$SWIG_INSTALL_RULES install-swig-py-lib"
 
+ AC_CACHE_CHECK([for swig library directory], [ac_cv_swig_swiglib_dir],[
+ ac_cv_swig_swiglib_dir="`$SWIG -swiglib`"
+ ])
+ SWIG_LIBSWIG_DIR="$ac_cv_swig_swiglib_dir"
+
+ AC_CACHE_CHECK([if swig needs -L for its libraries],
+ [ac_cv_swig_ldflags],[
+ # The swig libraries are one directory above the
+ # `swig -swiglib` directory.
+ ac_cv_swig_ldflags=""
+ swig_lib_dir="`dirname $ac_cv_swig_swiglib_dir`"
+ if test "$swig_lib_dir" &&
+ test "$swig_lib_dir" != "/lib" &&
+ test "$swig_lib_dir" != "/usr/lib"; then
+ ac_cv_swig_ldflags="-L$swig_lib_dir"
+ fi
+ ])
+ SWIG_LDFLAGS="$ac_cv_swig_ldflags"
+
       AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[
         ac_cv_python_includes="`$PYTHON ${abs_srcdir}/ac-helpers/get-py-info.py --includes`"
       ])
@@ -66,4 +85,6 @@
   AC_SUBST(SWIG_BUILD_RULES)
   AC_SUBST(SWIG_INSTALL_RULES)
   AC_SUBST(SWIG_PY_INCLUDES)
+ AC_SUBST(SWIG_LIBSWIG_DIR)
+ AC_SUBST(SWIG_LDFLAGS)
 ])

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 24 01:51:42 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.