DPDK patches and discussions
 help / color / mirror / Atom feed
From: Juraj Linkeš <juraj.linkes@pantheon.tech>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	David Marchand <david.marchand@redhat.com>,
	Aaron Conole <aconole@redhat.com>,
	"Michael Santana" <maicolgabriel@hotmail.com>,
	dpdk-dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
Date: Thu, 22 Oct 2020 13:40:51 +0000
Message-ID: <652a657ad7124a65829fe343e01ea16e@pantheon.tech> (raw)
In-Reply-To: <CALBAE1NkciCWO2HLAy_Vqua82rnRE=3539zFZ7iwPr53gFyNHA@mail.gmail.com>



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, October 5, 2020 4:26 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> 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š <juraj.linkes@pantheon.tech>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Sunday, October 4, 2020 10:30 AM
> > > To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> > > <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> > > Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> > > 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š
> > > <juraj.linkes@pantheon.tech>
> > > 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š <juraj.linkes@pantheon.tech>
> > > > ---
> > > >  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?

  reply	other threads:[~2020-10-22 13:40 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 10:20 [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation Juraj Linkeš
2020-10-01 10:20 ` [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-01 10:20 ` [dpdk-dev] [PATCH 2/2] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2020-10-04  8:29     ` Jerin Jacob
2020-10-05 10:57       ` Juraj Linkeš
2020-10-05 14:26         ` Jerin Jacob
2020-10-22 13:40           ` Juraj Linkeš [this message]
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-01 13:31     ` Aaron Conole
2020-10-01 14:43       ` Juraj Linkeš
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2020-12-22  9:58       ` Ruifeng Wang
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-12-22  7:34       ` Ruifeng Wang
2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2021-01-19 16:08         ` Thomas Monjalon
2021-01-20  8:24           ` Juraj Linkeš
2021-01-20 10:21             ` Thomas Monjalon
2021-01-20 10:30               ` Juraj Linkeš
2021-01-20 10:34                 ` Thomas Monjalon
2021-01-21 15:02                   ` Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2021-01-26 10:24           ` Thomas Monjalon
2021-01-26 11:45         ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=652a657ad7124a65829fe343e01ea16e@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=aconole@redhat.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinjacobk@gmail.com \
    --cc=maicolgabriel@hotmail.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git