代码拷贝后编译出现CDPATH=“${ZSH_VERSION+.}:“ && cd .. && /bin/bash ..../missing aclocal-1.14 -I m4/config 报错
背景
最近拿一份祖传的strongswan代码在改,本来已经测试通过了,结果拷贝了一份再make就提示
make[2]: 进入目录“/root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/strongswan/build”
CDPATH="${ZSH_VERSION+.}:" && cd .. && /bin/bash /root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/strongswan/missing aclocal-1.14 -I m4/config
cd .. && /bin/bash /root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/strongswan/missing automake-1.14 --gnu
CDPATH="${ZSH_VERSION+.}:" && cd .. && /bin/bash /root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/strongswan/missing autoconf
configure.ac:344: error: possibly undefined macro: AC_LIB_PREFIX
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
Makefile:506: recipe for target '../configure' failed
make[2]: *** [../configure] Error 1
make[2]: 离开目录“/root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/strongswan/build”
/root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps/security/security.mk:195: recipe for target 'strongswan' failed
make[1]: *** [strongswan] Error 2
make[1]: 离开目录“/root/fsm_build/LINUX/target/nxp-lsdk-external-noship/flexbuild_lsdk2004/packages/apps”
Makefile:25: recipe for target 'strongswan' failed
make: *** [strongswan] Error 2
头大,原来编的好好的,没出现过这种问题呀
问题原因
原因是我是通过cp -r 复制的源码(git pull 同理),这就导致文件的创建时间发生了变化,大家都知道makefile是通过依赖文件的更改时间来自动推导目标文件是否要重新编译的,于是我的makefile就开始重新生成makefile.in了,然后我当前环境的automake还有问题,于是提示error: possibly undefined macro: AC_LIB_PREFIX。
附一份主makefile中关于makefile.in推导逻辑,大家有能力可以研究研究,我是没看懂
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
解决方法
解决方法有两个:
一是复制时复制时间戳属性,通过cp -ar ,rsync -av ,tar打包这些命令都可。
二是解决 error: possibly undefined macro: AC_LIB_PREFIX报错,我是将环境升级为automake-1.15后解决的

浙公网安备 33010602011771号