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

Re: How to build subversion to run on most Linux systems?

From: Bob Proulx <bob_at_proulx.com>
Date: 2005-05-28 19:12:35 CEST

Zsolt Koppany wrote:
> We would like to ship subversion with our application to customers that use
> different Linux systems (Suse 8.x,9.x,RedHat-7.x,9.x,RHE-3,RHE-4.
>
> How should I build subversion?

What I do is to include all of the libraries my application is using
in a lib directory next to my application bin directory. I copy all
of the shared libraries used by the programs to that directory. Then
I wrap the program with a shell script that sets LD_LIBRARY_PATH to
that directory. I override the native GNU libc library by calling the
ld.so directly on the binary. This allows you to use a specific
version of glibc other than the natively installed one.

Assume your wrappers are in bin and your real binaries are in libexec.
The structure would look like this. The names of the libraries will
vary by version and architecture. Using subversion as an example it
would look similar to this.

  ./bin/svn # wrapper script
  ./libexec/svn # real binary
  ./lib/ld-linux.so.2
  ./lib/libc.so.6
  ./lib/libz.so.1.1.4
  ./lib/libneon.so.24.0.7
  ... long list of libraries and symlinks to libraries deleted ...

Here is some shell code to illustrate use.

  #!/bin/sh
  MYAPPDIR=$(dirname $(dirname $0))
  export LD_LIBRARY_PATH=$MYAPPDIR/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
  exec $MYAPPDIR/lib/ld-linux.so.2 $MYAPPDIR/libexec/$(basename $0) "$@"

Calling an application explicitly through the use of ld-linux.so.2 has
an additional advantage in that it also allows a 32-bit application to
run on a 64-bit amd64 or ia64 system mode if the kernel also allows it.

If you are supporting multiple architectures then it would be best to
put all of the architecture specific files in an architecture specific
subdirectory. I would mirror the proposed multiarch hiearchy. Then
adjust the script above to call the appropriate architecture. That is
straight-forward and so is left as an exercise for the reader. :-)

Here are some ideas as to how to get a list of libs to copy to your
distribution area. You will want both the shared library and the
symlink to it copied to your application area. (Hint: Use 'cp -a' to
copy syminks as symlinks.)

  ldd /usr/bin/svn | awk '{print$3}'
  ldd /usr/bin/svn | awk '{print$3}' | xargs ls -l | awk '{print$NF}'

Enjoy improved platform independence!

Bob

Useful References:

  http://people.redhat.com/drepper/nptl-design.pdf
  http://www.novell.com/coolsolutions/feature/11250.html
  http://www.linuxbase.org/LSBWiki/MultiArch
  http://www.linuxbase.org/futures/ideas/multiarch/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat May 28 19:14:53 2005

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

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