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

[PATCH] Don't link some Subversion libraries against unneeded external libraries

From: Arfrever Frehtes Taifersar Arahesis <arfrever.fta_at_gmail.com>
Date: 2007-10-06 00:00:32 CEST

Hello,

Currently Subversion libraries are linked against all external libraries used
by APR/APR-Util, but Subversion really uses only a subset of these libraries.
It is caused by needless use of e. g. `$apu_config --libs`.

$ apu-1-config --libs
 -lldap -llber -lgdbm -ldb-4.6 -lsqlite3 -lexpat
$

Subversion in no place used OpenLDAP or GDBM.
If I installed APR-Util with support for MySQL, PostgreSQL and FreeTDS, then
Subversion libraries would be needlessly linked against even larger amount of
external libraries.

I have written a patch which fixes this bug, but still preserves linking against
necessary libraries.

Results WITHOUT this patch:
$ scanelf -qF "%F: %n" /usr/lib/libsvn*.so /usr/bin/svn*
/usr/lib/libsvn_client-1.so: libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_delta-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libz.so.1,libc.so.6
/usr/lib/libsvn_diff-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_fs-1.so: libsvn_fs_fs-1.so.0,libsvn_fs_base-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libsvn_fs_util-1.so.0,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libsqlite3.so.0,libc.so.6
/usr/lib/libsvn_fs_base-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libsvn_fs_util-1.so.0,libc.so.6
/usr/lib/libsvn_fs_fs-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libsvn_fs_util-1.so.0,libc.so.6
/usr/lib/libsvn_fs_util-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libsqlite3.so.0,libc.so.6
/usr/lib/libsvnjavahl-1.so: libsvn_repos-1.so.0,libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libsvn_fs-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libdl.so.2,libneon.so.27,libstdc++.so.6,libm.so.6,libpthread.so.0,libc.so.6,libgcc_s.so.1
/usr/lib/libsvn_ra-1.so: libsvn_ra_local-1.so.0,libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_ra_svn-1.so.0,libsvn_ra_neon-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_ra_local-1.so: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_ra_neon-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libneon.so.27,libc.so.6
/usr/lib/libsvn_ra_svn-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libsasl2.so.2,libc.so.6
/usr/lib/libsvn_repos-1.so: libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_subr-1.so: libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libz.so.1,libc.so.6
/usr/lib/libsvn_swig_perl-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_swig_py-1.so: libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_swig_ruby-1.so: libruby18.so.1.8,libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/lib/libsvn_wc-1.so: libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libldap-2.3.so.0,liblber-2.3.so.0,libgdbm.so.3,libdb-4.6.so,libsqlite3.so.0,libexpat.so.1,libapr-1.so.0,libuuid.so.1,librt.so.1,libcrypt.so.1,libpthread.so.0,libdl.so.2,libc.so.6
/usr/bin/svn: libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_diff-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnadmin: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svndumpfilter: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnlook: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnserve: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libsvn_ra_svn-1.so.0,libapr-1.so.0,libsasl2.so.2,libpthread.so.0,libc.so.6
/usr/bin/svnsync: libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnversion: libsvn_wc-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
$

Results WITH this patch:
$ scanelf -qF "%F: %n" /usr/lib/libsvn*.so /usr/bin/svn*
/usr/lib/libsvn_client-1.so: libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_delta-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libz.so.1,libpthread.so.0,libc.so.6
/usr/lib/libsvn_diff-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_fs-1.so: libsvn_fs_fs-1.so.0,libsvn_fs_base-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libsvn_fs_util-1.so.0,libapr-1.so.0,libsqlite3.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_fs_base-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libdb-4.6.so,libsvn_fs_util-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_fs_fs-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libsvn_fs_util-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_fs_util-1.so: libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libsqlite3.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvnjavahl-1.so: libsvn_repos-1.so.0,libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libsvn_fs-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libneon.so.27,libstdc++.so.6,libm.so.6,libpthread.so.0,libc.so.6,libgcc_s.so.1
/usr/lib/libsvn_ra-1.so: libsvn_ra_local-1.so.0,libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_ra_svn-1.so.0,libsvn_ra_neon-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_ra_local-1.so: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_ra_neon-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libneon.so.27,libpthread.so.0,libc.so.6
/usr/lib/libsvn_ra_svn-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libsasl2.so.2,libpthread.so.0,libc.so.6
/usr/lib/libsvn_repos-1.so: libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_subr-1.so: libaprutil-1.so.0,libapr-1.so.0,libexpat.so.1,libz.so.1,libpthread.so.0,libc.so.6
/usr/lib/libsvn_swig_perl-1.so: libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_swig_py-1.so: libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_swig_ruby-1.so: libruby18.so.1.8,libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/lib/libsvn_wc-1.so: libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libaprutil-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svn: libsvn_client-1.so.0,libsvn_wc-1.so.0,libsvn_ra-1.so.0,libsvn_diff-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnadmin: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svndumpfilter: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnlook: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_diff-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnserve: libsvn_repos-1.so.0,libsvn_fs-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libsvn_ra_svn-1.so.0,libapr-1.so.0,libsasl2.so.2,libpthread.so.0,libc.so.6
/usr/bin/svnsync: libsvn_ra-1.so.0,libsvn_delta-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
/usr/bin/svnversion: libsvn_wc-1.so.0,libsvn_subr-1.so.0,libapr-1.so.0,libpthread.so.0,libc.so.6
$

[[[
Don't link Subversion libraries against unneeded external libraries.

* configure.in: Substitute SVN_DB_LIBS.
* Makefile.in: Respect SVN_DB_LIBS and use SVN_XML_LIBS.
* build/ac-macros/apr.m4
  (SVN_LIB_APR): Don't use --libs option of $apr_config.
* build/ac-macros/aprutil.m4
  (SVN_LIB_APRUTIL): Don't use --libs option of $apu_config.
* build/ac-macros/berkeley-db.m4
  (SVN_LIB_BERKELEY_DB_TRY): Set SVN_DB_LIBS to Berkeley DB library used by APR-Util.

Patch by: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@gmail.com>
]]]

-- 
Arfrever Frehtes Taifersar Arahesis

Received on Sat Oct 6 00:05:06 2007

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.