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

Re: Question on libapt-pkg-dev changes in 2.5.0



On Tue, May 24, 2022 at 01:12:12PM -0500, Dirk Eddelbuettel wrote:
> Now, as of version 2.5.0, it stopped compiling because
> 
>    In file included from buildDepends.cpp:26:
>    In file included from /usr/include/apt-pkg/debsrcrecords.h:14:
>    In file included from /usr/include/apt-pkg/srcrecords.h:15:
>    /usr/include/apt-pkg/hashes.h:19:10: fatal error: 'apt-pkg/tagfile-keys.h' file not found
>    #include <apt-pkg/tagfile-keys.h>
>             ^~~~~~~~~~~~~~~~~~~~~~~~
>    1 error generated.

Using apt-pkg/deb* files is usually a bad idea and most of the time not
even possible as the methods/classes they contain have their symbols not
exported in the library.

The deb files tend to contain implementation( detail)s for interfaces
defined in more public headers – just like it is the case here:


> Is there a reference or test client which retrieves this info under the
> updated API?  In essence I 'just' do (in R) something like this for a
> function returning build-depends
[…]
>    https://github.com/eddelbuettel/rcppapt/blob/master/src/buildDepends.cpp
[…]
> I can switch from 'debsrcrecord.h' to 'srcrecords.h' but how I replace
> debSrcRecordParser which only seems to be defined in debsrcrecords.h which I
> can no longer include.

You don't use debSrcRecordParser – you couldn't, it is a hidden class
and as such not exported – you are using debSrcRecordParser::Parser
which refers¹ to the public pkgSrcRecords::Parser class you should be
using instead and is the base class of the bad boy you were using.

So, to resolve your problem just replace the include of
'apt-pkg/debsrcrecords.h' with 'apt-pkg/srcrecords.h' and
'debSrcRecordParser' with 'pkgSrcRecords'.

You don't need to version guard this in any way, as this is what you
should have done all along and is available since ever. You are actually
using this exact interface a few lines below in another block (which you
have ifdef'ed out as well as you relied on debsrcrecords.h bringing in
the srcrecords.h include implicitly I guess).


Best regards

David Kalnischkies

¹ https://en.cppreference.com/w/cpp/language/injected-class-name

Attachment: signature.asc
Description: PGP signature


Reply to: