> -----Original Message-----
> From: Jerin Jacob <[email protected]>
> Sent: Monday, October 5, 2020 4:26 PM
> To: Juraj Linkeš <[email protected]>
> Cc: Thomas Monjalon <[email protected]>; David Marchand
> <[email protected]>; Aaron Conole <[email protected]>;
> Michael Santana <[email protected]>; dpdk-dev <[email protected]>
> Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson
> cross-
> compile
>
> On Mon, Oct 5, 2020 at 4:27 PM Juraj Linkeš <[email protected]>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <[email protected]>
> > > Sent: Sunday, October 4, 2020 10:30 AM
> > > To: Juraj Linkeš <[email protected]>
> > > Cc: Thomas Monjalon <[email protected]>; David Marchand
> > > <[email protected]>; Aaron Conole <[email protected]>;
> > > Michael Santana <[email protected]>; dpdk-dev <[email protected]>
> > > Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to
> > > meson cross- compile
> > >
> > > On Thu, Oct 1, 2020 at 4:07 PM Juraj Linkeš
> > > <[email protected]>
> > > wrote:
> > > >
> > > > Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> > > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > > >
> > > > Signed-off-by: Juraj Linkeš <[email protected]>
> > > > ---
> > > > config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20
> > > > +++++++++++++++++++
> > >
> > > IMO, if we are adding a specific OS distribution-specific
> > > configuration then it won't scale.
> > > Why not have just arm64_armv8_linux_clang ?
> >
> > CFLAGS, LDFLAGS, c_args and c_link_args don't work when
> > cross-compiling (at least they didn't work when I tested it) and that
> > means we have to put the paths to stdlib (which llvm/clang doesn't
> > implement) into a cross file
>
> I am using cross-build, following syntax is working CFLAGS='-g -ggdb3' meson
> build
>
> > The arm64_armv8_linux_clang_ubuntu1804 contains paths that work with
> ubuntu clang/gcc packages (and would thus be used in CI). We can't have a
> generic cross file for clang because of this path limitation.
>
> If ubuntu 18.04 needs some fix up like adding the stuff to PATH etc, we could
> do
> a different stage in Travis ci. right?
Sorry for the long delay, I was swamped with other stuff.
What do you mean by "following syntax is working CFLAGS='-g -ggdb3' meson
build" in cross-builds? I tried the same thing with the flags I've put into the
arm64_armv8_linux_clang_ubuntu1804 file and it doesn't work at all for cross
builds - CFLAGS get only used for native compiler and not the cross compiler.
Here's what I mean:
CFLAGS='--sysroot /usr/aarch64-linux-gnu --gcc-toolchain=/usr' meson
clang-build-aarch64 --werror -Dexamples=all --default-library static
--cross-file config/arm/arm64_armv8_linux_clang # the cross file doesn't
contain the paths
Results in meson not being able to properly figure out size of "void *":
-----------------------
Running compile:
Working directory: /tmp/tmpf_n3b9c7
Command line: clang /tmp/tmpf_n3b9c7/testfile.c -pipe -D_FILE_OFFSET_BITS=64
-c -o /tmp/tmpf_n3b9c7/output.obj -target aarch64-linux-gnu -O0
Code:
#include <stdio.h>
int main(int argc, char **argv) {
void * something;
}
Compiler stdout:
Compiler stderr:
In file included from /tmp/tmpf_n3b9c7/testfile.c:1:
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not
found
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Checking for size of "void *": -1
-----------------------
However, when I put the paths into the cross file and run without CFLAGS, it
works fine:
meson clang-build-aarch64 --werror -Dexamples=all --default-library static
--cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804 # the cross file
contains the paths
Results in:
-----------------------
Running compile:
Working directory: /tmp/tmpikoi3353
Command line: clang /tmp/tmpikoi3353/testfile.c -pipe -D_FILE_OFFSET_BITS=64
-c -o /tmp/tmpikoi3353/output.obj -target aarch64-linux-gnu --sysroot
/usr/aarch64-linux-gnu --gcc-toolchain=/usr -O0
Code:
#include <stdio.h>
int main(int argc, char **argv) {
void * something;
}
Compiler stdout:
Compiler stderr:
-----------------------
From what I was able to google, meson devs only want to allow specifying
cross-specific option in cross files and are purposefully ignoring env
variables for cross builds.
What we could do is just modify the cross file in Travis before running the
build. But then we would have a useless clang cross file in the repo since we
have to have the paths in it for clang cross compilition.
I hope I'm wrong, but I don't see a way around this.
What do you think?