On 11/3/17, Jeffrey Walton <noloa...@gmail.com> wrote: > On Thu, Nov 2, 2017 at 6:04 PM, Jeffrey Walton <noloa...@gmail.com> wrote: >> I'm working on adding Autotools to a C++ library and test program. My >> Automake.am has: >> >> <Nick and Mathieu's changes applied> >> ... > > I believe I applied Nick and Mathieu correctly. The project is > available at https://github.com/noloader/cryptopp-autotools . It > includes the six Git commands to duplicate the issue. > > The new issue is, the compile stops after about 4 files are compiled. > Here's the pastebin of `make V=1`: https://pastebin.com/nCYN2RHh. The > error is also shown below. > > The linker is invoked for reasons unknown to me at the moment. Most of > the objects are missing. I even deleted the project's directory and > re-cloned to ensure they were not old artifacts hanging around.
For whatever reason it appears that the generated makefile has missing prerequisites for libcryptopp.la. I would expect everything listed in LIBADD to end up as a prerequisite of the library. This might require some investigation to find out why that apparently did not happen in your case. Adding everything to EXTRA_libcryptopp_la_DEPENDENCIES might help as a workaround, e.g., EXTRA_libcryptopp_la_DEPENDENCIES = $(libcryptopp_la_LIBADD) But this (or equivalent) should have happened automatically. > I have no idea why a C compiler is being invoked in some places. I > took great care to ensure Autoconf knew this was a C++ project, and > not a C project. That's another problem I've been searching for an > answer for. It seems it decided to link the library using the C compiler because no source files are specified for the library. There may be (or should be) a way to force it one way or the other, but an obvious workaround is to specify at least one C++ source file in libcryptopp_la_SOURCES (could be one of the real files or just a stub). The _SOURCES objects will appear earlier on the linker command line than any of the _LIBADD objects. Cheers, Nick