All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv
@ 2011-12-20  8:49 Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 1 of 4 v3] blktap: remove local definitions and include byteswap.h Roger Pau Monne
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Roger Pau Monne @ 2011-12-20  8:49 UTC (permalink / raw)
  To: xen-devel

This patch contains various fixes to the build system to allow
building xen under uclibc with libiconv. Has been tested with uclibc
0.9.32, gcc 4.6.2 and libiconv 1.12, from Alpine Linux 2.3.2.

Changes since v2:

 * Added explicit defined(__linux) in bswap.h for both blktap and 
   blktap2.

 * Changed the way to check for libiconv presence.

Please review, Roger.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1 of 4 v3] blktap: remove local definitions and include byteswap.h
  2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
@ 2011-12-20  8:49 ` Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 2 of 4 v3] blktap2: " Roger Pau Monne
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monne @ 2011-12-20  8:49 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1324366300 -3600
# Node ID 32c735e9b6fc6250cb465d091e7fd30d95bf699e
# Parent  cf68eb390e1bf2fa4bb005ffeccfd41a01c3f81d
blktap: remove local definitions and include byteswap.h

Use the same approach as tools/blktap2/include/libvhd.h, remove local
definitions of bswap* and include byteswap.h. Also remove the
HAVE_BYTESWAP_H ifdef, since it was not defined in this context (it's
defined by QEMU).

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r cf68eb390e1b -r 32c735e9b6fc tools/blktap/drivers/bswap.h
--- a/tools/blktap/drivers/bswap.h	Tue Dec 20 08:21:11 2011 +0100
+++ b/tools/blktap/drivers/bswap.h	Tue Dec 20 08:31:40 2011 +0100
@@ -13,45 +13,9 @@
 #define bswap_16(x) swap16(x)
 #define bswap_32(x) swap32(x)
 #define bswap_64(x) swap64(x)
-#else
+#elif defined(__linux__)
 
-#ifdef HAVE_BYTESWAP_H
 #include <byteswap.h>
-#else
-
-#define bswap_16(x) \
-({ \
-	uint16_t __x = (x); \
-	((uint16_t)( \
-		(((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
-		(((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
-})
-
-#define bswap_32(x) \
-({ \
-	uint32_t __x = (x); \
-	((uint32_t)( \
-		(((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
-		(((uint32_t)(__x) & (uint32_t)0x0000ff00UL) <<  8) | \
-		(((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >>  8) | \
-		(((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
-})
-
-#define bswap_64(x) \
-({ \
-	uint64_t __x = (x); \
-	((uint64_t)( \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) <<  8) | \
-	        (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >>  8) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
-})
-
-#endif /* !HAVE_BYTESWAP_H */
 
 static inline uint16_t bswap16(uint16_t x)
 {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2 of 4 v3] blktap2: remove local definitions and include byteswap.h
  2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 1 of 4 v3] blktap: remove local definitions and include byteswap.h Roger Pau Monne
@ 2011-12-20  8:49 ` Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 3 of 4 v3] build: detect is libiconv is present Roger Pau Monne
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monne @ 2011-12-20  8:49 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1324366300 -3600
# Node ID 2fd10f2605439da1541646eda7276c8ff390b9de
# Parent  32c735e9b6fc6250cb465d091e7fd30d95bf699e
blktap2: remove local definitions and include byteswap.h

Use the same approach as tools/blktap2/include/libvhd.h, remove local
definitions of bswap* and include byteswap.h. Also remove the
HAVE_BYTESWAP_H ifdef, since it was not defined in this context (it's
defined by QEMU).

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 32c735e9b6fc -r 2fd10f260543 tools/blktap2/drivers/bswap.h
--- a/tools/blktap2/drivers/bswap.h	Tue Dec 20 08:31:40 2011 +0100
+++ b/tools/blktap2/drivers/bswap.h	Tue Dec 20 08:31:40 2011 +0100
@@ -13,45 +13,10 @@
 #define bswap_16(x) swap16(x)
 #define bswap_32(x) swap32(x)
 #define bswap_64(x) swap64(x)
-#else
+#elif defined(__linux__)
 
-#ifdef HAVE_BYTESWAP_H
+#include <endian.h>
 #include <byteswap.h>
