You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2009/07/09 08:27:31 UTC

Re: svn commit: r38377 - trunk/build/ac-macros

Arfrever Frehtes Taifersar Arahesis wrote:
> Author: arfrever
> Date: Wed Jul  8 18:17:57 2009
> New Revision: 38377
> 
> Log:
> Filter out redundant library directories (e.g. /usr/lib) to avoid linking
> against Subversion libraries potentially placed in these directories.
> 
> * build/ac-macros/svn-macros.m4
>   (SVN_REMOVE_REDUNDANT_LIB_DIRS): New.
[...]

Hi Arfrever.

I'm sure this is a useful change but I'd like to understand what it is
for.

Please can you tell me, in a few more words, what problem you are
solving, and what you mean by "redundant".

> Modified: trunk/build/ac-macros/svn-macros.m4
[...]
> +dnl SVN_REMOVE_REDUNDANT_LIB_DIRS
> +dnl
> +dnl Remove redundant library directories (e.g. /usr/lib).

In this function's doc string, I think you need to make clear what the
meaning of "redundant" is (libraries that are mentioned more than once?
no, I don't think so), and what the inputs and outputs are.

Having read through the function, can I suggest this for a better
doc-string:

  Remove some particular linker options from the given list.
  The only argument is a space-separated list of linker options.
  Return the same list except omitting all options that match
  any of the following:
    -L/lib -L/lib64 -L/usr/lib -L/usr/lib64
  A directory name must not end with a trailing '/' in order
  to match one of these.

However, that's still a low-level description: it says what it does but
not why it does it.

Why are those four particular directories chosen to be special?


> +AC_DEFUN([SVN_REMOVE_REDUNDANT_LIB_DIRS],
> +[
> +  input_flags="$1"
> +  output_flags=""
> +  filtered_dirs="/lib /lib64 /usr/lib /usr/lib64"
> +  for flag in $input_flags; do
> +    filter="no"
> +    for dir in $filtered_dirs; do
> +      if test "$flag" = "-L$dir"; then
> +        filter="yes"
> +        break
> +      fi
> +    done
> +    if test "$filter" = "no"; then
> +      output_flags="$output_flags $flag"
> +    fi
> +  done
> +  if test -n "$output_flags"; then
> +    printf "%s" "${output_flags# }"
> +  fi
> +])

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2369292

Re: svn commit: r38377 - trunk/build/ac-macros

Posted by Arfrever Frehtes Taifersar Arahesis <Ar...@GMail.Com>.
2009-07-09 13:24:26 Stefan Sperling napisaƂ(a):
> On Thu, Jul 09, 2009 at 09:27:31AM +0100, Julian Foad wrote:
> > Arfrever Frehtes Taifersar Arahesis wrote:
> > > Author: arfrever
> > > Date: Wed Jul  8 18:17:57 2009
> > > New Revision: 38377
> > > 
> > > Log:
> > > Filter out redundant library directories (e.g. /usr/lib) to avoid linking
> > > against Subversion libraries potentially placed in these directories.
> > > 
> > > * build/ac-macros/svn-macros.m4
> > >   (SVN_REMOVE_REDUNDANT_LIB_DIRS): New.
> > [...]
> > 
> > Hi Arfrever.
> > 
> > I'm sure this is a useful change but I'd like to understand what it is
> > for.
> 
> I guess it is for solving a problem myself and Arfrever found yesterday.
> (But I can't know for sure because Arfrever isn't telling ;)

I was reproducing the following error (revealed by -Wl,--no-undefined) during installation:

cd subversion/libsvn_wc ; /usr/bin/libtool --mode=install /usr/bin/install -c libsvn_wc-1.la /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.la
libtool: install: warning: relinking `libsvn_wc-1.la'
libtool: install: (cd /var/tmp/portage/dev-util/subversion-1.7_pre38376/work/subversion-1.7_pre38376/subversion/libsvn_wc; /bin/sh /usr/bin/libtool  --tag CC --silent --mode=relink x86_64-pc-linux-gnu-gcc -march=native -pipe -O3 -finline-limit=1800 -fivopts -fno-ident -fpeel-loops -fprefetch-loop-arrays -frename-registers -freorder-blocks-and-partition -fweb -Wall -Wpointer-sign -pthread -Werror=implicit-function-declaration -Wl,-O1,--as-needed,--gc-sections,--hash-style=gnu,--sort-common -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/lib64 -rpath /usr/lib64 -Wl,--no-undefined -o libsvn_wc-1.la adm_crawler.lo adm_files.lo adm_ops.lo ambient_depth_filter_editor.lo context.lo copy.lo crop.lo deprecated.lo diff.lo entries.lo lock.lo log.lo merge.lo old-and-busted.lo patch.lo props.lo questions.lo relocate.lo revision_status.lo status.lo translate.lo tree_conflicts.lo update_editor.lo upgrade.lo util.lo wc_db.lo workqueue.lo ../../subversion/libsvn_delta/libsvn_delta-1.la ../../subversion/libsvn_diff/libsvn_diff-1.la ../../subversion/libsvn_subr/libsvn_subr-1.la -L/usr/lib64 -laprutil-1 -L/usr/lib64 -lapr-1 -inst-prefix-dir /var/tmp/portage/dev-util/subversion-1.7_pre38376/image/)
libtool: install: /usr/bin/install -c .libs/libsvn_wc-1.so.0.0.0T /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.so.0.0.0
libtool: install: (cd /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64 && { ln -s -f libsvn_wc-1.so.0.0.0 libsvn_wc-1.so.0 || { rm -f libsvn_wc-1.so.0 && ln -s libsvn_wc-1.so.0.0.0 libsvn_wc-1.so.0; }; })
libtool: install: (cd /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64 && { ln -s -f libsvn_wc-1.so.0.0.0 libsvn_wc-1.so || { rm -f libsvn_wc-1.so && ln -s libsvn_wc-1.so.0.0.0 libsvn_wc-1.so; }; })
libtool: install: /usr/bin/install -c .libs/libsvn_wc-1.lai /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.la
libtool: install: /usr/bin/install -c .libs/libsvn_wc-1.a /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.a
libtool: install: chmod 644 /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.a
libtool: install: x86_64-pc-linux-gnu-ranlib /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_wc-1.a
libtool: install: warning: remember to run `libtool --finish /usr/lib64'
cd subversion/libsvn_client ; /usr/bin/libtool --mode=install /usr/bin/install -c libsvn_client-1.la /var/tmp/portage/dev-util/subversion-1.7_pre38376/image//usr/lib64/libsvn_client-1.la
libtool: install: warning: relinking `libsvn_client-1.la'
libtool: install: (cd /var/tmp/portage/dev-util/subversion-1.7_pre38376/work/subversion-1.7_pre38376/subversion/libsvn_client; /bin/sh /usr/bin/libtool  --tag CC --silent --mode=relink x86_64-pc-linux-gnu-gcc -march=native -pipe -O3 -finline-limit=1800 -fivopts -fno-ident -fpeel-loops -fprefetch-loop-arrays -frename-registers -freorder-blocks-and-partition -fweb -Wall -Wpointer-sign -pthread -Werror=implicit-function-declaration -Wl,-O1,--as-needed,--gc-sections,--hash-style=gnu,--sort-common -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/lib64 -rpath /usr/lib64 -Wl,--no-undefined -o libsvn_client-1.la add.lo blame.lo cat.lo changelist.lo checkout.lo cleanup.lo cmdline.lo commit.lo commit_util.lo compat_providers.lo copy.lo ctx.lo delete.lo deprecated.lo diff.lo export.lo externals.lo info.lo list.lo locking_commands.lo log.lo merge.lo mergeinfo.lo patch.lo prop_commands.lo ra.lo relocate.lo repos_diff.lo repos_diff_summarize.lo resolved.lo revert.lo revisions.lo status.lo switch.lo update.lo url.lo util.lo version.lo ../../subversion/libsvn_wc/libsvn_wc-1.la ../../subversion/libsvn_ra/libsvn_ra-1.la ../../subversion/libsvn_delta/libsvn_delta-1.la ../../subversion/libsvn_diff/libsvn_diff-1.la ../../subversion/libsvn_subr/libsvn_subr-1.la -L/usr/lib64 -laprutil-1 -L/usr/lib64 -lapr-1 -inst-prefix-dir /var/tmp/portage/dev-util/subversion-1.7_pre38376/image/)
.libs/commit.o: In function `svn_client_commit4':
commit.c:(.text+0x4b7): undefined reference to `svn_wc__adm_open_in_context'
collect2: ld returned 1 exit status
libtool: install: error: relink `libsvn_client-1.la' with the above command before installing it
make: *** [install-lib] Error 1
 * 
 * ERROR: dev-util/subversion-1.7_pre38376 failed.
 * Call stack:
 *               ebuild.sh, line   42:  Called src_install
 *             environment, line 6025:  Called die
 * The specific snippet of code:
 *       emake -j1 DESTDIR="${D}" local-install || die "Installation of core of Subversion failed";
 *  The die message:
 *   Installation of core of Subversion failed
 * 
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/log/portage/dev-util:subversion-1.7_pre38376:20090708-225848.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-util/subversion-1.7_pre38376/temp/environment'.
 * This ebuild used the following eclasses from overlays:
 *   /usr/repositories/local/eclass/depend.apache.eclass
 *   /usr/repositories/local/eclass/subversion.eclass
 * This ebuild is from an overlay named 'LOCALA': '/usr/repositories/local/'
 * 
!!! When you file a bug report, please include the following information:
GENTOO_VM=sun-jdk-1.6  CLASSPATH="" JAVA_HOME="/opt/sun-jdk-1.6.0.14"
JAVACFLAGS="-source 1.5 -target 1.5" COMPILER=""
and of course, the output of emerge --info

> -- The problem as I saw it:
> Bert had added a new function to libsvn_wc, and for some reason
> that function could not be found when linking
> subversion/tests/libsvn_client/client-test.

I wasn't able to reproduce the problem durink linking of client-test.

> -- The cause as far as I can guess without digging through piles
>    of build and configure script logs:
> The library which failed to link was libsvn_client.
> The symbols it calls from libsvn_wc caused libsvn_wc to be pulled
> in as a dependency. But because libsvn_wc was not explicitly listed
> as a library dependency of client-test (since it is an indirect
> dependency: client-test -> libsvn_client -> libsvn_wc), *any*
> libsvn_wc-1.so would make the linker happy. And we have the system's
> standard library directories mentioned *explicitly* on the linker
> command line. So the libsvn_wc-1.so from the /usr/lib directory ended
> up being used. Which, on my system, came from the debian package for
> Subversion 1.5.1 which I didn't even remember I had installed.
> 
> -- Summary:
> So the problem we're trying to avoid is linking to shared libsvn_*
> libraries which are installed in the system's standard library
> search path when the libsvn_* libraries from the working copy
> should be used instead.
> 
> Arfrever's change does indeed fix this problem for me.
> In the past I often used to vocally blame all such problems on libtool,
> but it seems that there was a fix we could make :)

