On Fri, Jan 29, 2021 at 10:07:30AM +0000, Juraj Linkeš wrote:
> 
> 
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richard...@intel.com>
> > Sent: Friday, January 29, 2021 10:46 AM
> > To: Juraj Linkeš <juraj.lin...@pantheon.tech>
> > Cc: Andrew Boyer <abo...@pensando.io>; Honnappa Nagarahalli
> > <honnappa.nagaraha...@arm.com>; tho...@monjalon.net; Ruifeng Wang
> > <ruifeng.w...@arm.com>; Phil Yang <phil.y...@arm.com>;
> > vcchu...@amazon.com; Dharmik Thakkar <dharmik.thak...@arm.com>;
> > jerinjac...@gmail.com; hemant.agra...@nxp.com; Ajit Khaparde
> > (ajit.khapa...@broadcom.com) <ajit.khapa...@broadcom.com>;
> > ferruh.yi...@intel.com; dev@dpdk.org; nd <n...@arm.com>
> > Subject: Re: [dpdk-dev] [PATCH v14 00/12] Arm build options rework
> > 
> > On Fri, Jan 29, 2021 at 08:41:45AM +0000, Juraj Linkeš wrote:
> > > > > 3) We need to build kni against the aarch64 kernel headers, but it
> > > > > fails. It appears that kernel/linux/kni/meson.build doesn’t pass
> > > > > any cross-compile flags in the make command it creates. The diff
> > > > > below shows how I hardcoded it to get it to work for now. Thoughts
> > > > > on how to do this right? meson has the path (in $PATH) and the
> > > > > binary prefixs (in ‘[binaries]’ in the cross file). It must know
> > > > > the arch, too.
> > > > >
> > > > > --- a/kernel/linux/kni/meson.build +++
> > > > > b/kernel/linux/kni/meson.build @@ -14,6 +14,8 @@
> > > > > custom_target('rte_kni', input: kni_sources,
> > > > > output: 'rte_kni.ko', command: ['make', '-j4', '-C', kernel_dir +
> > > > > '/build', + +
> > > > > 'CROSS_COMPILE=/tool/toolchain/aarch64-1.1/bin/aarch64-linux-
> > > > > gnu-',
> > > > > +               'ARCH=aarch64', 'M=' + meson.current_build_dir(),
> > > > > 'src=' + meson.current_source_dir(), 'MODULE_CFLAGS=-include ' +
> > > > > meson.source_root() + '/config/rte_config.h' +
> > > > >
> > > >
> > > > Yes, Meson should know these. I'll submit this separately (in a new
> > > > series), as this series is getting pretty big and this fix is
> > > > actually unrelated.
> > > >
> > >
> > > I tried to figure out how to implement this and I've ran into a brick
> > > wall - there's no way to figure out the full name of the cross-compiler.
> > > I found only one way to get the cross compiler:
> > > meson.get_compiler('c',
> > > native:false).get_id()
> > >
> > > But that only retuns 'gcc', not the full binary name (c =
> > > 'aarch64-linux-gnu-gcc' in cross file).
> > >
> > > Bruce, any ideas on how to get the full name? If I understand the
> > > sources right, we aren't able to access arbitrary object attributes,
> > > just those, which are specifically exposed.
> > >
> > > Maybe we could do a workaround? Either if cross compiling and the
> > > compiler is gcc, use the 'aarch64-linux-gnu-' prefix or just put the
> > > prefix into the cross file as an additional property?
> > >
> > According to the cross-file/native-file documentation[1], the files in the 
> > binaries
> > section can be queried using the "find_program()" call. That then returns an
> > external program object rather than a compiler one, so the full path can be 
> > got.
> > Unfortunately, find_program('c') doesn't seem to work for the non-cross-
> > compiled case, so it will need to be conditional on cross-compilation.
> > 
> 
> Thanks, this is great, I'll use this.
> We don't need it for native builds. But it's strange that it doesn't work for 
> those - the docs say it does.
> 
If probably works if a native-file rather than a cross-file is passed.
Without a native file, meson is probably looking for a program called "c"
on the OS, rather than recognising that it's the C compiler being looked
for.

/Bruce

Reply via email to