-#else
-
-#define bswap_16(x) \
-({ \
-	uint16_t __x = (x); \
-	((uint16_t)( \
-		(((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
-		(((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
-})
-
-#define bswap_32(x) \
-({ \
-	uint32_t __x = (x); \
-	((uint32_t)( \
-		(((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
-		(((uint32_t)(__x) & (uint32_t)0x0000ff00UL) <<  8) | \
-		(((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >>  8) | \
-		(((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
-})
-
-#define bswap_64(x) \
-({ \
-	uint64_t __x = (x); \
-	((uint64_t)( \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) <<  8) | \
-	        (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >>  8) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
-		(uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
-})
-
-#endif /* !HAVE_BYTESWAP_H */
 
 static inline uint16_t bswap16(uint16_t x)
 {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3 of 4 v3] build: detect is libiconv is present
  2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 1 of 4 v3] blktap: remove local definitions and include byteswap.h Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 2 of 4 v3] blktap2: " Roger Pau Monne
@ 2011-12-20  8:49 ` Roger Pau Monne
  2011-12-20  8:49 ` [PATCH 4 of 4 v3] blktap2/vhd: add -liconv when linking if using libiconv Roger Pau Monne
  2012-01-10 16:03 ` [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Ian Jackson
  4 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monne @ 2011-12-20  8:49 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1324366300 -3600
# Node ID 023519bfc8964ba9de3521b458d05baa9c8bf4e0
# Parent  2fd10f2605439da1541646eda7276c8ff390b9de
build: detect is libiconv is present

Detect if libiconv is present in the system, since we will have to
link against it when using iconv.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 2fd10f260543 -r 023519bfc896 Config.mk
--- a/Config.mk	Tue Dec 20 08:31:40 2011 +0100
+++ b/Config.mk	Tue Dec 20 08:31:40 2011 +0100
@@ -181,6 +181,11 @@ CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PRE
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
 
+CONFIG_LIBICONV   := $(shell export OS="`uname -s`"; \
+                       export CHECK_LIB="$(CHECK_LIB)"; \
+                       . $(XEN_ROOT)/tools/check/funcs.sh; \
+                       has_lib libiconv.so && echo 'y' || echo 'n')
+
 # Enable XSM security module (by default, Flask).
 XSM_ENABLE ?= n
 FLASK_ENABLE ?= $(XSM_ENABLE)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4 of 4 v3] blktap2/vhd: add -liconv when linking if using libiconv
  2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
                   ` (2 preceding siblings ...)
  2011-12-20  8:49 ` [PATCH 3 of 4 v3] build: detect is libiconv is present Roger Pau Monne
@ 2011-12-20  8:49 ` Roger Pau Monne
  2012-01-10 16:03 ` [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Ian Jackson
  4 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monne @ 2011-12-20  8:49 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1324366300 -3600
# Node ID f72b99fccfca694674259cc1c03c526a827b67ec
# Parent  023519bfc8964ba9de3521b458d05baa9c8bf4e0
blktap2/vhd: add -liconv when linking if using libiconv

If libiconv is detected on the system add -liconv when linking the
libvhd library.

If -liconv is not added when compiling libvhd with libiconv the
following error occours when linking vhd-util and vhd-update:

gcc     -o vhd-util vhd-util.o -Llib -lvhd
lib/libvhd.so: undefined reference to `libiconv_open'
lib/libvhd.so: undefined reference to `libiconv_close'
lib/libvhd.so: undefined reference to `libiconv'

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 023519bfc896 -r f72b99fccfca tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile	Tue Dec 20 08:31:40 2011 +0100
+++ b/tools/blktap2/vhd/lib/Makefile	Tue Dec 20 08:31:40 2011 +0100
@@ -23,6 +23,10 @@ ifeq ($(CONFIG_Linux),y)
 LIBS            := -luuid
 endif
 
+ifeq ($(CONFIG_LIBICONV),y)
+LIBS            += -liconv
+endif
+
 LIB-SRCS        := libvhd.c
 LIB-SRCS        += libvhd-journal.c
 LIB-SRCS        += vhd-util-coalesce.c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv
  2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
                   ` (3 preceding siblings ...)
  2011-12-20  8:49 ` [PATCH 4 of 4 v3] blktap2/vhd: add -liconv when linking if using libiconv Roger Pau Monne
@ 2012-01-10 16:03 ` Ian Jackson
  2012-01-11  9:07   ` Roger Pau Monné
  4 siblings, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2012-01-10 16:03 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel

Roger Pau Monne writes ("[Xen-devel] [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv"):
> This patch contains various fixes to the build system to allow
> building xen under uclibc with libiconv. Has been tested with uclibc
> 0.9.32, gcc 4.6.2 and libiconv 1.12, from Alpine Linux 2.3.2.

Applied all four, thanks.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv
  2012-01-10 16:03 ` [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Ian Jackson
@ 2012-01-11  9:07   ` Roger Pau Monné
  2012-01-12 16:40     ` Ian Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Roger Pau Monné @ 2012-01-11  9:07 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

2012/1/10 Ian Jackson <Ian.Jackson@eu.citrix.com>:
> Roger Pau Monne writes ("[Xen-devel] [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv"):
>> This patch contains various fixes to the build system to allow
>> building xen under uclibc with libiconv. Has been tested with uclibc
>> 0.9.32, gcc 4.6.2 and libiconv 1.12, from Alpine Linux 2.3.2.
>
> Applied all four, thanks.

I was waiting to rework #3 once we had a working configure, but thanks
anyway. I will remove the CONFIG_LIBICONV once the configure script is
in.

>
> Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv
  2012-01-11  9:07   ` Roger Pau Monné
@ 2012-01-12 16:40     ` Ian Jackson
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2012-01-12 16:40 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel

Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv"):
> 2012/1/10 Ian Jackson <Ian.Jackson@eu.citrix.com>:
> > Applied all four, thanks.
> 
> I was waiting to rework #3 once we had a working configure, but thanks
> anyway. I will remove the CONFIG_LIBICONV once the configure script is
> in.

Right, that's what I was expecting, thanks.  I didn't think the
configure stuff ought to be on the critical path for the libiconv fix.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-12 16:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20  8:49 [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Roger Pau Monne
2011-12-20  8:49 ` [PATCH 1 of 4 v3] blktap: remove local definitions and include byteswap.h Roger Pau Monne
2011-12-20  8:49 ` [PATCH 2 of 4 v3] blktap2: " Roger Pau Monne
2011-12-20  8:49 ` [PATCH 3 of 4 v3] build: detect is libiconv is present Roger Pau Monne
2011-12-20  8:49 ` [PATCH 4 of 4 v3] blktap2/vhd: add -liconv when linking if using libiconv Roger Pau Monne
2012-01-10 16:03 ` [PATCH 0 of 4 v3] build: various fixes for building with uclibc and libiconv Ian Jackson
2012-01-11  9:07   ` Roger Pau Monné
2012-01-12 16:40     ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.