2021-06-04 09:27 (UTC+0200), David Marchand:
> On Fri, Jun 4, 2021 at 12:29 AM Dmitry Kozlyuk <dmitry.kozl...@gmail.com> 
> wrote:
> >
> > 2021-06-03 18:55 (UTC+0200), David Marchand:
> > [...]  
> > > diff --git a/config/meson.build b/config/meson.build
> > > index 017bb2efbb..c6985139b4 100644
> > > --- a/config/meson.build
> > > +++ b/config/meson.build
> > > @@ -172,6 +172,13 @@ if libexecinfo.found() and 
> > > cc.has_header('execinfo.h')
> > >      dpdk_extra_ldflags += '-lexecinfo'
> > >  endif
> > >
> > > +libarchive = dependency('libarchive', required: false, method: 
> > > 'pkg-config')
> > > +if libarchive.found()
> > > +    dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
> > > +    add_project_link_arguments('-larchive', language: 'c')
> > > +    dpdk_extra_ldflags += '-larchive'
> > > +endif
> > > +  
> >
> > Suggestion:
> >
> > diff --git a/config/meson.build b/config/meson.build
> > index c6985139b4..c3668798c1 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -175,7 +175,6 @@ endif
> >  libarchive = dependency('libarchive', required: false, method: 
> > 'pkg-config')
> >  if libarchive.found()
> >      dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
> > -    add_project_link_arguments('-larchive', language: 'c')
> >      dpdk_extra_ldflags += '-larchive'
> >  endif
> >
> > diff --git a/lib/eal/meson.build b/lib/eal/meson.build
> > index 1722924f67..5a018d97d6 100644
> > --- a/lib/eal/meson.build
> > +++ b/lib/eal/meson.build
> > @@ -16,6 +16,7 @@ subdir(exec_env)
> >  subdir(arch_subdir)
> >
> >  deps += ['kvargs']
> > +ext_deps += libarchive
> >  if not is_windows
> >      deps += ['telemetry']
> >  endif
> >  
> 
> I had tried something close when preparing v2 (only keeping
> RTE_HAS_LIBARCHIVE in config/meson.build and putting extra_ldflags and
> ext_deps in lib/eal/unix/meson.build) but both my try and your
> suggestion break static compilation for the helloworld example.
> 
> 
> $ ./devtools/test-meson-builds.sh -vv
> ...
> ## Building helloworld
[snip]

Thanks for details.
Indeed, libarchive.pc lists all libraries present at libarchive build time
in Libs.private, despite that libarchive static linkage doesn't require them.
We'll have to go your way, sorry for misdirection.
Maybe it's worth a comment.

From libarchive README:

        I've attempted to minimize static link pollution. If you don't
        explicitly invoke a particular feature (such as support for a
        particular compression or format), it won't get pulled in to
        statically-linked programs. In particular, if you don't explicitly
        enable a particular compression or decompression support, you won't
        need to link against the corresponding compression or decompression
        libraries. This also reduces the size of statically-linked binaries
        in environments where that matters.

Reply via email to