[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1 of 2] build: link to specific library version (libxs, libxl, xenstore, xenstat)



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1317900003 -7200
# Node ID fb73bd21cdf7aed429f7e90e192dcbc034f3ca57
# Parent  a88029177dbcea6863a9c4e8e0cee81b08ecaed4
build: link to specific library version (libxs, libxl, xenstore, xenstat)

To avoid linking to an older version of xen libraries when compiling with 
LDFLAGS and CFLAGS set, explicitly pass the linker the library file to link to.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>

diff -r a88029177dbc -r fb73bd21cdf7 tools/Rules.mk
--- a/tools/Rules.mk    Fri Sep 30 14:27:58 2011 +0100
+++ b/tools/Rules.mk    Thu Oct 06 13:20:03 2011 +0200
@@ -5,6 +5,21 @@ all:
 
 include $(XEN_ROOT)/Config.mk
 
+XLMAJOR = 2.0
+XLMINOR = 0
+
+XLUMAJOR = 1.0
+XLUMINOR = 0
+
+XCMAJOR = 4.2
+XCMINOR = 0
+
+XSMAJOR = 3.0
+XSMINOR = 0
+
+XSTATMAJOR=0
+XSTATMINOR=0
+
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
 
@@ -18,19 +33,19 @@ XEN_BLKTAP2        = $(XEN_ROOT)/tools/b
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
 CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
+LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so.$(XCMAJOR).$(XCMINOR)
 SHLIB_libxenctrl  = -Wl,-rpath-link=$(XEN_LIBXC)
 
 CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenguest = -L$(XEN_LIBXC) -lxenguest
+LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest.so.$(XCMAJOR).$(XCMINOR)
 SHLIB_libxenguest  = -Wl,-rpath-link=L$(XEN_LIBXC)
 
 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_xeninclude)
-LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
+LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore.so.$(XSMAJOR).$(XSMINOR)
 SHLIB_libxenstore  = -Wl,-rpath-link=$(XEN_XENSTORE)
 
 CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
-LDLIBS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) 
-L$(XEN_LIBXENSTAT) -lxenstat
+LDLIBS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) 
$(XEN_LIBXENSTAT)/libxenstat.so.$(XSTATMAJOR).$(XSTATMINOR)
 SHLIB_libxenstat  = -Wl,-rpath-link=$(XEN_LIBXENSTAT)
 
 ifeq ($(CONFIG_Linux),y)
@@ -50,7 +65,7 @@ SHLIB_libblktapctl  =
 endif
 
 CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) 
$(CFLAGS_xeninclude)
-LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) 
$(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight
+LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight.so.$(XLMAJOR).$(XLMINOR) 
$(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
 SHLIB_libxenlight  = -Wl,-rpath-link=$(XEN_XENLIGHT)
 
 CFLAGS += -D__XEN_TOOLS__
diff -r a88029177dbc -r fb73bd21cdf7 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Fri Sep 30 14:27:58 2011 +0100
+++ b/tools/libxc/Makefile      Thu Oct 06 13:20:03 2011 +0200
@@ -1,9 +1,6 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-MAJOR    = 4.2
-MINOR    = 0
-
 CTRL_SRCS-y       :=
 CTRL_SRCS-y       += xc_core.c
 CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
@@ -87,12 +84,12 @@ OSDEP_PIC_OBJS := $(patsubst %.c,%.opic,
 
 LIB := libxenctrl.a
 ifneq ($(stubdom),y)
-LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
+LIB += libxenctrl.so libxenctrl.so.$(XCMAJOR) 
libxenctrl.so.$(XCMAJOR).$(XCMINOR)
 endif
 
 LIB += libxenguest.a
 ifneq ($(stubdom),y)
-LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
+LIB += libxenguest.so libxenguest.so.$(XCMAJOR) 
libxenguest.so.$(XCMAJOR).$(XCMINOR)
 endif
 
 ifneq ($(stubdom),y)
@@ -113,15 +110,15 @@ libs: $(LIB)
 install: build
        $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
        $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
-       $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
+       $(INSTALL_PROG) libxenctrl.so.$(XCMAJOR).$(XCMINOR) $(DESTDIR)$(LIBDIR)
        $(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(LIBDIR)
-       ln -sf libxenctrl.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(LIBDIR)/libxenctrl.so.$(MAJOR)
-       ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so
+       ln -sf libxenctrl.so.$(XCMAJOR).$(XCMINOR) 
$(DESTDIR)$(LIBDIR)/libxenctrl.so.$(XCMAJOR)
+       ln -sf libxenctrl.so.$(XCMAJOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so
        $(INSTALL_DATA) xenctrl.h xenctrlosdep.h xentoollog.h 
$(DESTDIR)$(INCLUDEDIR)
-       $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
+       $(INSTALL_PROG) libxenguest.so.$(XCMAJOR).$(XCMINOR) $(DESTDIR)$(LIBDIR)
        $(INSTALL_DATA) libxenguest.a $(DESTDIR)$(LIBDIR)
-       ln -sf libxenguest.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(LIBDIR)/libxenguest.so.$(MAJOR)
-       ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenguest.so
+       ln -sf libxenguest.so.$(XCMAJOR).$(XCMINOR) 
$(DESTDIR)$(LIBDIR)/libxenguest.so.$(XCMAJOR)
+       ln -sf libxenguest.so.$(XCMAJOR) $(DESTDIR)$(LIBDIR)/libxenguest.so
        $(INSTALL_DATA) xenguest.h $(DESTDIR)$(INCLUDEDIR)
 
 .PHONY: TAGS
@@ -150,22 +147,22 @@ rpm: build
 libxenctrl.a: $(CTRL_LIB_OBJS)
        $(AR) rc $@ $^
 
-libxenctrl.so: libxenctrl.so.$(MAJOR)
+libxenctrl.so: libxenctrl.so.$(XCMAJOR)
        ln -sf $< $@
-libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
+libxenctrl.so.$(XCMAJOR): libxenctrl.so.$(XCMAJOR).$(XCMINOR)
        ln -sf $< $@
 
-libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS)
+libxenctrl.so.$(XCMAJOR).$(XCMINOR): $(CTRL_PIC_OBJS)
+       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(XCMAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS)
 
 # libxenguest
 
 libxenguest.a: $(GUEST_LIB_OBJS)
        $(AR) rc $@ $^
 
-libxenguest.so: libxenguest.so.$(MAJOR)
+libxenguest.so: libxenguest.so.$(XCMAJOR)
        ln -sf $< $@
-libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
+libxenguest.so.$(XCMAJOR): libxenguest.so.$(XCMAJOR).$(XCMINOR)
        ln -sf $< $@
 
 ifeq ($(CONFIG_MiniOS),y)
@@ -190,9 +187,9 @@ endif
 xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D)
 xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D)
 
-libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
-libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz 
$(LDLIBS_libxenctrl) $(PTHREAD_LIBS)
+libxenguest.so.$(XCMAJOR).$(XCMINOR): COMPRESSION_LIBS = $(call zlib-options,l)
+libxenguest.so.$(XCMAJOR).$(XCMINOR): $(GUEST_PIC_OBJS) libxenctrl.so
+       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(XCMAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz 
$(LDLIBS_libxenctrl) $(PTHREAD_LIBS)
 
 xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so
        $(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) 
$(LDLIBS_libxenctrl)
diff -r a88029177dbc -r fb73bd21cdf7 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Fri Sep 30 14:27:58 2011 +0100
+++ b/tools/libxl/Makefile      Thu Oct 06 13:20:03 2011 +0200
@@ -5,12 +5,6 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-MAJOR = 2.0
-MINOR = 0
-
-XLUMAJOR = 1.0
-XLUMINOR = 0
-
 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations
 CFLAGS += -I. -fPIC
 
@@ -94,14 +88,14 @@ _libxl_type%.h _libxl_type%.c: libxl_typ
        $(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
        $(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
 
-libxenlight.so: libxenlight.so.$(MAJOR)
+libxenlight.so: libxenlight.so.$(XLMAJOR)
        ln -sf $< $@
 
-libxenlight.so.$(MAJOR): libxenlight.so.$(MAJOR).$(MINOR)
+libxenlight.so.$(XLMAJOR): libxenlight.so.$(XLMAJOR).$(XLMINOR)
        ln -sf $< $@
 
-libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS)
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS)
+libxenlight.so.$(XLMAJOR).$(XLMINOR): $(LIBXL_OBJS)
+       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(XLMAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS)
 
 libxenlight.a: $(LIBXL_OBJS)
        $(AR) rcs libxenlight.a $^
@@ -118,11 +112,11 @@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(
 libxlutil.a: $(LIBXLU_OBJS)
        $(AR) rcs libxlutil.a $^
 
-xl: $(XL_OBJS) libxlutil.so libxenlight.so
-       $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) 
$(LDLIBS_libxenctrl)
+xl: $(XL_OBJS) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
libxenlight.so.$(XLMAJOR).$(XLMINOR)
+       $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
$(LDLIBS_libxenlight) $(LDLIBS_libxenctrl)
 
-testidl: testidl.o libxlutil.so libxenlight.so
-       $(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) 
$(LDLIBS_libxenctrl)
+testidl: testidl.o libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
libxenlight.so.$(XLMAJOR).$(XLMINOR)
+       $(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
$(LDLIBS_libxenlight) $(LDLIBS_libxenctrl)
 
 .PHONY: install
 install: all
@@ -132,9 +126,9 @@ install: all
        $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
        $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR)
        $(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR)
-       $(INSTALL_PROG) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
-       ln -sf libxenlight.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(LIBDIR)/libxenlight.so.$(MAJOR)
-       ln -sf libxenlight.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so
+       $(INSTALL_PROG) libxenlight.so.$(XLMAJOR).$(XLMINOR) $(DESTDIR)$(LIBDIR)
+       ln -sf libxenlight.so.$(XLMAJOR).$(XLMINOR) 
$(DESTDIR)$(LIBDIR)/libxenlight.so.$(XLMAJOR)
+       ln -sf libxenlight.so.$(XLMAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so
        $(INSTALL_DATA) libxenlight.a $(DESTDIR)$(LIBDIR)
        $(INSTALL_PROG) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)
        ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
$(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
diff -r a88029177dbc -r fb73bd21cdf7 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile Fri Sep 30 14:27:58 2011 +0100
+++ b/tools/xenstat/libxenstat/Makefile Thu Oct 06 13:20:03 2011 +0200
@@ -22,17 +22,14 @@ libdir=$(prefix)/lib
 LDCONFIG=ldconfig
 MAKE_LINK=ln -sf
 
-MAJOR=0
-MINOR=0
-
 LIB=src/libxenstat.a
-SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR)
-SHLIB_LINKS=src/libxenstat.so.$(MAJOR) src/libxenstat.so
+SHLIB=src/libxenstat.so.$(XSTATMAJOR).$(XSTATMINOR)
+SHLIB_LINKS=src/libxenstat.so.$(XSTATMAJOR) src/libxenstat.so
 OBJECTS-y=src/xenstat.o
 OBJECTS-$(CONFIG_Linux) += src/xenstat_linux.o
 OBJECTS-$(CONFIG_SunOS) += src/xenstat_solaris.o
 OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
-SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
+SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(XSTATMAJOR)
 
 WARN_FLAGS=-Wall -Werror
 
@@ -53,19 +50,19 @@ all: $(LIB) $(SHLIB) $(SHLIB_LINKS)
        $(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
            $(OBJECTS-y) $(LDLIBS-y)
 
-src/libxenstat.so.$(MAJOR): $(SHLIB)
+src/libxenstat.so.$(XSTATMAJOR): $(SHLIB)
        $(MAKE_LINK) $(<F) $@
 
-src/libxenstat.so: src/libxenstat.so.$(MAJOR)
+src/libxenstat.so: src/libxenstat.so.$(XSTATMAJOR)
        $(MAKE_LINK) $(<F) $@
 
 .PHONY: install
 install: all
        $(INSTALL_DATA) src/xenstat.h $(DESTDIR)$(INCLUDEDIR)
        $(INSTALL_DATA) $(LIB) $(DESTDIR)$(LIBDIR)/libxenstat.a
-       $(INSTALL_PROG) src/libxenstat.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
-       ln -sf libxenstat.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(LIBDIR)/libxenstat.so.$(MAJOR)
-       ln -sf libxenstat.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstat.so
+       $(INSTALL_PROG) src/libxenstat.so.$(XSTATMAJOR).$(XSTATMINOR) 
$(DESTDIR)$(LIBDIR)
+       ln -sf libxenstat.so.$(XSTATMAJOR).$(XSTATMINOR) 
$(DESTDIR)$(LIBDIR)/libxenstat.so.$(XSTATMAJOR)
+       ln -sf libxenstat.so.$(XSTATMAJOR) $(DESTDIR)$(LIBDIR)/libxenstat.so
 
 PYLIB=bindings/swig/python/_xenstat.so
 PYMOD=bindings/swig/python/xenstat.py
diff -r a88029177dbc -r fb73bd21cdf7 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Fri Sep 30 14:27:58 2011 +0100
+++ b/tools/xenstore/Makefile   Thu Oct 06 13:20:03 2011 +0200
@@ -61,15 +61,15 @@ xenstore-control: xenstore_control.o $(L
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
        $(CC) $(LDFLAGS) $^ -o $@
 
-libxenstore.so: libxenstore.so.$(MAJOR)
+libxenstore.so: libxenstore.so.$(XSMAJOR)
        ln -sf $< $@
-libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR)
+libxenstore.so.$(XSMAJOR): libxenstore.so.$(XSMAJOR).$(XSMINOR)
        ln -sf $< $@
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
 
-libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
+libxenstore.so.$(XSMAJOR).$(XSMINOR): xs.opic xs_lib.opic
+       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(XSMAJOR) 
$(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
 
 libxenstore.a: xs.o xs_lib.o
        $(AR) rcs $@ $^
@@ -104,9 +104,9 @@ install: all
                ln -f $(DESTDIR)$(BINDIR)/xenstore $(DESTDIR)$(BINDIR)/$${c} ; \
        done
        $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
-       $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
-       ln -sf libxenstore.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR)
-       ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so
+       $(INSTALL_PROG) libxenstore.so.$(XSMAJOR).$(XSMINOR) $(DESTDIR)$(LIBDIR)
+       ln -sf libxenstore.so.$(XSMAJOR).$(XSMINOR) 
$(DESTDIR)$(LIBDIR)/libxenstore.so.$(XSMAJOR)
+       ln -sf libxenstore.so.$(XSMAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so
        $(INSTALL_DATA) libxenstore.a $(DESTDIR)$(LIBDIR)
        $(INSTALL_DATA) xs.h $(DESTDIR)$(INCLUDEDIR)
        $(INSTALL_DATA) xs_lib.h $(DESTDIR)$(INCLUDEDIR)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.