From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5EECA00C5; Tue, 15 Feb 2022 16:31:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D651410F7; Tue, 15 Feb 2022 16:31:26 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 24245410F3 for ; Tue, 15 Feb 2022 16:31:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644939084; x=1676475084; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3ICu+6JwlPYTOyWo8hmS78A9RJmUafBrE3+lmv9D2sU=; b=AhixHAqCeG1UGhIwe8TTKwmWI3fzRKdmrRD3+1CRSd0/kyAfhigmtalp /EaKX0XH9QQvaICDZK4/vKuKYGWZ6GjdIp4GaS1lLXypGinEXrzpFt2F+ FYCYRe+wBs2iyquBFks1TdY9JMbRRSeH2pBPiW0FIIVK7NJrFIegQhSQK d+ICzJTsGM0sblTyO6C5oK2xXcIofnEtMx9Jkjslzl+eLDvMtdlEa8PjT uyaaYuIS4dTP0tmBSppaIOlfNIujzdGYljMm7RAr2N2vx+GnYEeGbdNNd 2TbY9V0YzOIFqpVIZjpv8Pm/5SdzL8jzuXxGoGtT7DmkJ4aCJ20KRucKg w==; X-IronPort-AV: E=McAfee;i="6200,9189,10258"; a="249209405" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="249209405" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 07:31:18 -0800 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="544346201" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.21.146]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 15 Feb 2022 07:31:17 -0800 Date: Tue, 15 Feb 2022 15:31:13 +0000 From: Bruce Richardson To: Karl Bonde Torp Cc: dev@dpdk.org, Karl Bonde Torp Subject: Re: [PATCH] build: fix build on FreeBSD with Meson 0.61.1 Message-ID: References: <20220214114313.21258-1-k.torp@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220214114313.21258-1-k.torp@samsung.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 > --- > 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