Ack.
Thanks,
Ramesh.
On 2/10/2017 7:35 PM, Anders Widell wrote:
> Makefile.am | 3 ++-
> README | 12 ++++++++++--
> opensaf.spec.in | 2 +-
> samples/Makefile.common | 1 +
> src/base/Makefile.am | 3 ++-
> tools/cluster_sim_uml/build_uml | 4 ++--
> 6 files changed, 18 insertions(+), 7 deletions(-)
>
>
> An application binary linked with the OpenSAF AIS libraries may fail to load
> after upgrading to OpenSAF 5.2. The reason is that libopensaf_core.so.0 has
> moved from /usr/local/lib to /usr/local/lib/opensaf. This problem can happen
> if
> the following two conditions are met:
>
> * The application was linked without using the -Wl,--as-needed option (and
> this
> option is not enabled by default by the Linux distribution used when
> building
> the application binary)
> * The directory /usr/local/lib/opensaf is not listed in LD_LIBRARY_PATH or
> /etc/ld.so.conf
>
> This is fixed by:
>
> * Moving libopensaf_core back to /usr/local/lib
> * Updating the documentation to mention that -Wl,--as-needed must to be used
> when linking with the OpenSAF libraries, to avoid similar problems in the
> future.
>
> diff --git a/Makefile.am b/Makefile.am
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,6 +1,7 @@
> # -*- OpenSAF -*-
> #
> # (C) Copyright 2008 The OpenSAF Foundation
> +# Copyright Ericsson AB 2009, 2017 - All Rights Reserved.
> #
> # This program is distributed in the hope that it will be useful, but
> # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> @@ -54,7 +55,7 @@ AM_CPPFLAGS = \
>
> AM_CFLAGS = -pipe -std=gnu11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2 -Werror
> AM_CXXFLAGS = -pipe -std=gnu++11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2
> -Werror
> -AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -ldl -lrt -pthread -rdynamic
> +AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -Wl,--as-needed -ldl -lrt -pthread -rdynamic
> ACLOCAL_AMFLAGS = -I m4
> OSAF_LIB_FLAGS =
>
> diff --git a/README b/README
> --- a/README
> +++ b/README
> @@ -824,6 +824,7 @@ installed with the other system `*.pc' f
> There are two easy ways to use `pkgconfig'. The first one is to call it
> directly
> from a `Makefile' and assign its content to make variables e.g.:
>
> + AMF_LDFLAGS=-Wl,--as-needed
> AMF_LIBS=`pkg-config opensaf-amf --libs`
> AMF_CFLAGS=`pkg-config opensaf-amf --cflags`
>
> @@ -837,8 +838,15 @@ It will then provides two special variab
>
> -- in Makefile.am --
> mumble_CFLAGS = @AMF_CFLAGS@
> + mumble_LDFLAGS = -Wl,--as-needed
> mumble_LDADD = @AMF_LIBS@
>
> +The --as-needed ld flag is enabled by default on many modern Linux
> +distributions, but just to be on the safe side please make sure to add
> +-Wl,--as-needed to your LDFLAGS when linking application programs with the
> +OpenSAF AIS libraries. Otherwise the resulting binary may not be compatible
> with
> +other versions of OpenSAF.
> +
>
> How to Configure `OpenSAF'
> ==========================
> @@ -918,13 +926,13 @@ The `Makefile' looks for installed `SAF
> standard system wide locations (e.g. /usr/include/ & /usr/lib/):
>
> INCLUDES = -I.
> - LDFLAGS = -lSaAmf
> + LDFLAGS = -Wl,--as-needed -lSaAmf
>
> If you have `OpenSAF' development packages installed somewhere else,
> override
> the default values e.g.:
>
> % make INCLUDES="-I. -I/tmp/usr/local/include" \
> - LDFLAGS="-L/tmp/usr/local/lib -lSaAmf -lopensaf_core"
> + LDFLAGS="-Wl,--as-needed -L/tmp/usr/local/lib -lSaAmf -lopensaf_core"
>
> To run an application you will need a configured `OpenSAF' node running.
>
> diff --git a/opensaf.spec.in b/opensaf.spec.in
> --- a/opensaf.spec.in
> +++ b/opensaf.spec.in
> @@ -1427,7 +1427,7 @@ fi
> %files libs
> %defattr(-,root,root)
> %dir %{_pkglibdir}
> -%{_pkglibdir}/libopensaf_core.so.*
> +%{_libdir}/libopensaf_core.so.*
> %{_pkglibdir}/libosaf_common.so.*
>
> %files tools
> diff --git a/samples/Makefile.common b/samples/Makefile.common
> --- a/samples/Makefile.common
> +++ b/samples/Makefile.common
> @@ -1,5 +1,6 @@
> AM_CPPFLAGS = $(all_includes)
> AM_CFLAGS = -fPIC -Wall
> +AM_LDFLAGS = -Wl,--as-needed
> #AM_CFLAGS = -fPIC -Wall -Werror
>
> lsbinitdir = $(initscriptdir)
> diff --git a/src/base/Makefile.am b/src/base/Makefile.am
> --- a/src/base/Makefile.am
> +++ b/src/base/Makefile.am
> @@ -1,6 +1,7 @@
> # -*- OpenSAF -*-
> #
> # (C) Copyright 2016 The OpenSAF Foundation
> +# Copyright Ericsson AB 2017 - All Rights Reserved.
> #
> # This program is distributed in the hope that it will be useful, but
> # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> @@ -14,7 +15,7 @@
> # Author(s): Ericsson AB
> #
>
> -osaf_lib_LTLIBRARIES += lib/libopensaf_core.la
> +lib_LTLIBRARIES += lib/libopensaf_core.la
>
> lib_libopensaf_core_la_CFLAGS = $(OSAF_LIB_FLAGS) -fno-strict-aliasing
> $(AM_CFLAGS)
>
> diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml
> --- a/tools/cluster_sim_uml/build_uml
> +++ b/tools/cluster_sim_uml/build_uml
> @@ -84,7 +84,7 @@ cmd_build_testprog() {
> -I$opensaf_home/src/osaf/saf \
> -DSA_EXTENDED_NAME_SOURCE \
> -o $installd/amf_demo $src/amf_demo.c \
> - -L$libd -lSaAmf -lamf_common -L$libd/opensaf -lopensaf_core
> + -Wl,--as-needed "-Wl,-rpath-link,$libd:$libd/opensaf" "-L$libd" -lSaAmf
>
> echo "Creating [$root/root.cpio] ..."
> cmd_mkcpio
> @@ -110,7 +110,7 @@ cmd_install_testprog() {
> -I$opensaf_home/src/osaf/saf \
> -DSA_EXTENDED_NAME_SOURCE \
> -o $installd/amf_demo $src/amf_demo.c \
> - -L$libd -lSaAmf -lamf_common -L$libd/opensaf -lopensaf_core
> + -Wl,--as-needed "-Wl,-rpath-link,$libd:$libd/opensaf" "-L$libd" -lSaAmf
>
> test -r $immxml.orig || cp $immxml $immxml.orig
> $opensaf_home/src/imm/tools/immxml-merge \
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel