build: fixes for yajl and force xen tools to link to current libraries.
PATCH 1/1 build: fixes for yajl and force xen tools to link to current libraries.
Minor build process fixes, to allow the use of LDFALGS and CFLAGS with folders that contain older versions of xen libraries and added a specific env variable to point to yajl header and library files.
PATCH 1/1 build: link to specific library version (libxs, libxl, xenstore, xenstat)
# HG changeset patch
# User Roger Pau Monne <[email protected]>
# 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.
tools/Rules.mk +20 -5
@@ -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__
tools/libxc/Makefile +17 -20
@@ -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)
tools/libxl/Makefile +11 -17
@@ -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)
tools/xenstat/libxenstat/Makefile +8 -11
@@ -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
tools/xenstore/Makefile +7 -7
@@ -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)
PATCH 1/1 build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317900172 -7200
# Node ID dd09f32c882c9e1492b2346b899fef19f46055dd # Parent fb73bd21cdf7aed429f7e90e192dcbc034f3ca57
build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
Since some users have yajl installed in a non-standard directory, allow the use of YAJL_CFLAGS and YAJL_LDFLAGS to point to the correct folders.
tools/libxl/Makefile +2 -2
@@ -13,7 +13,7 @@ LIBUUID_LIBS += -luuid endif LIBXL_LIBS = -LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS) +LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS) $(YAJL_LDFLAGS) LIBXLU_LIBS =
@@ -34,7 +34,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_qmp.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o -$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) $(YAJL_CFLAGS) AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
Re: [PATCH 1 of 2] build: link to specific library version (libxs, libxl, xenstore, xenstat)
In reply to Roger Pau Monnetools/Rules.mk XEN_BLKTAP2 = $(XEN_ROOT)/tools/b · line 37
Quoted 7 lines · Roger Pau Monne
tools/Rules.mk +1
-1@@ -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)
I think this is the correct approach but you don't need
the .$(MAJOR).$(MINOR) suffix here since the .so at the specific path will always be a symlink to the right thing (same for all the others).
Doing it that way will remove the need to move all the major/minor definitions around and make this patch tiny.
Ian.
Re: [PATCH 1 of 2] build: link to specific library version (libxs, libxl, xenstore, xenstat)
Quoted 6 lines
I think this is the correct approach but you don't need
the .$(MAJOR).$(MINOR) suffix here since the .so at the specific path will always be a symlink to the right thing (same for all the others).Doing it that way will remove the need to move all the major/minor definitions around and make this patch tiny.
I've added the version numbers to make sure that we are linking against the current library versions, so when there's an API change the version numbers are bumped and the linking is made against the new libraries for sure, but you are right, and when the version number is bumped the library is rebuild automatically, so there's no need for all this fuss. I will send a new patch without the MAJOR.MINOR stuff.
Regards, Roger.
PATCH 1/1 build: link to specific library version (libxs, libxl, xenstore, xenstat)
In reply to Ian Campbell# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1317903332 -7200
# Node ID 25d25990dd1b0f1e26d8dd56c45b9daf377969b9
# 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.
tools/Rules.mk +5 -5
@@ -18,19 +18,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 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 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 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 SHLIB_libxenstat = -Wl,-rpath-link=$(XEN_LIBXENSTAT) ifeq ($(CONFIG_Linux),y)
@@ -50,7 +50,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 $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT) CFLAGS += -D__XEN_TOOLS__
Re: [PATCH] build: link to specific library version (libxs, libxl, xenstore, xenstat)
Quoted 10 lines · Roger Pau Monne
# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1317903332 -7200
# Node ID25d25990dd1b0f1e26d8dd56c45b9daf377969b9
# Parenta88029177dbcea6863a9c4e8e0cee81b08ecaed4
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 <[email protected]>
Thanks Roger.
Quoted 29 lines
diff -r
a88029177dbc-r25d25990dd1btools/Rules.mktools/Rules.mk +4
-4@@ -18,19 +18,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 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 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 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 SHLIB_libxenstat = -Wl,-rpath-link=$(XEN_LIBXENSTAT) ifeq ($(CONFIG_Linux),y)
tools/Rules.mk SHLIB_libblktapctl = · line 53
Quoted 5 lines
tools/Rules.mk +1
-1@@ -50,7 +50,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 $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
OOI, is the reordering of libxenlight wrt the SHLIBs here significant?
Quoted 3 lines
tools/Rules.mk +0
-0SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT) CFLAGS += -D__XEN_TOOLS__
Re: [PATCH] build: link to specific library version (libxs, libxl, xenstore, xenstat)
Ian Campbell writes ("[Xen-devel] Re: [PATCH] build: link to specific library version (libxs, libxl, xenstore, xenstat)"):
Quoted 8 lines · Roger Pau Monne
Quoted 7 lines
# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1317903332 -7200
# Node ID25d25990dd1b0f1e26d8dd56c45b9daf377969b9
# Parenta88029177dbcea6863a9c4e8e0cee81b08ecaed4
build: link to specific library version (libxs, libxl, xenstore, xenstat)
Quoted 7 lines
Quoted 3 lines
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 <[email protected]>Thanks Roger.
Acked-by Ian Campbell <[email protected]>
Thanks, I have applied this patch because I think it's an improvement.
However, I would point out that building Xen (or indeed any other upstream project) with LDFLAGS or CFLAGS set in the environment is almost certainly a mistake. It's not supported by us.
Ian.
Re: [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
In reply to Roger Pau MonneRoger Pau Monne writes ("[Xen-devel] [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build"):
Quoted 1 line
build: append
YAJL_CLFAGSandYAJL_LDFLAGSto libxl build
I think this should be done by setting EXTRA_INCLUDES and EXTRA_LIB in Config.mk or .config, and shouldn't need an extra pair of variables.
Ian.
Re: [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
2011/10/6 Ian Jackson <[email protected]>:
Quoted 2 lines
I think this should be done by setting
EXTRA_INCLUDESandEXTRA_LIBin Config.mk or .config, and shouldn't need an extra pair of variables.
The problem is that EXTRA_INCLUDES and EXTRA_LIB is added to the whole compilation process, and if I have old xen header files in this folders together with the yajl headers for example, they get included instead of the new ones, and the build fails.
Re: [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build"):
Quoted 8 lines
2011/10/6 Ian Jackson <[email protected]>:
Quoted 2 lines
I think this should be done by setting
EXTRA_INCLUDESandEXTRA_LIBin Config.mk or .config, and shouldn't need an extra pair of variables.The problem is that
EXTRA_INCLUDESandEXTRA_LIBis added to the whole compilation process, and if I have old xen header files in this folders together with the yajl headers for example, they get included instead of the new ones, and the build fails.
Ah. I don't think the approach of only using these flags when compiling libxl is a good one, then, as it would build libxl against these putative old Xen headers.
I think the problem then is that the ordering of the various -I and -L options is wrong. The EXTRA_* should come near the end, after all of the -I and -L specified by the build system to refer to other parts of the Xen tree.
Would you like to look into how to make that work :-) ?
Ian.
Re: [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
Quoted 10 lines
Ah. I don't think the approach of only using these flags when compiling libxl is a good one, then, as it would build libxl against these putative old Xen headers.
I think the problem then is that the ordering of the various -I and -L options is wrong. The EXTRA_* should come near the end, after all of the -I and -L specified by the build system to refer to other parts of the Xen tree.
Would you like to look into how to make that work :-) ?
I've took a look at how EXTRA_LIB and EXTRA_INCLUDES are handled, and found that they are appended to CFLAGS and LDFLAGS, so it's mostly the same using CFLAGS or EXTRA_INCLUDES. The best way I've come up to solve this is to modify each makefile and append EXTRA_LIB and EXTRA_INCLUDES at the end, but this means modifying a lot of makefiles. What do you think?
Regards, Roger.
Re: [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 2 of 2] build: append YAJL_CLFAGS and YAJL_LDFLAGS to libxl build"):
Quoted 6 lines
I've took a look at how
EXTRA_LIBandEXTRA_INCLUDESare handled, and found that they are appended to CFLAGS and LDFLAGS, so it's mostly the same using CFLAGS orEXTRA_INCLUDES. The best way I've come up to solve this is to modify each makefile and appendEXTRA_LIBandEXTRA_INCLUDESat the end, but this means modifying a lot of makefiles. What do you think?
I'm not convinced that we should change the semantics of existing variables, even if they are rather misnamed.
In principle changing every Makefile for this is a possibility but we'd have to think properly about exactly what the global change should be.
To me the most obvious possibility would be to modify the pattern rule for compilation (tools/Rules.mk) to add a new variable at the end of the compilation lines, just after "-o $@".
AFAICT link lines would indeed need a change to each one.
What should the new variables be called ?
FINAL_CFLAGS_COMPILE
FINAL_CFLAGS_LINK
?
Ian.