Build failure on macOS 10.15

Julien ÉLIE julien at trigofacile.com
Sun Nov 29 21:25:20 UTC 2020


Hi Bo,

Suggested fix:

--- m4/cc-flags.m4	(révision 10422)
+++ m4/cc-flags.m4	(copie de travail)
@@ -1,9 +1,10 @@
  dnl Check whether the compiler supports particular flags.
  dnl $Id$
  dnl
-dnl Provides INN_PROG_CC_FLAG, which checks whether a compiler supports a
-dnl given flag.  If it does, the commands in the second argument are 
run.  If
-dnl not, the commands in the third argument are run.
+dnl Provides INN_PROG_CC_FLAG and INN_PROG_LD_FLAG, which check whether
+dnl a compiler supports a given flag, respectively in CFLAGS and LDFLAGS
+dnl when invoking the linker.  If it does, the commands in the second
+dnl argument are run.  If not, the commands in the third argument are run.
  dnl
  dnl The canonical version of this file is maintained in the rra-c-util
  dnl package, available at 
<https://www.eyrie.org/~eagle/software/rra-c-util/>.
@@ -29,6 +30,8 @@
  dnl Used to build the result cache name.
  AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
  [translit([inn_cv_compiler_c_$1], [-=+,], [____])])
+AC_DEFUN([_INN_PROG_LD_FLAG_CACHE],
+[translit([inn_cv_linker_c_$1], [-=+,], [____])])

  dnl Check whether a given flag is supported by the compiler.
  AC_DEFUN([INN_PROG_CC_FLAG],
@@ -46,3 +49,16 @@
   AC_MSG_RESULT([$_INN_PROG_CC_FLAG_CACHE([$1])])
   AS_IF([test x"$_INN_PROG_CC_FLAG_CACHE([$1])" = xyes], [$2], [$3])])

+dnl Check whether a given flag is supported by the linker.
+AC_DEFUN([INN_PROG_LD_FLAG],
+[AC_REQUIRE([AC_PROG_CC])
+ AC_MSG_CHECKING([if $LD supports $1])
+ AC_CACHE_VAL([_INN_PROG_LD_FLAG_CACHE([$1])],
+    [save_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS $1"
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int foo = 0;])],
+        [_INN_PROG_LD_FLAG_CACHE([$1])=yes],
+        [_INN_PROG_LD_FLAG_CACHE([$1])=no])
+     LDFLAGS=$save_LDFLAGS])
+ AC_MSG_RESULT([$_INN_PROG_LD_FLAG_CACHE([$1])])
+ AS_IF([test x"$_INN_PROG_LD_FLAG_CACHE([$1])" = xyes], [$2], [$3])])
--- configure.ac	(révision 10422)
+++ configure.ac	(copie de travail)
@@ -686,14 +686,14 @@
  AS_IF([test x"$inn_enable_hardening_flags" = xyes],
      [INN_PROG_CC_FLAG([-fPIE], [CFLAGS="${CFLAGS} -fPIE"
                                  CC_WARNINGS="${CC_WARNINGS} -fPIE"
-                                LDFLAGS="${LDFLAGS} -fPIE -pie"], [])
+                                LDFLAGS="${LDFLAGS} -pie"], [])
       INN_PROG_CC_FLAG([-fstack-protector-strong],
                        [CFLAGS="${CFLAGS} -fstack-protector-strong"
                         CC_WARNINGS="${CC_WARNINGS} 
-fstack-protector-strong"],
                        [])
-     INN_PROG_CC_FLAG([-Wl,-z,relro],
+     INN_PROG_LD_FLAG([-Wl,-z,relro],
                        [LDFLAGS="${LDFLAGS} -Wl,-z,relro"], [])
-     INN_PROG_CC_FLAG([-Wl,-z,now],
+     INN_PROG_LD_FLAG([-Wl,-z,now],
                        [LDFLAGS="${LDFLAGS} -Wl,-z,now"], [])])

  dnl Clean up our LIBS, just for grins.



> config.log contains:
>> configure:30703: checking if gcc supports -Wl,-z,relro
>> configure:30728: gcc -c -Wno-error=all -Os -g -fPIE -fstack-protector-strong -Wl,-z,relro  conftest.c >&5
>> clang: warning: -Wl,-z,relro: 'linker' input unused [-Wunused-command-line-argument]
>> configure:30728: $? = 0
>> configure:30737: result: yes
>> configure:30743: checking if gcc supports -Wl,-z,now
>> configure:30768: gcc -c -Wno-error=all -Os -g -fPIE -fstack-protector-strong -Wl,-z,now  conftest.c >&5
>> clang: warning: -Wl,-z,now: 'linker' input unused [-Wunused-command-line-argument]
>> configure:30768: $? = 0
>> configure:30777: result: yes

With the above patch, the result seems the expected one with macOS 11.0:

configure:30423: checking if 
/Library/Developer/CommandLineTools/usr/bin/ld supports -Wl,-z,relro
configure:30441: gcc -o conftest -g -O2 -fPIE -fstack-protector-strong 
  -pie -Wl,-z,relro conftest.c  >&5
clang: warning: argument unused during compilation: '-pie' 
[-Wunused-command-line-argument]
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)
configure:30441: $? = 1
configure:30451: result: no
configure:30457: checking if 
/Library/Developer/CommandLineTools/usr/bin/ld supports -Wl,-z,now
configure:30475: gcc -o conftest -g -O2 -fPIE -fstack-protector-strong 
  -pie -Wl,-z,now conftest.c  >&5
clang: warning: argument unused during compilation: '-pie' 
[-Wunused-command-line-argument]
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)
configure:30475: $? = 1
configure:30485: result: no



Is it OK for you too?

-- 
Julien ÉLIE

« Pourquoi les programmeurs confondent-ils Halloween et Noël ?
   Parce que OCT 31 == DEC 25. »


More information about the inn-workers mailing list