[devel] Сборка heartbeat с --as-needed

Eugene Prokopiev =?iso-8859-1?q?enp_=CE=C1_altlinux=2Eorg?=
Ср Сен 27 10:21:20 MSD 2006


Здравствуйте!

Требуется собрать heartbeat 2.0.7. После ./configure и make получаю:

gcc -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations 
-Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith 
-Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline 
-Wmissing-format-attribute -Wformat=2 -Wformat-security 
-Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Werror -ggdb3 
-funsigned-char -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations 
-Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith 
-Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline 
-Wmissing-format-attribute -Wformat=2 -Wformat-security 
-Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Werror -ggdb3 
-funsigned-char -o .libs/ptest ptest-ptest.o 
../../lib/clplumbing/.libs/libplumb.so 
/usr/src/heartbeat-2.0.7/lib/pils/.libs/libpils.so 
../../lib/pils/.libs/libpils.so 
../../lib/crm/common/.libs/libcrmcommon.so 
/usr/src/heartbeat-2.0.7/lib/apphb/.libs/libapphb.so 
../../lib/crm/pengine/.libs/libpe_status.so ./.libs/libpengine.so 
-lglib-2.0 ../../lib/crm/cib/.libs/libcib.so 
../../lib/crm/transition/.libs/libtransitioner.so -lbz2 -lz -lxml2 -lc 
-luuid -lrt -ldl -lltdl -Wl,--rpath -Wl,/usr/local/lib
./.libs/libpengine.so: undefined reference to `add_hash_param'
./.libs/libpengine.so: undefined reference to `score2char'
./.libs/libpengine.so: undefined reference to `sort_rsc_priority'
./.libs/libpengine.so: undefined reference to `find_recurring_actions'
./.libs/libpengine.so: undefined reference to `node_list_or'
./.libs/libpengine.so: undefined reference to `print_resource'
./.libs/libpengine.so: undefined reference to `pe_find_resource'
./.libs/libpengine.so: undefined reference to `custom_action'
./.libs/libpengine.so: undefined reference to `get_interval'
./.libs/libpengine.so: undefined reference to `node_list_minus'
./.libs/libpengine.so: undefined reference to `role2text'
./.libs/libpengine.so: undefined reference to `was_config_error'
./.libs/libpengine.so: undefined reference to `pe_find_node_id'
./.libs/libpengine.so: undefined reference to `text2role'
./.libs/libpengine.so: undefined reference to `print_node'
./.libs/libpengine.so: undefined reference to `pe_free_shallow'
./.libs/libpengine.so: undefined reference to `task2text'
./.libs/libpengine.so: undefined reference to `node_list_dup'
./.libs/libpengine.so: undefined reference to `node_copy'
./.libs/libpengine.so: undefined reference to `find_expression_type'
./.libs/libpengine.so: undefined reference to `unpack_instance_attributes'
./.libs/libpengine.so: undefined reference to `set_working_set_defaults'
./.libs/libpengine.so: undefined reference to `cluster_status'
./.libs/libpengine.so: undefined reference to `cleanup_calculations'
./.libs/libpengine.so: undefined reference to `pe_free_shallow_adv'
./.libs/libpengine.so: undefined reference to `pe_free_action'
./.libs/libpengine.so: undefined reference to `order_actions'
./.libs/libpengine.so: undefined reference to `test_expression'
./.libs/libpengine.so: undefined reference to `merge_weights'
./.libs/libpengine.so: undefined reference to `sort_op_by_callid'
./.libs/libpengine.so: undefined reference to `log_action'
./.libs/libpengine.so: undefined reference to `was_processing_error'
./.libs/libpengine.so: undefined reference to `test_rule'
./.libs/libpengine.so: undefined reference to `find_rsc_op_entry'
./.libs/libpengine.so: undefined reference to `find_actions'
./.libs/libpengine.so: undefined reference to `was_processing_warning'
./.libs/libpengine.so: undefined reference to `DeleteRsc'
./.libs/libpengine.so: undefined reference to `was_config_warning'
./.libs/libpengine.so: undefined reference to `text2task'
./.libs/libpengine.so: undefined reference to `node_list_and'
./.libs/libpengine.so: undefined reference to `resource_location'
./.libs/libpengine.so: undefined reference to `test_ruleset'
./.libs/libpengine.so: undefined reference to `char2score'
./.libs/libpengine.so: undefined reference to `find_actions_exact'
collect2: ld returned 1 exit status
gmake[2]: *** [ptest] Error 1
gmake[2]: Leaving directory `/usr/src/heartbeat-2.0.7/crm/pengine'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/src/heartbeat-2.0.7/crm'
make: *** [all-recursive] Error 1

Очевидно, проблема в crm/pengine/Makefile.am, который выглядит так:

MAINTAINERCLEANFILES    = Makefile.in



INCLUDES        = -I$(top_builddir)/include -I$(top_srcdir)/include     \
                 -I$(top_builddir)/libltdl   -I$(top_srcdir)/libltdl     \
                 -I$(top_builddir)/linux-ha  -I$(top_srcdir)/linux-ha \
                 -I$(top_builddir)           -I$(top_srcdir)

hadir           = $(sysconfdir)/ha.d
halibdir        = $(libdir)/@HB_PKG@
commmoddir      = $(halibdir)/modules/comm
havarlibdir     = $(localstatedir)/lib/@HB_PKG@
pe_varlibdir    = $(HA_VARLIBDIR)/$(HB_PKG)/pengine

# sockets with path
crmdir          = $(havarlibdir)/crm
apigid          = @HA_APIGID@
crmuid          = @HA_CCMUID@


COMMONLIBS      = $(CRM_DEBUG_LIBS)                                     \
                 $(top_builddir)/lib/clplumbing/libplumb.la              \
                 $(top_builddir)/lib/pils/libpils.la                     \
                 $(top_builddir)/lib/crm/common/libcrmcommon.la          \
                 $(top_builddir)/lib/crm/pengine/libpe_status.la         \
                 libpengine.la                                           \
                 $(GLIBLIB)                                              \
                 $(CURSESLIBS)                                           \
                 $(LIBRT)

LIBRT           = @LIBRT@
AM_CFLAGS       = @CFLAGS@ $(CRM_DEBUG_FLAGS)

## libraries
lib_LTLIBRARIES = libpengine.la

## binary progs
halib_PROGRAMS  = ptest pengine

## SOURCES
noinst_HEADERS  = allocate.h utils.h pengine.h
#utils.h pengine.h

libpengine_la_LDFLAGS   = -version-info 3:0:0
# -L$(top_builddir)/lib/pils -lpils -export-dynamic -module -avoid-version
libpengine_la_SOURCES   = pengine.c allocate.c utils.c \
                         native.c group.c clone.c master.c graph.c

pengine_SOURCES = main.c
pengine_CFLAGS  = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
pengine_LDADD   = $(COMMONLIBS) $(top_builddir)/lib/crm/cib/libcib.la
# libcib for get_object_root()
#               $(top_builddir)/lib/hbclient/libhbclient.la

ptest_SOURCES   = ptest.c
ptest_CFLAGS    = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
ptest_LDADD     = $(COMMONLIBS)                                         \
                 $(top_builddir)/lib/crm/cib/libcib.la                   \
                 $(top_builddir)/lib/crm/transition/libtransitioner.la

clean-generic:
         rm -f *.log *.debug *~ .gres.* testcases/.gres.*

install-exec-local:
         $(mkinstalldirs) $(DESTDIR)/$(pe_varlibdir)
         -chown $(HA_CCMUSER) $(DESTDIR)/$(pe_varlibdir)
         -chgrp $(HA_APIGROUP) $(DESTDIR)/$(pe_varlibdir)
         -chmod 750 $(DESTDIR)/$(pe_varlibdir)

uninstall-local:

Как в общем случае догадаться, что необходимо дописать в этот файл?

В моем случае ситуация несколько облегчается тем, что есть 
heartbeat-alt-build.patch от lakostis, правда для версии 2.0.4. В нем 
фрагмент, относящийся к crm/pengine/Makefile.am, выглядит так:

diff -uNpar heartbeat-2.0.7.orig/crm/pengine/Makefile.am 
heartbeat-2.0.7/crm/pengine/Makefile.am
--- heartbeat-2.0.7.orig/crm/pengine/Makefile.am        2006-02-20 
20:22:42 +0300
+++ heartbeat-2.0.7/crm/pengine/Makefile.am     2006-04-23 18:22:11 +0400
@@ -39,8 +39,8 @@ COMMONLIBS    = $(CRM_DEBUG_LIBS) 
                 \
                 $(top_builddir)/lib/clplumbing/libplumb.la              \
                 $(top_builddir)/lib/pils/libpils.la                     \
                 $(top_builddir)/lib/crm/common/libcrmcommon.la          \
+               $(top_builddir)/lib/crm/cib/libcib.la                   \
                 libpengine.la                                           \
-               $(top_builddir)/lib/crm/cib/libcib.la                   \
                 $(top_builddir)/lib/apphb/libapphb.la                   \
                 $(GLIBLIB)                                              \
                 $(CURSESLIBS)                                           \
@@ -61,6 +61,7 @@ libpengine_la_SOURCES = color.c unpack.c
                         utils.c complex.c native.c stages.c \
                         group.c incarnation.c master.c

+libpengine_la_LIBADD = $(top_builddir)/lib/crm/cib/libcib.la
  libpengine_la_LDFLAGS  = -version-info 2:0:1

  noinst_HEADERS = pe_utils.h pengine.h complex.h pe_rules.h

Т.е. для 2.0.4 оказалось достаточным переместить libcib.la выше 
libpengine.la (зачем? почему не libapphb.la? на основании чего lakostis 
сделал это умозаключение?) и дописать в libpengine_la_LIBADD libcib.la 
(опять-таки, как lakostis до этого додумался?). В случае 2.0.7 libcib.la 
и libapphb.la в COMMONLIBS Makefile.am уже не упоминается, а их место 
занимает libpe_status.la до libpengine.la. Т.е. допустим, что в 
COMMONLIBS ничего менять не надо. Но, наверное, нужно перед 
libpengine_la_LDFLAGS по аналогии с патчем для 2.0.4 вписать:

libpengine_la_LIBADD = $(top_builddir)/lib/crm/cib/libpe_status.la

Можно ли как нибудь сделать такой вывод (или другой, если это ошибочен) 
не на основании патча к 2.0.4, а на основании вывода make?

После make clean, ./configure, make получаю:

  gcc -DHAVE_CONFIG_H -I. -I. -I../../linux-ha -I../../include 
-I../../include -I../../include -I../../libltdl -I../../libltdl 
-I../../linux-ha -I../../linux-ha -I../.. -I../.. -D_BSD_SOURCE 
-D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include 
-I/usr/include/libxml2 -g -O2 -Wall -Wmissing-prototypes 
-Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement 
-Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align 
-Wbad-function-cast -Winline -Wmissing-format-attribute -Wformat=2 
-Wformat-security -Wformat-nonliteral -Wno-long-long 
-Wno-strict-aliasing -Werror -ggdb3 -funsigned-char -g -O2 -Wall 
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes 
-Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings 
-Wcast-qual -Wcast-align -Wbad-function-cast -Winline 
-Wmissing-format-attribute -Wformat=2 -Wformat-security 
-Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Werror -ggdb3 
-funsigned-char -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.c -o 
graph.o >/dev/null 2>&1
gmake[2]: *** No rule to make target 
`../../lib/crm/cib/libpe_status.la', needed by `libpengine.la'.  Stop.
gmake[2]: Leaving directory `/usr/src/heartbeat-2.0.7/crm/pengine'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/src/heartbeat-2.0.7/crm'
make: *** [all-recursive] Error 1

Что делать дальше?

-- 
С уважением, Прокопьев Евгений



Подробная информация о списке рассылки Devel