DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Karl Bonde Torp <karlowich@gmail.com>
Cc: dev@dpdk.org, Karl Bonde Torp <k.torp@samsung.com>
Subject: Re: [PATCH] build: fix build on FreeBSD with Meson 0.61.1
Date: Tue, 15 Feb 2022 15:31:13 +0000	[thread overview]
Message-ID: <YgvHQYWZsH4SUu8c@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20220214114313.21258-1-k.torp@samsung.com>

On Mon, Feb 14, 2022 at 12:43:13PM +0100, Karl Bonde Torp wrote:
> When building with Meson 0.61.1 on FreeBSD some archives become
> corrupted. This can be avoided by using 'llvm-ar' instead of 'ar'.
> 
> Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>
> ---
>  buildtools/meson.build | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/buildtools/meson.build b/buildtools/meson.build
> index 400b88f251..e1c600e40f 100644
> --- a/buildtools/meson.build
> +++ b/buildtools/meson.build
> @@ -31,6 +31,9 @@ if host_machine.system() == 'windows'
>          pmdinfo += 'llvm-ar'
>      endif
>      pmdinfogen += 'coff'
> +elif host_machine.system() == 'freebsd'
> +    pmdinfo += 'llvm-ar'
> +    pmdinfogen += 'elf'
>  else
>      pmdinfo += 'ar'
>      pmdinfogen += 'elf'
> -- 

Based off the instructions you posted later in the thread, I've reproduced
the issue - and then done a little extra investigation. Here is my
understanding:

* By default on FreeBSD the linking is being done by llvm-ar
* The resulting libraries are being linked as thin archives and "ar" binary
  does not seem to be able to process them.
* When building with CC=gcc on FreeBSD, "ar" is used as a linker, and the
  resulting archives are regular .a files.
* On Linux, whether building with clang or gcc, "ar" seems to be used as
  linker.

The ideal situation here would be if we could use meson to report itself
what the static linker in use is, but unfortunately while we can query the
dynamic linker using "meson.compiler().get_linker_id()", there doesn't seem
to be an equivalent for the static linker. Therefore, the only option seems
to be a fix as here. Only question remains as to whether we want to only
use llvm-ar for clang builds on FreeBSD or use if for all builds on FreeBSD.
I'm not sure it makes much difference either way, but I'd tend towards
limiting the use of llvm-ar to only clang builds.

With or without this suggested change,

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

  parent reply	other threads:[~2022-02-15 15:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 11:43 Karl Bonde Torp
2022-02-14 13:48 ` Bruce Richardson
2022-02-15 11:07   ` Karl Bonde Torp
2022-02-15 11:27     ` Bruce Richardson
2022-02-15 13:50       ` Karl Bonde Torp
2022-02-15 15:34         ` Bruce Richardson
2022-03-07 16:43           ` Thomas Monjalon
2022-03-07 16:52             ` Bruce Richardson
2022-02-15 15:31 ` Bruce Richardson [this message]
2022-03-08 14:39   ` 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=YgvHQYWZsH4SUu8c@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=k.torp@samsung.com \
    --cc=karlowich@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).