From 678760803e123338fc5b14677cc6f205a5b218fb Mon Sep 17 00:00:00 2001 From: Shinya Yamaoka Date: Sun, 7 Jul 2019 10:23:18 +0900 Subject: [PATCH] Sets -Wno-error=address-of-packed-member built with GCC9 See also https://github.com/frugalos/liberasurecode/issues/10. --- build.rs | 2 +- for_darwin_to_detect_compiler_flag.patch | 23 ----------------------- install_deps.sh | 8 +++----- liberasurecode_configure_ac.patch | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 for_darwin_to_detect_compiler_flag.patch create mode 100644 liberasurecode_configure_ac.patch diff --git a/build.rs b/build.rs index 2404614..2ce1092 100644 --- a/build.rs +++ b/build.rs @@ -14,7 +14,7 @@ fn main() { for file in &[ "install_deps.sh", "liberasurecode.patch", - "for_darwin_to_detect_compiler_flag.patch", + "liberasurecode_configure_ac.patch", ] { fs::copy(file, build_dir.join(file)).unwrap(); } diff --git a/for_darwin_to_detect_compiler_flag.patch b/for_darwin_to_detect_compiler_flag.patch deleted file mode 100644 index 4a33910..0000000 --- a/for_darwin_to_detect_compiler_flag.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/configure.ac 2019-04-19 16:27:52.000000000 +0900 -+++ b/configure.ac 2019-04-19 16:26:06.000000000 +0900 -@@ -39,6 +39,20 @@ AC_PROG_LN_S - dnl Compiling with per-target flags requires AM_PROG_CC_C_O. - AC_PROG_CC - AM_PROG_CC_C_O -+ -+# Check if a compiler supports "-Wno-error=address-of-packed-member" -+# If it supports the option, we add it to CFLAGS. -+ac_save_CFLAGS="$CFLAGS" -+AC_LANG_PUSH([C]) -+CFLAGS="-Wno-error=address-of-packed-member" -+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[]])], -+[ac_c_recognize_address_of_packed_member=1], -+[ac_c_recognize_address_of_packed_member=0]) -+AC_LANG_POP([C]) -+AS_IF([test $ac_c_recognize_address_of_packed_member -eq 1], -+[CFLAGS="$ac_save_CFLAGS -Wno-error=address-of-packed-member"], -+[CFLAGS="$ac_save_CFLAGS"]) -+ - AC_PROG_LIBTOOL - AC_PROG_CXX - AC_PROG_INSTALL diff --git a/install_deps.sh b/install_deps.sh index d0b81f1..e8240e2 100755 --- a/install_deps.sh +++ b/install_deps.sh @@ -39,11 +39,9 @@ cd ../ git clone https://github.com/openstack/liberasurecode.git cd liberasurecode/ git checkout 1.5.0 -if [ "$(uname)" == "Darwin" ]; then - # if the compiler has the feature to check `address-of-packed-member`, we suppress it. - # it is only annoying for liberasurecode v1.5.0. - patch -p1 < ../for_darwin_to_detect_compiler_flag.patch -fi +# if the compiler has the feature to check `address-of-packed-member`, we suppress it. +# it is only annoying for liberasurecode v1.5.0. +patch -p1 < ../liberasurecode_configure_ac.patch ./autogen.sh CFLAGS="-I${BUILD_DIR}/jerasure/include -I${BUILD_DIR}/include" CFLAGS=$CFLAGS LIBS="-lJerasure" LDFLAGS="-L${BUILD_DIR}/lib" ./configure --disable-shared --with-pic --prefix $BUILD_DIR diff --git a/liberasurecode_configure_ac.patch b/liberasurecode_configure_ac.patch new file mode 100644 index 0000000..74c6760 --- /dev/null +++ b/liberasurecode_configure_ac.patch @@ -0,0 +1,16 @@ +diff --git a/configure.ac b/configure.ac +index 16d4dc4..6614878 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -146,6 +146,11 @@ fi + AC_SUBST(GCOV_FLAGS) + AC_SUBST(GCOV_LDFLAGS) + ++# Check if a compiler supports "-Wno-error=address-of-packed-member" ++# If it supports the option, we add it to CFLAGS. ++AX_CHECK_COMPILE_FLAG([-Wno-error=address-of-packed-member], ++ [CFLAGS="${CFLAGS} -Wno-error=address-of-packed-member"]) ++ + dnl Expand the sources and objects needed to build the library + AC_SUBST(ac_aux_dir) + AC_SUBST(OBJECTS)