In my case "../../subversion/libsvn_wc/libsvn_wc-1.la ../../subversion/libsvn_ra/libsvn_ra-1.la ../../subversion/libsvn_delta/libsvn_delta-1.la ../../subversion/libsvn_diff/libsvn_diff-1.la ../../subversion/libsvn_subr/libsvn_subr-1.la" were used, so there's still a bug in libtool :( .
> 
> > Please can you tell me, in a few more words, what problem you are
> > solving, and what you mean by "redundant".
> 
> "Redundant" is just poor choice of wording.
> I think it should say "system" instead.
> Arfrever, can you change this?

I renamed SVN_REMOVE_REDUNDANT_LIB_DIRS to SVN_REMOVE_STANDARD_LIB_DIRS in r38386.

-- 
Arfrever Frehtes Taifersar Arahesis

Re: svn commit: r38377 - trunk/build/ac-macros

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Jul 09, 2009 at 09:27:31AM +0100, Julian Foad wrote:
> Arfrever Frehtes Taifersar Arahesis wrote:
> > Author: arfrever
> > Date: Wed Jul  8 18:17:57 2009
> > New Revision: 38377
> > 
> > Log:
> > Filter out redundant library directories (e.g. /usr/lib) to avoid linking
> > against Subversion libraries potentially placed in these directories.
> > 
> > * build/ac-macros/svn-macros.m4
> >   (SVN_REMOVE_REDUNDANT_LIB_DIRS): New.
> [...]
> 
> Hi Arfrever.
> 
> I'm sure this is a useful change but I'd like to understand what it is
> for.

