Fix tools build on Solaris
PATCH 1/1 Fix tools build on Solaris
# HG changeset patch
# User [email protected]
# Date 1161090606 25200
# Node ID c6bfe43048f3becda6966deceb7b70baea833b7c
# Parent 03d4223c846b14fc415cfd05d970c7b4d688fddb
Many of the tools use C99 features such as bool, or expect certain functions. Fix the CFLAGS to enable these on Solaris.
config/SunOS.mk +2 -0
@@ -35,6 +35,8 @@ CFLAGS += -g CFLAGS += -g endif +TOOL_CFLAGS += -std=gnu99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ + CAFLAGS = -Wa,--divide CONFIG_MBOOTPACK_OS = n
tools/blktap/drivers/Makefile +1 -0
@@ -8,6 +8,7 @@ INST_DIR = /usr/sbin INST_DIR = /usr/sbin LIBAIO_DIR = ../../libaio/src +CFLAGS += $(TOOL_CFLAGS) CFLAGS += -Werror CFLAGS += -Wno-unused CFLAGS += -fno-strict-aliasing
tools/blktap/lib/Makefile +1 -0
@@ -14,6 +14,7 @@ SRCS := SRCS := SRCS += xenbus.c blkif.c xs_api.c +CFLAGS += $(TOOL_CFLAGS) CFLAGS += -Werror CFLAGS += -Wno-unused CFLAGS += -fno-strict-aliasing -fPIC
tools/console/Makefile +1 -1
@@ -5,7 +5,7 @@ DAEMON_INSTALL_DIR = /usr/sbin DAEMON_INSTALL_DIR = /usr/sbin CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin -CFLAGS += -Werror -g +CFLAGS += $(TOOL_CFLAGS) -Werror -g CFLAGS += -I $(XEN_LIBXC) CFLAGS += -I $(XEN_XENSTORE)
tools/libxc/Makefile +1 -0
@@ -29,6 +29,7 @@ GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build -include $(XEN_TARGET_ARCH)/Makefile +CFLAGS += $(TOOL_CFLAGS) CFLAGS += -Werror CFLAGS += -fno-strict-aliasing CFLAGS += $(INCLUDES) -I.
tools/misc/Makefile +1 -1
@@ -1,7 +1,7 @@ XEN_ROOT=../.. XEN_ROOT=../.. include $(XEN_ROOT)/tools/Rules.mk -CFLAGS += -Werror +CFLAGS += $(TOOL_CFLAGS) -Werror INCLUDES += -I $(XEN_XC) INCLUDES += -I $(XEN_LIBXC)
tools/python/Makefile +5 -3
@@ -1,20 +1,22 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk + +CFLAGS += $(TOOL_CFLAGS) .PHONY: all all: build .PHONY: build build: - CFLAGS="$(CFLAGS)" python setup.py build + CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build .PHONY: install ifndef XEN_PYTHON_NATIVE_INSTALL install: all - CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force + CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force else install: all - CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force + CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force endif .PHONY: test
tools/python/setup.py +1 -1
@@ -4,7 +4,7 @@ import os XEN_ROOT = "../.." -extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ] +extra_compile_args = [ "-static-libgcc", "-fno-strict-aliasing", "-Wall", "-Werror" ] include_dirs = [ XEN_ROOT + "/tools/libxc",
tools/xenmon/Makefile +1 -0
@@ -15,6 +15,7 @@ include $(XEN_ROOT)/tools/Rules.mk sbindir=/usr/sbin +CFLAGS += $(TOOL_CFLAGS) CFLAGS += -Werror -g CFLAGS += -I $(XEN_XC) CFLAGS += -I $(XEN_LIBXC)
tools/xenstat/libxenstat/Makefile +1 -0
@@ -34,6 +34,7 @@ SONAME_FLAGS=$(SONAME_LDFLAG) -Wl,libxen WARN_FLAGS=-Wall -Werror +CFLAGS+=$(TOOL_CFLAGS) CFLAGS+=-Isrc -I$(XEN_LIBXC) -I$(XEN_XENSTORE) LDFLAGS+=-Lsrc -L$(XEN_XENSTORE)/ -L$(XEN_LIBXC)/
tools/xenstore/Makefile +1 -0
@@ -7,6 +7,7 @@ MINOR = 0 PROFILE=#-pg BASECFLAGS=-Wall -g -Werror +BASECFLAGS += $(TOOL_CFLAGS) # Make gcc generate dependencies. BASECFLAGS += -Wp,-MD,.$(@F).d PROG_DEP = .*.d
Quoted 4 lines · John Levon
Many of the tools use C99 features such as bool, or expect certain functions. Fix the CFLAGS to enable these on Solaris.
Signed-off-by John Levon <[email protected]>
Can't you fold TOOL_CFLAGS into CFLAGS? Why do you need a separate variable:
does it break the hypervisor build?
-- Keir
Quoted 7 lines · Keir Fraser
Quoted 4 lines
Many of the tools use C99 features such as bool, or expect certain functions. Fix the CFLAGS to enable these on Solaris.
Signed-off-by John Levon <[email protected]>Can't you fold
TOOL_CFLAGSinto CFLAGS? Why do you need a separate variable:
does it break the hypervisor build?
Yes. It's not at all clear why, but the -std=gnu99 causes:
gcc -O1 -fno-omit-frame-pointer -g -std=gnu99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -Wa,--divide -m64 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/export/johnlev/xen/xen-unstable-daily/xen.hg/xen/include -I/export/johnlev/xen/xen-unstable-daily/xen.hg/xen/include/asm-x86/mach-generic -I/export/johnlev/xen/xen-unstable-daily/xen.hg/xen/include/asm-x86/mach-default -msoft-float -mno-red-zone -fpic -fno-reorder-blocks -fno-asynchronous-unwind-tables -g -D__XEN__ -DVERBOSE -c domctl.c -o domctl.odomctl.c: In function `do_domctl':
domctl.c:173: error: initializer element is not constant
regards
john
Quoted 4 lines · John Levon
Quoted 2 lines
Can't you fold
TOOL_CFLAGSinto CFLAGS? Why do you need a separate variable:
does it break the hypervisor build?Yes. It's not at all clear why, but the -std=gnu99 causes:
Ah yes, C99 distinguishes initializers from expressions. The cast means that the compiler interprets the assignment as non-constant. I think the default mode (-std=gnu89) specifically allows this as a hack, mainly for Linux. -std=gnu99 is likely to become standard option in future and it probably wouldn't be hard to fix this.
-- Keir
Quoted 1 line · John Levon
+TOOL_CFLAGS += -std=gnu99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__
-std=gnu99 is now defined everywhere. If you need the -D options, please add them to your CFLAGS in SunOS.mk and submit the patch.
-- Keir