[dpdk-dev,v2] crypto/openssl: add openssl path for cross compile

Message ID 20170829070205.11497-1-akhil.goyal@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Akhil Goyal Aug. 29, 2017, 7:02 a.m. UTC
  OPENSSL_PATH should be defined in case openssl
driver is cross compiled

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
changes in v2:
made changes to support shared build also.

 doc/guides/cryptodevs/openssl.rst | 4 ++++
 drivers/crypto/openssl/Makefile   | 3 ++-
 mk/rte.app.mk                     | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

De Lara Guarch, Pablo Sept. 5, 2017, 8:22 a.m. UTC | #1
Hi Akhil,

> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> Sent: Tuesday, August 29, 2017 8:02 AM
> To: dev@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: hemant.agrawal@nxp.com; Doherty, Declan
> <declan.doherty@intel.com>; Akhil Goyal <akhil.goyal@nxp.com>
> Subject: [PATCH v2] crypto/openssl: add openssl path for cross compile
> 
> OPENSSL_PATH should be defined in case openssl driver is cross compiled
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---

...

> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -151,7 +151,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)
> += -lrte_pmd_aesni_mb
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -
> L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -
> lrte_pmd_aesni_gcm
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -
> L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -lrte_pmd_openssl -
> lcrypto
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -
> L${OPENSSL_PATH}/lib -lrte_pmd_openssl -lcrypto

I am getting the following messages when compiling:

/usr/bin/ld: skipping incompatible /lib/libcrypto.so when searching for -lcrypto
/usr/bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /lib/libm.so when searching for -lm

Since, OPENSSL_PATH is not defined in my system, it is trying to link against libraries in /lib/.
I suggest adding a condition to add the openssl directory only if OPENSSL_PATH is defined:

+ifeq ($(OPENSSL_PATH),)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -lrte_pmd_openssl -lcrypto
+else
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -L${OPENSSL_PATH}/lib -lrte_pmd_openssl -lcrypto
+endif

Would this work for you?

Thanks,
Pablo
  
Akhil Goyal Sept. 5, 2017, 8:37 a.m. UTC | #2
Hi Pablo,
On 9/5/2017 1:52 PM, De Lara Guarch, Pablo wrote:
> Hi Akhil,
> 
>> -----Original Message-----
>> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
>> Sent: Tuesday, August 29, 2017 8:02 AM
>> To: dev@dpdk.org; De Lara Guarch, Pablo
>> <pablo.de.lara.guarch@intel.com>
>> Cc: hemant.agrawal@nxp.com; Doherty, Declan
>> <declan.doherty@intel.com>; Akhil Goyal <akhil.goyal@nxp.com>
>> Subject: [PATCH v2] crypto/openssl: add openssl path for cross compile
>>
>> OPENSSL_PATH should be defined in case openssl driver is cross compiled
>>
>> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
>> ---
> 
> ...
> 
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -151,7 +151,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)
>> += -lrte_pmd_aesni_mb
>>   _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -
>> L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
>>   _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -
>> lrte_pmd_aesni_gcm
>>   _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -
>> L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -lrte_pmd_openssl -
>> lcrypto
>> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -
>> L${OPENSSL_PATH}/lib -lrte_pmd_openssl -lcrypto
> 
> I am getting the following messages when compiling:
> 
> /usr/bin/ld: skipping incompatible /lib/libcrypto.so when searching for -lcrypto
> /usr/bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
> /usr/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> 
> Since, OPENSSL_PATH is not defined in my system, it is trying to link against libraries in /lib/.
> I suggest adding a condition to add the openssl directory only if OPENSSL_PATH is defined:
> 
> +ifeq ($(OPENSSL_PATH),)
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -lrte_pmd_openssl -lcrypto
> +else
>   _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -L${OPENSSL_PATH}/lib -lrte_pmd_openssl -lcrypto
> +endif
> 
> Would this work for you?
> 
Thanks for the suggestion.
yes this would be fine. I will update the patch accordingly.

-Akhil
  

Patch

diff --git a/doc/guides/cryptodevs/openssl.rst b/doc/guides/cryptodevs/openssl.rst
index f18a456..08cc9ba 100644
--- a/doc/guides/cryptodevs/openssl.rst
+++ b/doc/guides/cryptodevs/openssl.rst
@@ -88,6 +88,10 @@  sudo apt-get install libc6-dev-i386 (for i686-native-linuxapp-gcc target)
 This code was also verified on Fedora 24.
 This code was NOT yet verified on FreeBSD.
 
+In case openssl is cross compiled, openssl can be installed separately
+and path for openssl install directory can be given as
+export OPENSSL_PATH=<openssl install dir>
+
 Initialization
 --------------
 
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index e5fdfb5..2781a76 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -35,6 +35,7 @@  LIB = librte_pmd_openssl.a
 
 # build flags
 CFLAGS += -O3
+CFLAGS += -I${OPENSSL_PATH}/include/
 CFLAGS += $(WERROR_FLAGS)
 
 # library version
@@ -44,7 +45,7 @@  LIBABIVER := 1
 EXPORT_MAP := rte_pmd_openssl_version.map
 
 # external library dependencies
-LDLIBS += -lcrypto
+LDLIBS += -L${OPENSSL_PATH}/lib/ -lcrypto
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index c25fdd9..ed38f3b 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -151,7 +151,7 @@  _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -lrte_pmd_aesni_mb
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -lrte_pmd_aesni_gcm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -lrte_pmd_openssl -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL)     += -L${OPENSSL_PATH}/lib -lrte_pmd_openssl -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)         += -lrte_pmd_qat -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g