報錯"configure.ac: error: possibly undefined macro"的解決方案


在ubuntu上編譯libzmq時,生成configure和makefile的過程中報錯:

libzmq-master$ ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I config --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --include=config --force
configure.ac:28: error: possibly undefined macro: AC_SUBST
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:74: error: missing some pkg-config macros (pkg-config package)
configure.ac:83: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
configure.ac:84: error: possibly undefined macro: AC_PROG_LIBTOOL
configure.ac:132: error: possibly undefined macro: AC_MSG_RESULT
configure.ac:145: error: possibly undefined macro: AC_DEFINE
configure.ac:253: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:335: error: possibly undefined macro: AC_CHECK_HEADERS
configure.ac:337: error: possibly undefined macro: AC_MSG_ERROR
configure.ac:521: error: missing some pkg-config macros (pkg-config package)
configure.ac:526: error: possibly undefined macro: AC_SEARCH_LIBS
configure.ac:555: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:831: error: possibly undefined macro: AC_MSG_WARN
configure:6458: error: possibly undefined macro: AC_DISABLE_STATIC
configure:6462: error: possibly undefined macro: AC_ENABLE_STATIC
autoreconf: /usr/bin/autoconf failed with exit status: 1
autogen.sh: error: autoreconf exited with status 1

按照網友的建議,

sudo apt install automake libtool m4 autoconf

發現全都安裝了。嘗試其他解決方案:原文鏈接

一般通過apt-get安裝的軟件都會在/usr目錄下,既然提示無法找到AC_PROG_LIBTOOL,那么分析一般有兩個原因:

1.安裝包失敗或者其他原因比如版本問題導致沒有定義AC_PROG_LIBTOOL;

2.尋找路徑有問題。

從這兩點出發,可以在/usr目錄下全局查找AC_PROG_LIBTOOL

 

 

可以看到在m4文件中能找到AC_PROG_LIBTOOL,那么就可能是路徑問題;

大多數m4文件都在/usr/share/aclocal/目錄下,但實際上configure的默認aclocal路徑為/usr/local/share/aclocal,
那么可以有兩種方法,
第一,將/usr/share/aclocal/下的*.m4文件都拷貝到usr/local/share/aclocal/目錄下;
第二,指定aclocal的安裝路徑;

sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/

再次./autogen.sh,就通過了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM