Skip to contentSkip to conversation

python3-m2crypto: avoid host contamination for swig

PATCH New kai 1 participant 1 message Jun 24, 2021

lore
Share & tools
lore

kai

author
#0 lore raw

PATCH 1/1 python3-m2crypto: avoid host contamination for swig

From: Kai Kang <[email protected]>

If the version of libssl-dev is not match the version of libssl on the build machine, it fails to compile SWIG/_m2crypto_wrap.c which is created by swig for python3-m2crypto-native:

| SWIG/_m2crypto_wrap.c:9757:19: error: dereferencing pointer to
incomplete type 'struct stack_st'
| if (arg1) (arg1)->num = arg2;
| ^~

But it works if no libssl-dev installed on the build machine.

Export STAGING_DIR to make existing patch 0001-setup.py-link-in-sysroot-not-in-host-directories.patch work. And filter out '/usr/inlucde' from include pathes of swig.

---
 .../avoid-host-contamination.patch            | 23 +++++++++++++++++++
 .../python/python3-m2crypto_0.37.1.bb         |  3 +++
 2 files changed, 26 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-m2crypto/avoid-host-contamination.patch
meta-python/recipes-devtools/python/python3-m2crypto/avoid-host-contamination.patch new file +23 -0
new file mode 100644
index 000000000..9d9b8449b
@@ -0,0 +1,23 @@
+Filter out '/usr/include' for swig to avoid host contamination issue.
+
+Upstream-Status: Upstream-Status: Inappropriate [cross compile specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+---
+ setup.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 5a12981..389d49f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -153,7 +153,8 @@ class _M2CryptoBuildExt(build_ext.build_ext):
+             self.swig_opts.append('-py3')
+ 
+         # swig seems to need the default header file directories
+-        self.swig_opts.extend(['-I%s' % i for i in _get_additional_includes()])
++        self.swig_opts.extend(['-I%s' % i for i in _get_additional_includes()
++                                            if i != '/usr/include'])
+ 
+         log.debug('self.include_dirs = %s', self.include_dirs)
+         log.debug('self.library_dirs = %s', self.library_dirs)
meta-python/recipes-devtools/python/python3-m2crypto_0.37.1.bb +3 -0
index 2284a43a3..b3da87fb7 100644
@@ -10,6 +10,7 @@ SRC_URI += "file://0001-setup.py-link-in-sysroot-not-in-host-directories.patch \
             file://cross-compile-platform.patch \
             file://0001-Allow-verify_cb_-to-be-called-with-ok-True.patch \
             file://0001-Use-of-RSA_SSLV23_PADDING-has-been-deprecated.patch \
+            file://avoid-host-contamination.patch \
            "
 SRC_URI[sha256sum] = "e4e42f068b78ccbf113e5d0a72ae5f480f6c3ace4940b91e4fff5598cfff6fb3"
 
@@ -42,4 +43,6 @@ SWIG_FEATURES_append_mipsarch = " -D_MIPS_SZPTR=${SITEINFO_BITS}"
 SWIG_FEATURES_append_powerpc64le = " -D__powerpc64__"
 export SWIG_FEATURES
 
+export STAGING_DIR
+
 BBCLASSEXTEND = "native"
Signature · 1 line
2.17.1