macro `AM_PATH_CPPUNIT' not found in library
Asked Answered
P

6

9

I am trying to build libtorrent on shared hosting. So built CPPUnit(1.12.1) with --prefix=$HOME. After that my $HOME/lib and $HOME/include contains CPPUnit libraries and headers.

The I exported LD_ paths

export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export LD_INCLUDE_PATH=$HOME/include:$LD_INCLUDE_PATH

Then I run libtorrent/autogen.sh --prefix=$HOME and getting the following warning, which prevents me to run configure:

aclocal...
aclocal:configure.ac:20: warning: macro `AM_PATH_CPPUNIT' not found in library

cppunit.m4 file is located in $HOME/share/aclocal. I guess libtorrent can't find that dir for some reason.

Planchette answered 16/12, 2011 at 12:4 Comment(0)
M
5

You installed CPPUnit in a non-system place that's not searched by default, so oddly enough when running aclocal within the libtorrent build, it didn't know to look there. You can tell aclocal where to look with -I and I'm sure you can find a way to do that with autogen.sh in the middle.

Mozellamozelle answered 16/12, 2011 at 12:13 Comment(2)
Yes, -I did the trick and now I got configure:19214: error: possibly undefined macro: LT_SMP_CACHE_BYTES.Planchette
Anyway, I'll have my own research first. Thanks for helping with this one.Planchette
N
42

You need to do an apt-get install libcppunit-dev

Nebulosity answered 2/8, 2012 at 12:49 Comment(1)
This no longer works. cppunit.m4 was removed from libcppunit-dev.Bivalent
M
5

You installed CPPUnit in a non-system place that's not searched by default, so oddly enough when running aclocal within the libtorrent build, it didn't know to look there. You can tell aclocal where to look with -I and I'm sure you can find a way to do that with autogen.sh in the middle.

Mozellamozelle answered 16/12, 2011 at 12:13 Comment(2)
Yes, -I did the trick and now I got configure:19214: error: possibly undefined macro: LT_SMP_CACHE_BYTES.Planchette
Anyway, I'll have my own research first. Thanks for helping with this one.Planchette
H
4

I stumbled across this page trying to follow the default cppunit Money tutorial. As @Carlo Wood specified

This no longer works. cppunit.m4 was removed from libcppunit-dev.

Which is true, I followed the next answer to no avail, there is no cppunit.m4, the error is that you don't even need AM_PATH_CPPUNIT, just use

ProgramName_LDADD = -lcppunit

instead of ProgramName_LDFLAGS = $(CPPUNIT_LIBS)

Furthermore, I don't know if the rest of the Makefile.am is actually necessary, this is the Makefile I ended up using

Makefile.am

TESTS = MoneyApp
bin_PROGRAMS = $(TESTS)
MoneyApp_SOURCES = ...
MoneyApp_CXXFLAGS = $(CPPUNIT_CFLAGS)
MoneyApp_LDADD = -lcppunit

And config.ac

AC_INIT([MoneyApp], 1.0)
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CXX
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

Hopefully this helps somebody in the future.

Heretofore answered 11/5, 2020 at 19:0 Comment(1)
Even if they don't use pkg-config for cppunit, you should still test for it with AC_CHECK_LIB([cppunit], [main]) or something like this:""" PKG_CHECK_MODULES([CPPUNIT], [cppunit], [], AC_MSG_ERROR(please install library and try again -- see HACKING file)) """ so that your users get an error (or warning if you use AC_MSG_WARN) to tell them they need to install cppunit. (note that this comment feature did not let me put newlines to make it more readable)Reprehension
S
1

I try everymethod that I found in the internet. But fix it at last only when get know the root cause.

1.The AM_PATH_CPPUNIT is declared in cppunit.m4. The errors happens because the cppunit.m4 is not found.

2.command "aclocal --version" to find out the version. i.e. aclocal-1.15.

3.command "find / | grep aclocal-1.15" to find out the lib place. i.e. /usr/local/share/aclocal-1.15

4.command "find / | grep cppunit.m4" to make sure you have a cppunit.m4. if not, command "yum list *cppunit*" and install the package listed.an repeat current step.

5.copy that cppunit.m4 to the mentioned aclocal lib path.

6.run again and the error disappear.

Schoenberg answered 12/1, 2016 at 2:6 Comment(0)
R
0

I had the same problem when building libtorrent with MSYS2 in Windows. Installed cppunit package and the autogen.sh step completed error free.

pacman -S mingw-w64-x86_64-cppunit

or for 32bit: pacman -S mingw-w64-i686-cppunit

.

Also for building libtorrent Windows MSYS run configure with --disable-mincore:

./configure --disable-mincore

https://rtwi.jmk.hu/wiki/rTorrentOnWindows

Rehm answered 16/12, 2016 at 13:43 Comment(0)
C
0

At Ubuntu 18.04/bionic the @iggy12345 's solution worked perfectly. Only had to add "touch stdafx.h" and remove -I option from aclocal (on Ubuntu it is installed in /usr/share, not in /usr/local/share).

Crinite answered 17/11, 2022 at 8:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.