Package: src:grub2
Version: 2.02~beta2
Severity: minor
Dear Maintainer,
Hello,
Using the rebuild infrastructure, your package fails to build with clang
instead of gcc.
Error message is:
error: unknown warning option '-Wno-unused-but-set-variable'; did you
mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
Full build log is available here:
http://clang.debian.net/logs/2015-03-25/grub2_2.02~beta2-22_unstable_clang.log
Thanks,
Joseph
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.0.4-2-ARCH (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru grub2-2.02~beta2/debian/patches/clang-build.patch grub2-2.02~beta2/debian/patches/clang-build.patch
--- grub2-2.02~beta2/debian/patches/clang-build.patch 1970-01-01 00:00:00.000000000 +0000
+++ grub2-2.02~beta2/debian/patches/clang-build.patch 2015-05-26 15:31:33.000000000 +0000
@@ -0,0 +1,21 @@
+Index: grub2-2.02~beta2/grub-core/kern/i386/tsc.c
+===================================================================
+--- grub2-2.02~beta2.orig/grub-core/kern/i386/tsc.c 2013-12-24 16:29:27.000000000 +0000
++++ grub2-2.02~beta2/grub-core/kern/i386/tsc.c 2015-05-26 15:31:27.196859750 +0000
+@@ -57,6 +57,8 @@
+ return (((grub_uint64_t) hi) << 32) | lo;
+ }
+
++#ifndef GRUB_MACHINE_XEN
++
+ static __inline int
+ grub_cpu_is_tsc_supported (void)
+ {
+@@ -68,6 +70,7 @@
+
+ return (d & (1 << 4)) != 0;
+ }
++#endif
+
+ #ifndef GRUB_MACHINE_XEN
+
diff -Nru grub2-2.02~beta2/debian/patches/series grub2-2.02~beta2/debian/patches/series
--- grub2-2.02~beta2/debian/patches/series 2015-05-14 15:15:33.000000000 +0000
+++ grub2-2.02~beta2/debian/patches/series 2015-05-26 15:30:36.000000000 +0000
@@ -69,3 +69,4 @@
hostfs_remove_ftm.patch
efi_sanitise_path.patch
arp_icmp_oversize_handling.patch
+clang-build.patch
diff -Nru grub2-2.02~beta2/debian/rules grub2-2.02~beta2/debian/rules
--- grub2-2.02~beta2/debian/rules 2015-05-14 15:15:33.000000000 +0000
+++ grub2-2.02~beta2/debian/rules 2015-05-26 15:29:06.000000000 +0000
@@ -29,6 +29,8 @@
endif
CC := gcc-4.9
+# clang doesn't support -Wno-unused-but-set-varible, it will give out a waring(-unknow-warning-option). This will result error while building because of -Werror. So for now we should set these flags while building with clang.
+ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"),1)
+ TARGET_CPPFLAGS += -Wno-error=unknown-warning-option
+ HOST_CFLAGS += -Wno-error=unknown-warning-option
+endif
confflags = PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)" CC=$(CC) TARGET_CC=$(CC) --enable-grub-mkfont
substvars =