[dpdk-dev] [PATCH v14 00/12] Arm build options rework

Bruce Richardson bruce.richardson at intel.com
Fri Jan 29 10:45:41 CET 2021


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.

Example I tested:

<code change added>
+myc = find_program('c')
+message('find_program(\'c\') = ' + myc.full_path())
+

<output when run>
~/dpdk.org/__BUILDS/build-arm64-host-clang$ ninja
[0/1] Regenerating build files.
....
Target machine cpu family: aarch64
Target machine cpu: armv8-a
Program aarch64-linux-gnu-gcc found: YES
WARNING: Project targeting '>= 0.47.1' but tried to use feature introduced in '0.55.0': ExternalProgram.full_path.
Message: find_program('c') = /home/bruce/Downloads/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
...

/Bruce


[1] https://mesonbuild.com/Machine-files.html#binaries 


More information about the dev mailing list