I guess it is for solving a problem myself and Arfrever found yesterday.
(But I can't know for sure because Arfrever isn't telling ;)

-- The problem as I saw it:
Bert had added a new function to libsvn_wc, and for some reason
that function could not be found when linking
subversion/tests/libsvn_client/client-test.

-- The cause as far as I can guess without digging through piles
   of build and configure script logs:
The library which failed to link was libsvn_client.
The symbols it calls from libsvn_wc caused libsvn_wc to be pulled
in as a dependency. But because libsvn_wc was not explicitly listed
as a library dependency of client-test (since it is an indirect
dependency: client-test -> libsvn_client -> libsvn_wc), *any*
libsvn_wc-1.so would make the linker happy. And we have the system's
standard library directories mentioned *explicitly* on the linker
command line. So the libsvn_wc-1.so from the /usr/lib directory ended
up being used. Which, on my system, came from the debian package for
Subversion 1.5.1 which I didn't even remember I had installed.

-- Summary:
So the problem we're trying to avoid is linking to shared libsvn_*
libraries which are installed in the system's standard library
search path when the libsvn_* libraries from the working copy
should be used instead.

Arfrever's change does indeed fix this problem for me.
In the past I often used to vocally blame all such problems on libtool,
but it seems that there was a fix we could make :)

> Please can you tell me, in a few more words, what problem you are
> solving, and what you mean by "redundant".

"Redundant" is just poor choice of wording.
I think it should say "system" instead.
Arfrever, can you change this?

Stefan