重现说明:
$ git clone --depth=1 git://sourceware.org/git/elfutils.git
$ cd elfutils
$ autoreconf -i -f
$ ./configure
错误日志:
...
checking whether the compiler generates build-ids... ./configure: line 6951: -n: command not found
no
configure: WARNING: compiler doesn't generate build-id by default
checking whether gcc supports -Wl,-z,relro... no
checking for __thread support... no
configure: error: __thread support required
这里缺少什么?
机器详情: MacOS 12.3.1
我评论掉了
# AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
# # Use the same flags that we use for our DSOs, so the test is representative.
# # Some old compiler/linker/libc combinations fail some ways and not others.
# save_CFLAGS="$CFLAGS"
# save_LDFLAGS="$LDFLAGS"
# CFLAGS="-fpic $CFLAGS"
# LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS"
# AC_LINK_IFELSE([dnl
# AC_LANG_PROGRAM([[#undef __thread
# static __thread int a; int foo (int b) { return a + b; }]],
# [[exit (foo (0));]])],
# ac_cv_tls=yes, ac_cv_tls=no)
# CFLAGS="$save_CFLAGS"
# LDFLAGS="$save_LDFLAGS"])
# AS_IF([test "x$ac_cv_tls" != xyes],
# AC_MSG_ERROR([__thread support required]))
#
然后重新生成配置
autoconf
最后解决这个问题