On Tue, 2011-03-22 at 17:25 +0000, Ian Campbell wrote:
> On Tue, 2011-03-22 at 17:16 +0000, Konrad Rzeszutek Wilk wrote:
> > On Mon, Mar 21, 2011 at 03:53:25PM +0000, Ian Campbell wrote:
> > > On Mon, 2011-03-21 at 14:53 +0000, Ian Jackson wrote:
> > > > Ian Campbell writes ("Re: [Xen-devel] Build problem: note:
> > > > 'xtl_createlogger_stdiostream' is defined in DSO .. so try adding it to
> > > > the linker command line... libxenctrl.so.4.0: could not read symbols:
> > > > Invalid operation"):
> > > > > xl: link against libxenctrl
> > > >
> > > > I've applied this, thanks. Although I don't understand why the build
> > > > failed for Konrad and not me or my test system.
> > >
> > > Me neither.
> >
> > I am not sure either. Here is another with todays pull:
> >
> > gcc -o xl xl.o xl_cmdimpl.o xl_cmdtable.o libxlutil.so
> > -L/home/konrad/ssd/xtt/xen-unstable/tools/libxl/../../tools/libxl
> > -Wl,-rpath-link=/home/konrad/ssd/xtt/xen-unstable/tools/libxl/../../tools/libxc
> >
> > -Wl,-rpath-link=/home/konrad/ssd/xtt/xen-unstable/tools/libxl/../../tools/xenstore
> >
> > -Wl,-rpath-link=/home/konrad/ssd/xtt/xen-unstable/tools/libxl/../../tools/blktap2/control
> > -lxenlight
> > -L/home/konrad/ssd/xtt/xen-unstable/tools/libxl/../../tools/libxc -lxenctrl
> > /usr/bin/ld: xl_cmdimpl.o: undefined reference to symbol
> > 'uuid_parse@@UUID_1.0'
> > /usr/bin/ld: note: 'uuid_parse@@UUID_1.0' is defined in DSO
> > /lib64/libuuid.so.1 so try adding it to the linker command line
> > /lib64/libuuid.so.1: could not read symbols: Invalid operation
>
> This is due to the use of the uuid library being inlined in the libxl
> headers, so the user of libxl can end up with linking requirements due
> to libxl header internals. I think the right fix is to move these out of
> line like I did with essentially the same thing in blktap2. I'll take a
> look shortly.
Konrad, Jeremy,
Does this help?
Christoph,
Does it work for BSD?
Ian.
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1300893083 0
# Node ID 83ff83c380c0bfb594e6ac0ccc860cfc60741242
# Parent 26ba6a80310af7c3b360d4b78da8f3ff7188a9e8
tools/libxl: move uuid wrapper functions out of line.
This isolates users of libxenlight from the need to know about the
different OS schemes for UUIDs, in particular the linkage
requirements.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 26ba6a80310a -r 83ff83c380c0 tools/libxl/Makefile
--- a/tools/libxl/Makefile Mon Mar 21 14:41:46 2011 +0000
+++ b/tools/libxl/Makefile Wed Mar 23 15:11:23 2011 +0000
@@ -34,7 +34,7 @@ LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpu
LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
- libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
+ libxl_internal.o libxl_utils.o libxl_uuid.o
$(LIBXL_OBJS-y)
LIBXL_OBJS += _libxl_types.o
$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
$(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
diff -r 26ba6a80310a -r 83ff83c380c0 tools/libxl/libxl_uuid.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_uuid.c Wed Mar 23 15:11:23 2011 +0000
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2008,2010 Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <libxl_uuid.h>
+
+#if defined(__linux__)
+
+int libxl_uuid_is_nil(libxl_uuid *uuid)
+{
+ return uuid_is_null(uuid->uuid);
+}
+
+void libxl_uuid_generate(libxl_uuid *uuid)
+{
+ uuid_generate(uuid->uuid);
+}
+
+int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
+{
+ return uuid_parse(in, uuid->uuid);
+}
+
+void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+{
+ uuid_copy(dst->uuid, src->uuid);
+}
+
+void libxl_uuid_clear(libxl_uuid *uuid)
+{
+ uuid_clear(uuid->uuid);
+}
+
+int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
+{
+ return uuid_compare(uuid1->uuid, uuid2->uuid);
+}
+
+uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
+{
+ return uuid->uuid;
+}
+
+#elif defined(__NetBSD__)
+
+int libxl_uuid_is_nil(libxl_uuid *uuid)
+{
+ uint32_t status;
+ return uuid_is_nil((uuid_t *)uuid->uuid, &status);
+}
+
+void libxl_uuid_generate(libxl_uuid *uuid)
+{
+ uint32_t status;
+ uuid_create((uuid_t *)uuid->uuid, &status);
+ assert(status == uuid_s_ok);
+}
+
+#define LIBXL__UUID_PTRS(uuid) &uuid[0], &uuid[1], &uuid[2], &uuid[3], \
+ &uuid[4], &uuid[5], &uuid[6], &uuid[7], \
+ &uuid[8], &uuid[9], &uuid[10],&uuid[11], \
+ &uuid[12],&uuid[13],&uuid[14],&uuid[15]
+int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
+{
+ if ( sscanf(in, LIBXL_UUID_FMT, LIBXL__UUID_PTRS(uuid->uuid)) !=
sizeof(uuid->uuid) )
+ return -1;
+ return 0;
+}
+#undef LIBXL__UUID_PTRS
+
+void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+{
+ memcpy(dst->uuid, src->uuid, sizeof(dst->uuid));
+}
+
+void libxl_uuid_clear(libxl_uuid *uuid)
+{
+ memset(uuid->uuid, 0, sizeof(uuid->uuid));
+}
+
+int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
+{
+ return memcmp(uuid1->uuid, uuid2->uuid, sizeof(uuid1->uuid));
+}
+
+uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
+{
+ return uuid->uuid;
+}
+
+#else
+
+#error "Please update libxl_uuid.c for your OS"
+
+#endif
diff -r 26ba6a80310a -r 83ff83c380c0 tools/libxl/libxl_uuid.h
--- a/tools/libxl/libxl_uuid.h Mon Mar 21 14:41:46 2011 +0000
+++ b/tools/libxl/libxl_uuid.h Wed Mar 23 15:11:23 2011 +0000
@@ -24,47 +24,13 @@
#if defined(__linux__)
#include <uuid/uuid.h>
+#include <stdint.h>
typedef struct {
uuid_t uuid;
} libxl_uuid;
#define LIBXL_UUID_BYTES(arg) LIBXL__UUID_BYTES(((uint8_t *)arg.uuid))
-
-static inline int libxl_uuid_is_nil(libxl_uuid *uuid)
-{
- return uuid_is_null(uuid->uuid);
-}
-
-static inline void libxl_uuid_generate(libxl_uuid *uuid)
-{
- uuid_generate(uuid->uuid);
-}
-
-static inline int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
-{
- return uuid_parse(in, uuid->uuid);
-}
-
-static inline void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
-{
- uuid_copy(dst->uuid, src->uuid);
-}
-
-static inline void libxl_uuid_clear(libxl_uuid *uuid)
-{
- uuid_clear(uuid->uuid);
-}
-
-static inline int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
-{
- return uuid_compare(uuid1->uuid, uuid2->uuid);
-}
-
-static inline uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
-{
- return uuid->uuid;
-}
#elif defined(__NetBSD__)
@@ -80,55 +46,18 @@ typedef struct {
uint8_t uuid[16];
} libxl_uuid;
-static inline int libxl_uuid_is_nil(libxl_uuid *uuid)
-{
- uint32_t status;
- return uuid_is_nil((uuid_t *)uuid->uuid, &status);
-}
-
-static inline void libxl_uuid_generate(libxl_uuid *uuid)
-{
- uint32_t status;
- uuid_create((uuid_t *)uuid->uuid, &status);
- assert(status == uuid_s_ok);
-}
-
-#define LIBXL__UUID_PTRS(uuid) &uuid[0], &uuid[1], &uuid[2], &uuid[3], \
- &uuid[4], &uuid[5], &uuid[6], &uuid[7], \
- &uuid[8], &uuid[9], &uuid[10],&uuid[11], \
- &uuid[12],&uuid[13],&uuid[14],&uuid[15]
-static inline int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
-{
- if ( sscanf(in, LIBXL_UUID_FMT, LIBXL__UUID_PTRS(uuid->uuid)) !=
sizeof(uuid->uuid) )
- return -1;
- return 0;
-}
-#undef LIBXL__UUID_PTRS
-
-static inline void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
-{
- memcpy(dst->uuid, src->uuid, sizeof(dst->uuid));
-}
-
-static inline void libxl_uuid_clear(libxl_uuid *uuid)
-{
- memset(uuid->uuid, 0, sizeof(uuid->uuid));
-}
-
-static inline int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
-{
- return memcmp(uuid1->uuid, uuid2->uuid, sizeof(uuid1->uuid));
-}
-
-static inline uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
-{
- return uuid->uuid;
-}
-
#else
#error "Please update libxl_uuid.h for your OS"
#endif
+int libxl_uuid_is_nil(libxl_uuid *uuid);
+void libxl_uuid_generate(libxl_uuid *uuid);
+int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
+void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src);
+void libxl_uuid_clear(libxl_uuid *uuid);
+int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
+uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
+
#endif /* __LIBXL_UUID_H__ */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|