Thread: BUG #2170: --rpath option is skipping shared libs

BUG #2170: --rpath option is skipping shared libs

From
"Lee Thompson"
Date:
The following bug has been logged online:

Bug reference:      2170
Logged by:          Lee Thompson
Email address:      bm55b@yahoo.com
PostgreSQL version: 8.1.2
Operating system:   linux
Description:        --rpath option is skipping shared libs
Details:

I use the patch that I pasted into bug report web form (so spacing and lines
are probably going to garble some) to get postgres to add rpath hints into
the postgres shared libraries.

After patching and re-running autoconf/configure/make, you can test for
success of this change by running "eu-readelf -d filename.so" and look for
the rpath in the output of the utility.



diff -Nru postgresql-8.1.2.orig/configure.in postgresql-8.1.2/configure.in
--- postgresql-8.1.2.orig/configure.in  2006-01-12 12:48:05.000000000 -0600
+++ postgresql-8.1.2/configure.in       2006-01-12 13:23:25.000000000 -0600
@@ -357,6 +357,9 @@
 # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
 for dir in $LIBRARY_DIRS $SRCH_LIB; do
   if test -d "$dir"; then
+    if test "$enable_rpath" = yes ; then
+      LIBDIRS="$LIBDIRS -Wl,-R$dir"
+    fi
     LIBDIRS="$LIBDIRS -L$dir"
   else
     AC_MSG_WARN([*** Library directory $dir does not exist.])

Re: BUG #2170: --rpath option is skipping shared libs

From
Tom Lane
Date:
"Lee Thompson" <bm55b@yahoo.com> writes:
> +    if test "$enable_rpath" = yes ; then
> +      LIBDIRS="$LIBDIRS -Wl,-R$dir"
> +    fi

What is this supposed to accomplish?  (Other than probably breaking
every non-gcc toolchain on the planet...)

            regards, tom lane

Re: BUG #2170: --rpath option is skipping shared libs

From
Lee Thompson
Date:
Think it should be separted from --enable-rpath?
Maybe something like --enable-ldrpath?

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Lee Thompson" <bm55b@yahoo.com> writes:
> > +    if test "$enable_rpath" = yes ; then
> > +      LIBDIRS="$LIBDIRS -Wl,-R$dir"
> > +    fi
>
> What is this supposed to accomplish?  (Other than
> probably breaking
> every non-gcc toolchain on the planet...)
>
>             regards, tom lane
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: BUG #2170: --rpath option is skipping shared libs

From
Tom Lane
Date:
Lee Thompson <bm55b@yahoo.com> writes:
> Better version of patch.  Only kicks in when asked for
> with --enable-rpath_sl

You still haven't explained why such a change is needed.  We're unlikely
to accept a patch without explanation, especially given that the
existing build system works fine on all the platforms we support.

A good way of making such a case is to write the documentation addition
that this patch is lacking, explaining when and why people should use
this configure switch.

BTW, submitting patches against the configure script is useless, as that
is a derived file.

            regards, tom lane

Re: BUG #2170: --rpath option is skipping shared libs

From
Lee Thompson
Date:
Better version of patch.  Only kicks in when asked for
with --enable-rpath_sl

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Lee Thompson" <bm55b@yahoo.com> writes:
> > +    if test "$enable_rpath" = yes ; then
> > +      LIBDIRS="$LIBDIRS -Wl,-R$dir"
> > +    fi
>
> What is this supposed to accomplish?  (Other than
> probably breaking
> every non-gcc toolchain on the planet...)
>
>             regards, tom lane
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com diff -Nru postgresql-8.1.2.orig/configure postgresql-8.1.2/configure
--- postgresql-8.1.2.orig/configure    2006-02-15 10:00:03.000000000 -0600
+++ postgresql-8.1.2/configure    2006-02-15 11:44:10.000000000 -0600
@@ -314,7 +314,7 @@
 # include <unistd.h>
 #endif"

-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT
exec_prefixprefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir
libdirincludedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_argsbuild build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls
WANTED_LANGUAGESdefault_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT
CPPGCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam
with_bonjourwith_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB
ac_ct_RANLIBLORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp
perl_privlibexpperl_useshrplib perl_embed_ldflags PYTHON python_versi 
 on python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS
