错误:可能是未定义的宏:AS_IF

时间:2017-07-19 09:04:07

标签: linux autoconf

我正在尝试编译TPM2.0-TSS项目,但在创建配置脚本时出错:

$ git clone https://github.com/01org/TPM2.0-TSS.git
Cloning into 'TPM2.0-TSS'...
remote: Counting objects: 6522, done.
remote: Total 6522 (delta 0), reused 0 (delta 0), pack-reused 6522
Receiving objects: 100% (6522/6522), 13.99 MiB | 4.44 MiB/s, done.
Resolving deltas: 100% (5081/5081), done.
$
$
$ cd TPM2.0-TSS/
$ ./bootstrap 
Generating file lists: src_vars.mk
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
configure.ac:14: error: possibly undefined macro: AS_IF
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:28: error: possibly undefined macro: AC_SUBST
configure.ac:31: error: possibly undefined macro: AC_MSG_ERROR
configure:12158: error: possibly undefined macro: AC_MSG_WARN
autoreconf: /usr/bin/autoconf failed with exit status: 1
$

奇怪的是,当我第二次打电话给bootstap时,它会成功。

$ ./bootstrap 
Generating file lists: src_vars.mk
configure.ac:4: installing './compile'
configure.ac:5: installing './config.guess'
configure.ac:5: installing './config.sub'
configure.ac:6: installing './install-sh'
configure.ac:6: installing './missing'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
$

还有一些其他帖子有类似错误,通过安装pkg-config解决了这些问题 - 但我的系统中已安装pkg-config

1 个答案:

答案 0 :(得分:0)

最后按照INSTALL.md的提示并安装autoconf-archiveinfo)解决了问题:

$ sudo apt -y update
$ sudo apt -y install \
  autoconf-archive \
  libcmocka0 \
  libcmocka-dev \
  build-essential \
  git \
  pkg-config \
  gcc \
  g++ \
  m4 \
  libtool \
  automake \
  autoconf

此外,检查是否设置了PKG_CONFIG变量:

$ env | grep PKG_CONFIG 
PKG_CONFIG=[...]/system/buildroot-x86/output/host/usr/bin/pkg-config
PKG_CONFIG_PATH=[...]/TPM2.0-TSS-INSTALL/lib/pkgconfig/
$
$ unset PKG_CONFIG
$ unset PKG_CONFIG_PATH
$
$ env | grep PKG_CONFIG 
$