common/qat: fix build errors with incompatible IPSec lib

Message ID 20231122164651.1320497-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series common/qat: fix build errors with incompatible IPSec lib |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Bruce Richardson Nov. 22, 2023, 4:46 p.m. UTC
  Since "find_library()" is used to find the libipsec_mb library, there is
a chance that an incompatible library will be found e.g. when doing
cross-builds. To fix this, we copy the logic from the crypto/ipsec_mb
driver to actually do a link-check on the library before deciding it can
be used.

Fixes: ca0ba0e48129 ("crypto/qat: default to IPsec MB for computations")
Cc: brian.dooley@intel.com

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/common/qat/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Power, Ciara Nov. 22, 2023, 5 p.m. UTC | #1
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Wednesday, November 22, 2023 4:47 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Dooley, Brian
> <brian.dooley@intel.com>; Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Power, Ciara <ciara.power@intel.com>
> Subject: [PATCH] common/qat: fix build errors with incompatible IPSec lib
> 
> Since "find_library()" is used to find the libipsec_mb library, there is a chance
> that an incompatible library will be found e.g. when doing cross-builds. To fix
> this, we copy the logic from the crypto/ipsec_mb driver to actually do a link-
> check on the library before deciding it can be used.
> 
> Fixes: ca0ba0e48129 ("crypto/qat: default to IPsec MB for computations")
> Cc: brian.dooley@intel.com
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/common/qat/meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/common/qat/meson.build
> b/drivers/common/qat/meson.build index edc793ba95..5c36fbb270 100644
> --- a/drivers/common/qat/meson.build
> +++ b/drivers/common/qat/meson.build
> @@ -43,7 +43,8 @@ else
>      IMB_required_ver = '1.4.0'
>      IMB_header = '#include<intel-ipsec-mb.h>'
>      libipsecmb = cc.find_library('IPSec_MB', required: false)
> -    if libipsecmb.found()
> +    if libipsecmb.found() and meson.version().version_compare('>=0.60') and
> cc.links(
> +            'int main(void) {return 0;}', dependencies: libipsecmb)
>          # version comes with quotes, so we split based on " and take the middle
>          imb_ver = cc.get_define('IMB_VERSION_STR',
>              prefix : IMB_header).split('"')[1]
> --
> 2.40.1

Thanks Bruce,

Acked-by: Ciara Power <ciara.power@intel.com>
  
Thomas Monjalon Nov. 23, 2023, 12:12 a.m. UTC | #2
> > Since "find_library()" is used to find the libipsec_mb library, there is a chance
> > that an incompatible library will be found e.g. when doing cross-builds. To fix
> > this, we copy the logic from the crypto/ipsec_mb driver to actually do a link-
> > check on the library before deciding it can be used.
> > 
> > Fixes: ca0ba0e48129 ("crypto/qat: default to IPsec MB for computations")
> > Cc: brian.dooley@intel.com
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Ciara Power <ciara.power@intel.com>

Applied, thanks.
  

Patch

diff --git a/drivers/common/qat/meson.build b/drivers/common/qat/meson.build
index edc793ba95..5c36fbb270 100644
--- a/drivers/common/qat/meson.build
+++ b/drivers/common/qat/meson.build
@@ -43,7 +43,8 @@  else
     IMB_required_ver = '1.4.0'
     IMB_header = '#include<intel-ipsec-mb.h>'
     libipsecmb = cc.find_library('IPSec_MB', required: false)
-    if libipsecmb.found()
+    if libipsecmb.found() and meson.version().version_compare('>=0.60') and cc.links(
+            'int main(void) {return 0;}', dependencies: libipsecmb)
         # version comes with quotes, so we split based on " and take the middle
         imb_ver = cc.get_define('IMB_VERSION_STR',
             prefix : IMB_header).split('"')[1]