Programming

정의되지 않은 매크로 : AC_MSG_ERROR

procodes 2020. 8. 8. 13:49
반응형

정의되지 않은 매크로 : AC_MSG_ERROR


configure.ac에 다음이 있습니다.

AC_CHECK_PROGS(MAKE,$MAKE make gmake,error)
if test "x$MAKE" = "xerror" ;then
  AC_MSG_ERROR([cannot find a make command])
fi

이것은 오랫동안 우리 프로젝트에 있었지만 일부 설정에서는 다음 오류가 발생합니다.

configure.ac:45: error: possibly undefined macro: AC_MSG_ERROR
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.

이 위에 최근 추가 된 줄 :

AC_CONFIG_MACRO_DIR([m4])
LT_INIT

누구든지이 오류의 원인과 문제를 추적하는 방법을 설명 할 수 있습니까?

편집 : 차이점에 대한 세부 정보 추가.

작동하는 상자 :

uname -a Linux host1 2.6.38-13-generic #53-Ubuntu SMP Mon Nov 28 19:33:45 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

automake: 1.11.1
autoconf: 2.67
m4: 1.4.14
libtoolize: 2.2.6b

작동하지 않는 상자 :

Linux host2 2.6.32-35-generic-pae #78-Ubuntu SMP Tue Oct 11 17:01:12 UTC 2011 i686 GNU/Linux

automake: 1.11.1
autoconf: 2.65
m4: 1.4.13
libtoolize: 2.2.6b

새로운 편집 : 32 비트 머신 만이이 어려움을 경험합니다.

업데이트 내가 가진 CentOS는 컴퓨터에 문제를 재현 할 수 있어요 autoconf 2.67, automake 1.11.1, libtool 2.2.6b,와 m4 1.4.14. 32 비트 컴퓨터의 버그입니까?


나는 이와 동일한 문제가 있었고 pkg-config패키지가 없다는 것을 알았 습니다.

패키지를 설치 한 후 모든 것이 올바르게 생성되었습니다.


aclocal.m4 등을 적절히 채우기 위해 autoreconf -fi수동으로 호출 하는 대신 사용 하는 것이 좋습니다 aclocal;autoconf;automake; #and whatever else.

추가 ACLOCAL_AMFLAGS = -I m4(최상위 Makefile.am에) 및 AC_CONFIG_MACRO_DIR([m4])자체 m4 파일을 사용하지 않는 경우 현재 여전히 선택 사항이지만 물론 그렇게하면 프로세스가 침묵합니다 :)


나는 내 자신 에이 문제가 configure.ac있었지만이 경우 (그리고 여기 Google의 누구에게나 이익을 위해) 실수로을 인용했기 때문에 AC_MSG_ERROR문자열로 취급되었습니다.

AX_BOOST_BASE([1.42], [], [AC_MSG_ERROR([Could not find Boost])])

AC_MSG_ERROR매크로 주변의 대괄호를 제거하면 다음 과 같이 작동합니다.

AX_BOOST_BASE([1.42], [], AC_MSG_ERROR([Could not find Boost]))

설치해야한다는 의견 pkg-config이나 일부 패키지에는 요점이 없습니다. AC_MSG_ERROR일에 생각하고 "당신은 패키지 XYZ를 설치해야합니다"와 같은 당신에게 도움이되는 메시지를 제공하지만, 때문에 일부 문제의입니다 AC_MSG_ERROR작동하지 않습니다. 패키지 XYZ를 설치하면 확실히 오류가 사라지지만 패키지가 있으면 더 이상 오류 메시지를 인쇄 할 필요가 없기 때문입니다!

따라서 설치 pkg-config또는 특정 패키지는 문제를 우회 할뿐 실제로 문제를 해결하지는 않습니다.


CentOS 7에서 이와 동일한 문제가 발생했습니다.

경우에 따라 libcurl-devel( libcurl이 시스템에 이미 설치되어 있음) 설치 후 문제가 발생했습니다.


나는 또한 비슷한 문제가 있었다 .. 내 해결책은

apt-get install libcurl4-openssl-dev

(나는 libcurl이 모두 설치되어 있었다) 적어도 나를 위해 일했다 ..


로컬 ' m4'디렉토리 를 설정하고 있습니까? 예 :

> aclocal -I m4 --install

일부 패키지는 glibtoolize, autoheader, autoconf, automake를 실행하기 위한 autogen.sh또는 initgen.sh쉘 스크립트 와 함께 제공됩니다 . autogen.sh내가 사용 하는 스크립트 는 다음과 같습니다 .

#! /bin/sh

case `uname` in Darwin*) glibtoolize --copy ;;
  *) libtoolize --copy ;; esac

autoheader
aclocal -I m4 --install
autoconf

automake --foreign --add-missing --force-missing --copy

편집하다

ACLOCAL_AMFLAGS = -I m4최상위 수준 에 추가해야 할 수 있습니다 Makefile.am.


데비안의 경우. 필수 패키지는 다음과 같습니다. m4 automake pkg-config libtool


otto-de / libvmod-uuid를 사용하여 RHEL7.5에서 동일한 문제가 발생했습니다.

"autoconf-archive"패키지를 설치하여 수정되었습니다.


The error is generated by autom4te. If things are set up correctly, the portion of the code that generates that error should never see 'AC_MSG_ERROR', because it should have been expanded by m4 before that point. You say the error only happens "in some setups". I would suggest that in those setups, your autoconf installation is fubar. Possibly you have an incompatible version of m4 installed.


Using MacOS X

sudo port install pkgconfig

was the solution!


On Mac OS X el captain with brew, try:
brew install pkgconfig

This worked for me.


My issue is resolved after I install pkg-config on Mac (brew install pkg-config)


I solved this by yum install libtool


There are two possible reasons for that problem:

  1. did not install aclocal.
    solution:install libtool

    • For ubuntu: sudo apt-get install libtool
    • For centos: sudo yum install libtool
  2. the path to LIBTOOL.m4 is error.
    solution:

    1. use aclocal --print-ac-dir to check current path to aclocal.(It's usually should be "/usr/share/aclocal" or "/usr/share/aclocal")
    2. Then check if there are *.m4 files.
    3. If not, cp corresponding *.m4 files to this path.( Maybe cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/ or cp /usr/local/share/aclocal/*.m4 /usr/share/aclocal/)

Hope it helps


This happened to me when I forgot a , in the arguments for a locally defined macro. Spent hours trying to figure it out (barely acquainted with autotools)...

AC_CHECK_MACRO([Foo]
    AC_LOCAL_DO([......

should have been

AC_CHECK_MACRO([Foo],      # <-- Notice comma, doh!
    AC_LOCAL_DO([......

Seems like it should have given me an error or such, but I suppose being a macro processor it can only do what its told.


I had the same problem on Ubuntu (error: possibly undefined macro: AC_MSG_ERROR) but the answers above didn't work for me. I found the solution here

That did the trick:

$ LANG=C LC_CTYPE=C ./autogen.sh

I had the same problem with the Macports port "openocd" (locally modified the Portfile to use the git repository) on a freshly installed machine.

The permanent fix is easy, define a dependency to pkgconfig in the Portfile: depends_lib-append port:pkgconfig

참고URL : https://stackoverflow.com/questions/8811381/possibly-undefined-macro-ac-msg-error

반응형