You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1 Mac(Sonoma 14.2.1)构建TPM2.0模拟器遇autoconf报错求助

问题

在运行macOS Sonoma(14.2.1)的M1 Mac上,尝试构建微软官方TPM 2.0参考实现的模拟器时,生成Makefile环节失败。执行以下步骤后出现报错:

$ export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

$ ./bootstrap
Generating file lists: src.mk
Setting up build
Setting default vendor strings

$ PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" EXTRA_CFLAGS=-fno-common ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... mkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking for libcrypto... yes
./configure: line 4650: syntax error near unexpected token `,'
./configure: line 4650: `AX_PTHREAD(, AC_MSG_ERROR([requires pthread]))'

执行make时提示:

make: *** No targets specified and no makefile found.  Stop

已确认autoconf和autoconf-archive均已安装:

$ brew info autoconf
==> autoconf: stable 2.72 (bottled)
Automatic configure script builder
https://www.gnu.org/software/autoconf
Installed
/usr/local/Cellar/autoconf/2.72 (71 files, 3.6MB) *
 Poured from bottle using the formulae.brew.sh API on 2024-05-05 at 23:35:38
 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/a/autoconf.rb
 License: GPL-3.0-or-later and (GPL-3.0-or-later with Autoconf-exception-3.0)
 ==> Dependencies
 Required: m4 ✔
 ==> Analytics
 install: 80,276 (30 days), 271,841 (90 days), 651,247 (365 days)
 install-on-request: 15,529 (30 days), 53,376 (90 days), 147,214 (365 days)
 build-error: 67 (30 days)

$ brew info autoconf-archive
==> autoconf-archive: stable 2023.02.20 (bottled)
Collection of over 500 reusable autoconf macros
https://savannah.gnu.org/projects/autoconf-archive/
Conflicts with:
 gnome-common (because both install ax_check_enable_debug.m4 and ax_code_coverage.m4)
Installed
/usr/local/Cellar/autoconf-archive/2023.02.20 (600 files, 3.6MB) *
 Poured from bottle using the formulae.brew.sh API on 2024-05-06 at 12:08:19
 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/a/autoconf-archive.rb
 License: GPL-3.0-or-later
 ==> Dependencies
 Required: autoconf ✔
 ==> Analytics
 install: 489 (30 days), 1,581 (90 days), 6,361 (365 days)
 install-on-request: 371 (30 days), 1,048 (90 days), 4,227 (365 days)
 build-error: 0 (30 days)

询问是否存在缺失的配置或PATH设置,以链接autoconf修复该报错?

解决方案

报错AX_PTHREAD(, AC_MSG_ERROR([requires pthread]))是因为AX_PTHREAD宏的格式不兼容当前autoconf版本,或是autoconf无法正确读取autoconf-archive的宏文件。可按以下步骤修复:

  • 指定autoconf宏文件路径
    autoconf-archive的宏文件默认存放在/usr/local/share/autoconf-archive,需要让autoconf能找到这个路径,执行:

    export ACLOCAL_PATH="/usr/local/share/aclocal:/usr/local/share/autoconf-archive"
    
  • 重新生成构建脚本
    清理之前的构建残留,重新运行bootstrap:

    make distclean
    ./bootstrap
    
  • 重新执行configure
    确保环境变量正确的前提下,再次运行configure:

    PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" EXTRA_CFLAGS=-fno-common ./configure
    
  • 手动修正宏调用格式(备选)
    如果上述步骤无效,可修改项目根目录的configure.ac文件,将AX_PTHREAD(, AC_MSG_ERROR([requires pthread]))改为:

    AX_PTHREAD([AC_MSG_ERROR([requires pthread])])
    

    修改后重新运行./bootstrap和configure。

  • 确保brew工具优先级
    避免系统自带的旧版autoconf干扰,将brew安装的工具路径放到PATH最前面:

    export PATH="/usr/local/bin:$PATH"
    

内容的提问来源于stack exchange,提问作者scottstots

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 09:00:56