On Tue, Mar 31, 2020 at 01:36:46PM +0000, Pavan Nikhilesh Bhagavatula wrote:
>
>
> >-----Original Message-----
> >From: dev <dev-boun...@dpdk.org> On Behalf Of Bruce Richardson
> >Sent: Monday, March 30, 2020 6:47 PM
> >To: Jerin Jacob Kollanukkaran <jer...@marvell.com>
> >Cc: Thomas Monjalon <tho...@monjalon.net>; Pavan Nikhilesh
> >Bhagavatula <pbhagavat...@marvell.com>; Liang Ma
> ><liang.j...@intel.com>; Peter Mccarthy <peter.mccar...@intel.com>;
> >Marko Kovacevic <marko.kovace...@intel.com>; Ori Kam
> ><or...@mellanox.com>; Radu Nicolau <radu.nico...@intel.com>; Akhil
> >Goyal <akhil.go...@nxp.com>; Tomasz Kantecki
> ><tomasz.kante...@intel.com>; Sunil Kumar Kori <sk...@marvell.com>;
> >David Hunt <david.h...@intel.com>; Honnappa Nagarahalli
> ><honnappa.nagaraha...@arm.com>; dev@dpdk.org;
> >david.march...@redhat.com; mattias.ronnb...@ericsson.com
> >Subject: Re: [dpdk-dev] [PATCH v3 01/33] meson: add libatomic as a
> >global dependency for i686 clang
> >
> >On Sun, Mar 29, 2020 at 08:13:10PM +0530, jer...@marvell.com wrote:
> >> From: Pavan Nikhilesh <pbhagavat...@marvell.com>
> >>
> >> Add libatomic as a global dependency when compiling for 32-bit using
> >> clang. As we need libatomic for 64-bit atomic ops.
> >>
> >> Cc: bruce.richard...@intel.com
> >> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
> >> ---
> >> config/meson.build | 10 ++++++++++
> >> drivers/event/octeontx/meson.build | 5 -----
> >> drivers/event/octeontx2/meson.build | 5 -----
> >> drivers/event/opdl/meson.build | 5 -----
> >> examples/l2fwd-event/meson.build | 5 -----
> >> lib/librte_distributor/meson.build | 5 -----
> >> lib/librte_rcu/meson.build | 5 -----
> >> 7 files changed, 10 insertions(+), 30 deletions(-)
> >>
> >> diff --git a/config/meson.build b/config/meson.build
> >> index abedd76f2..6e5530110 100644
> >> --- a/config/meson.build
> >> +++ b/config/meson.build
> >> @@ -173,6 +173,16 @@ if pcap_dep.found() and
> >cc.has_header('pcap.h', dependencies: pcap_dep)
> >> dpdk_extra_ldflags += '-lpcap'
> >> endif
> >>
> >> +
> >> +# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
> >> +if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
> >> + atomic_dep = cc.find_library('atomic', required: true)
> >> + if atomic_dep.found()
> >> + add_project_link_arguments('-latomic', language: 'c')
> >> + dpdk_extra_ldflags += '-latomic'
> >> + endif
> >> +endif
> >> +
> >
> >Minor nit, you don't need to check for .found(), since the configure will
> >fail if it's not found, since "required" is set to true.
>
> Yup but I felt a bit odd adding the dependency without using .found().
> I will remove the inner if check in the next version.
>
> >
> >For cleanliness, you may also be able to use get_pkgconfig_variable() or
> >get_configtool_variable() to get -latomic, rather than hard-coding it,
> >though in this case I suspect hard-coding is fine.
>
> Looks like get_pkgconfig_variable/get_configtool_variable only work on
> dependency
> object using it on object from find_library() causes meson to error out
> ` Unknown method "get_pkgconfig_variable" in object `
>
Ok, thanks for checking.