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.

Pablo
  • 28,133
  • 34
  • 125
  • 215

6 Answers6

42

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

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
picobello
  • 437
  • 4
  • 3
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.

John Marshall
  • 6,815
  • 1
  • 28
  • 38
  • Yes, `-I` did the trick and now I got `configure:19214: error: possibly undefined macro: LT_SMP_CACHE_BYTES`. – Pablo Dec 16 '11 at 12:33
  • Anyway, I'll have my own research first. Thanks for helping with this one. – Pablo Dec 16 '11 at 12:44
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.

iggy12345
  • 1,233
  • 12
  • 31
  • 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) – markgalassi Sep 18 '20 at 02:41
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.

冯耀明
  • 11
  • 1
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

Zv_oDD
  • 1,838
  • 1
  • 18
  • 26
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).

gkolarov
  • 21
  • 2