automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Per-Object Flags for Autotool C++ library?


From: Jeffrey Walton
Subject: Re: Per-Object Flags for Autotool C++ library?
Date: Fri, 3 Nov 2017 14:10:14 -0400

On Fri, Nov 3, 2017 at 1:51 PM, Nick Bowler <address@hidden> wrote:
> On 11/3/17, Jeffrey Walton <address@hidden> wrote:
>> On Thu, Nov 2, 2017 at 6:04 PM, Jeffrey Walton <address@hidden> wrote:
>>> I'm working on adding Autotools to a C++ library and test program. My
>>> Automake.am has:
>>>
>>> <Nick and Mathieu's changes applied>
>>> ...
>> ...
> 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.

Thanks again. I thought this might be the case, but I don't read
Automake makefiles well.

Thumbing through the generated makefile did reveal this problem:
https://github.com/noloader/cryptopp-autotools/commit/961792eaee39.

>> 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.

Ah, thanks again. Maybe this could trigger the behavior
(https://github.com/noloader/cryptopp-autotools/blob/master/Makefile.am#L39):

   AM_DEFAULT_SOURCE_EXT = .cpp

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]