acx_pthread_configPTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH
TCL_CONFIG_SHTCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE
have_docbookDOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS' 
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT
exec_prefixprefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir
libdirincludedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_argsbuild build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls
WANTED_LANGUAGESdefault_port enable_shared enable_rpath enable_rpath_sl enable_debug CC CFLAGS LDFLAGS CPPFLAGS
ac_ct_CCEXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5
krb_srvtabwith_pam with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld
ld_R_worksRANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL
perl_archlibexpperl_privlibexp perl_useshrplib perl_embed_ldflags PYT 
 HON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6
LIBOBJSacx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir
TCLSHTCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE
have_docbookDOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS' 
 ac_subst_files=''

 # Initialize some variables set by options.
@@ -863,6 +863,7 @@
   --enable-nls[=LANGUAGES]  enable Native Language Support
   --disable-shared        do not build shared libraries
   --disable-rpath         do not embed shared library search path in executables
+  --enable-rpath_sl       embed shared library search path in dynamic shared libraries
   --disable-spinlocks     do not use spinlocks
   --enable-debug          build with debugging symbols (-g)
   --enable-depend         turn on automatic dependency tracking
@@ -1875,6 +1876,32 @@



+
+# Check whether --enable-rpath_sl or --disable-rpath_sl was given.
+if test "${enable_rpath_sl+set}" = set; then
+  enableval="$enable_rpath_sl"
+
+  case $enableval in
+    yes)
+      :
+      ;;
+    no)
+      :
+      ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no argument expected for --enable-rpath_sl option" >&5
+echo "$as_me: error: no argument expected for --enable-rpath_sl option" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+  esac
+
+else
+  enable_rpath_sl=no
+
+fi;
+
+
+
 #
 # Spinlocks
 #
@@ -3358,6 +3385,9 @@
 # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
 for dir in $LIBRARY_DIRS $SRCH_LIB; do
   if test -d "$dir"; then
+    if test "$enable_rpath_sl" = yes; then
+      LIBDIRS="$LIBDIRS -Wl,-R$dir"
+    fi
     LIBDIRS="$LIBDIRS -L$dir"
   else
     { echo "$as_me:$LINENO: WARNING: *** Library directory $dir does not exist." >&5
@@ -3908,6 +3938,9 @@
 echo "$as_me: using LDFLAGS=$LDFLAGS" >&6;}


+if test "$enable_rpath_sl" = yes; then
+  LDFLAGS_SL="$LDFLAGS_SL $LIBDIRS"
+fi

 for ac_prog in gawk mawk nawk awk
 do
@@ -23209,6 +23242,7 @@
 s,@default_port@,$default_port,;t t
 s,@enable_shared@,$enable_shared,;t t
 s,@enable_rpath@,$enable_rpath,;t t
+s,@enable_rpath_sl@,$enable_rpath_sl,;t t
 s,@enable_debug@,$enable_debug,;t t
 s,@CC@,$CC,;t t
 s,@CFLAGS@,$CFLAGS,;t t
diff -Nru postgresql-8.1.2.orig/configure.in postgresql-8.1.2/configure.in
--- postgresql-8.1.2.orig/configure.in    2006-02-15 10:00:03.000000000 -0600
+++ postgresql-8.1.2/configure.in    2006-02-15 11:43:57.000000000 -0600
@@ -193,6 +193,9 @@
 PGAC_ARG_BOOL(enable, rpath, yes,
               [  --disable-rpath         do not embed shared library search path in executables])
 AC_SUBST(enable_rpath)
+PGAC_ARG_BOOL(enable, rpath_sl, no,
+              [  --enable-rpath_sl       embed shared library search path in dynamic shared libraries])
+AC_SUBST(enable_rpath_sl)

 #
 # Spinlocks
@@ -357,6 +360,9 @@
 # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
 for dir in $LIBRARY_DIRS $SRCH_LIB; do
   if test -d "$dir"; then
+    if test "$enable_rpath_sl" = yes; then
+      LIBDIRS="$LIBDIRS -Wl,-R$dir"
+    fi
     LIBDIRS="$LIBDIRS -L$dir"
   else
     AC_MSG_WARN([*** Library directory $dir does not exist.])
@@ -525,6 +531,9 @@
 AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])

 AC_ARG_VAR(LDFLAGS_SL)
+if test "$enable_rpath_sl" = yes; then
+  LDFLAGS_SL="$LDFLAGS_SL $LIBDIRS"
+fi

 AC_PROG_AWK
 PGAC_PATH_FLEX