On Tue, Jul 20, 2010 at 05:35:01PM +0200, Ultrabug wrote:
> ----- Original Message -----
> From: Simon Horman <ho...@verge.net.au>
> To: The Pacemaker cluster resource manager <pacemaker@oss.clusterlabs.org>
> Sent: Tue, 20 Jul 2010 05:10:32 +0200 (CEST)
> Subject: Re: [Pacemaker] Proposing patch for ld --as-needed
> 
> On Sat, Jul 17, 2010 at 01:12:20PM +0200, Ultrabug wrote:
> >Dear list,
> >
> >I would like to ask you about a possible upstream modification regarding the 
> >--
> >as-needed ld flag for which we Gentoo users need to patch the pacemaker 
> >sources
> >to get it compile.
> >
> >I'm attaching the patch which, as you can see, is relatively small and simple
> >(looks to me at least). The question is whether or not you think this could 
> >be
> >done upstream ?
> >
> >Thank you for your interest in this and all you work,
> 
> Out of interest, could you explain why this is needed?
> Is it because gold is being used as the linker?

[ please don't top-post ]

Thanks for the link.

I guess what is happening without --as-needed is that the curses
library is being dragged in somewhere, somehow - without your proposed
change CURSESLIBS is used exactly nowhere.

So I think that your change is a step in the right direction,
though for completeness I think that you also need to give the same
treatment to libpe_rule as common.c seems to make curses calls.

Could you considering updating your patch to include my proposed
additions below? And could you please include a description that describes
what the patch does? Perhaps something like this:

        Explicitly link curses to libpengine

        When the ld option --as-needed is used the build fails, complaining
        about missing curses symbols. This appears to be because without
        the option curses was implicitly linked, somehow. But with the
        option the implicit linking disapears, presumably because curses is
        trimmed from the libraries linked to another library that is
        subsequently linked to pengine, implicitly or otherwise.

        This patch resolves the problem by implicitly linking curses.

        It is of note that without this patch CURSESLIBS is not used anywhere.

> >--- pengine/Makefile.am
> >+++ pengine/Makefile.am
> >@@ -58,6 +58,7 @@
> > # -L$(top_builddir)/lib/pils -lpils -export-dynamic -module -avoid-version
> > libpengine_la_SOURCES       = pengine.c allocate.c utils.c constraints.c \
> >                     native.c group.c clone.c master.c graph.c
> >+libpengine_la_LIBADD    = $(top_builddir)/lib/pengine/libpe_status.la

   +libpengine_la_LIBADD    = $(top_builddir)/lib/pengine/libpe_status.la \
   +                         $(top_builddir)/lib/pengine/libpe_rules.la

> >
> > pengine_SOURCES     = main.c
> > pengine_LDADD       = $(COMMONLIBS) $(top_builddir)/lib/cib/libcib.la
> >--- lib/pengine/Makefile.am
> >+++ lib/pengine/Makefile.am
> >@@ -34,7 +34,7 @@

    libpe_rules_la_LDFLAGS  = -version-info 2:0:0
    libpe_rules_la_SOURCES  = $(rule_files)
   +libpe_status_la_LIBADD  = @CURSESLIBS@

> > libpe_status_la_LDFLAGS     = -version-info 2:0:0
> > libpe_status_la_SOURCES     =  $(rule_files) $(status_files)
> >-libpe_status_la_LIBADD      = -llrm
> >+libpe_status_la_LIBADD      = -llrm @CURSESLIBS@
> >
> > clean-generic:
> >     rm -f *.log *.debug *~
>
> Hi,
> 
> This link explains the ld --as-needed flag better :
> http://www.gentoo.org/proj/en/qa/asneeded.xml
> 
> As far as I know, Gentoo use the 'normal' ld GNU linker and those
> changes are required because some libs need symbols defined
> elsewhere.
> For more information and to show the details behind this, I'm
> attaching the failing build log I get if I don't patch before using
> the ld --as-needed flag.

_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

Reply via email to