allow using standard ar from the build ini files instead of 'ar' string

Message ID bd9dd451-0af2-25af-ade6-bdf687d2de23@bsd.ac (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series allow using standard ar from the build ini files instead of 'ar' string |

Checks

Context Check Description
ci/github-robot: build fail github build: failed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing warning Testing issues
ci/iol-aarch64-compile-testing fail Testing issues
ci/iol-x86_64-unit-testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing warning Testing issues

Commit Message

aisha Feb. 28, 2022, 3:54 p.m. UTC
  Hi,

I've attached a patch, from Gentoo, which uses the *ar* binary passed to 
meson when available, instead of 'ar', which may not be available, for 
instance when cross compiling, or having multiple gcc versions present, 
like in Gentoo.

This should not have any regressions, as when the binary is not 
available it uses the same logic as the original.

Aisha
  

Comments

Stephen Hemminger Feb. 28, 2022, 5:06 p.m. UTC | #1
On Mon, 28 Feb 2022 10:54:28 -0500
aisha <atammy.dpdk@bsd.ac> wrote:

> Hi,
> 
> I've attached a patch, from Gentoo, which uses the *ar* binary passed to 
> meson when available, instead of 'ar', which may not be available, for 
> instance when cross compiling, or having multiple gcc versions present, 
> like in Gentoo.
> 
> This should not have any regressions, as when the binary is not 
> available it uses the same logic as the original.
> 
> Aisha
> 

Please resubmit this patch with proper Signed-off-by.
Without Developer's Certificate of Origin there can be license claims.
  
Bruce Richardson Feb. 28, 2022, 5:33 p.m. UTC | #2
On Mon, Feb 28, 2022 at 10:54:28AM -0500, aisha wrote:
> Hi,
> 
> I've attached a patch, from Gentoo, which uses the *ar* binary passed to
> meson when available, instead of 'ar', which may not be available, for
> instance when cross compiling, or having multiple gcc versions present, like
> in Gentoo.
> 
> This should not have any regressions, as when the binary is not available it
> uses the same logic as the original.
> 
> Aisha
> 

> diff --git a/buildtools/meson.build b/buildtools/meson.build
> index 400b88f251..d886bfb1dc 100644
> --- a/buildtools/meson.build
> +++ b/buildtools/meson.build
> @@ -24,15 +24,20 @@ binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
>  # select library and object file format
>  pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
>  pmdinfogen = py3 + files('pmdinfogen.py')
> +ar = ''
> +if cc.get_id() == 'gcc' or host_machine.system() != 'windows'
> +    ar = 'ar'
> +else
> +    ar = 'llvm-ar'
> +endif
> +ar_bin = find_program('ar', required: false)
> +if ar_bin.found()
> +    ar = ar_bin.full_path()
> +endif
> +pmdinfo += ar
>  if host_machine.system() == 'windows'
> -    if cc.get_id() == 'gcc'
> -        pmdinfo += 'ar'
> -    else
> -        pmdinfo += 'llvm-ar'
> -    endif
>      pmdinfogen += 'coff'
>  else
> -    pmdinfo += 'ar'
>      pmdinfogen += 'elf'
>  endif
>  
> diff --git a/meson.build b/meson.build
> index 937f6110c0..35650ab20d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -12,7 +12,7 @@ project('DPDK', 'C',
>              'default_library=static',
>              'warning_level=2',
>          ],
> -        meson_version: '>= 0.49.2'
> +        meson_version: '>= 0.55.0'
>  )

I don't believe this should be part of this patch, as bumping the minimum
meson version is not something we want to do just now.

/Bruce
  
Bruce Richardson Feb. 28, 2022, 5:54 p.m. UTC | #3
On Mon, Feb 28, 2022 at 10:54:28AM -0500, aisha wrote:
> Hi,
> 
> I've attached a patch, from Gentoo, which uses the *ar* binary passed to
> meson when available, instead of 'ar', which may not be available, for
> instance when cross compiling, or having multiple gcc versions present, like
> in Gentoo.
> 
> This should not have any regressions, as when the binary is not available it
> uses the same logic as the original.
> 
> Aisha
> 

> diff --git a/buildtools/meson.build b/buildtools/meson.build
> index 400b88f251..d886bfb1dc 100644
> --- a/buildtools/meson.build
> +++ b/buildtools/meson.build
> @@ -24,15 +24,20 @@ binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
>  # select library and object file format
>  pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
>  pmdinfogen = py3 + files('pmdinfogen.py')
> +ar = ''
> +if cc.get_id() == 'gcc' or host_machine.system() != 'windows'

This doesn't work correctly for FreeBSD, as we want to use llvm-ar by
default there for clang builds. It should probably check explicitly for
linux instead.

> +    ar = 'ar'
> +else
> +    ar = 'llvm-ar'
> +endif
> +ar_bin = find_program('ar', required: false)
> +if ar_bin.found()
> +    ar = ar_bin.full_path()
> +endif

This here looks wrong too. Even if clang is being used as a compiler and
llvm-ar as a linker, this will still find the "ar" binary if present.

> +pmdinfo += ar
>  if host_machine.system() == 'windows'
> -    if cc.get_id() == 'gcc'
> -        pmdinfo += 'ar'
> -    else
> -        pmdinfo += 'llvm-ar'
> -    endif
>      pmdinfogen += 'coff'
>  else
> -    pmdinfo += 'ar'
>      pmdinfogen += 'elf'
>  endif
>  
> diff --git a/meson.build b/meson.build
> index 937f6110c0..35650ab20d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -12,7 +12,7 @@ project('DPDK', 'C',
>              'default_library=static',
>              'warning_level=2',
>          ],
> -        meson_version: '>= 0.49.2'
> +        meson_version: '>= 0.55.0'
>  )
>  
>  # check for developer mode
  

Patch

diff --git a/buildtools/meson.build b/buildtools/meson.build
index 400b88f251..d886bfb1dc 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -24,15 +24,20 @@  binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
 # select library and object file format
 pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
 pmdinfogen = py3 + files('pmdinfogen.py')
+ar = ''
+if cc.get_id() == 'gcc' or host_machine.system() != 'windows'
+    ar = 'ar'
+else
+    ar = 'llvm-ar'
+endif
+ar_bin = find_program('ar', required: false)
+if ar_bin.found()
+    ar = ar_bin.full_path()
+endif
+pmdinfo += ar
 if host_machine.system() == 'windows'
-    if cc.get_id() == 'gcc'
-        pmdinfo += 'ar'
-    else
-        pmdinfo += 'llvm-ar'
-    endif
     pmdinfogen += 'coff'
 else
-    pmdinfo += 'ar'
     pmdinfogen += 'elf'
 endif
 
diff --git a/meson.build b/meson.build
index 937f6110c0..35650ab20d 100644
--- a/meson.build
+++ b/meson.build
@@ -12,7 +12,7 @@  project('DPDK', 'C',
             'default_library=static',
             'warning_level=2',
         ],
-        meson_version: '>= 0.49.2'
+        meson_version: '>= 0.55.0'
 )
 
 # check for developer mode