1From d2a2d0f82a37d0bf21123671774b0b03ffa976cf Mon Sep 17 00:00:00 2001 2From: Yi Zhao <yi.zhao@windriver.com> 3Date: Wed, 24 Nov 2021 13:33:35 +0800 4Subject: [PATCH] Fix pyext_PATTERN for cross compilation 5 6The pyext_PATTERN will add native arch as suffix when cross compiling. 7For example, on qemuarm64, it is expanded to: 8pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' 9which will result in the incorrect library name. 10 11root@qemuarm64:~# find /usr/lib -name \*cpython\* 12/usr/lib/pkgconfig/samba-policy.cpython-310-x86_64-linux-gnu.pc 13/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so 14/usr/lib/samba/libsamba-python.cpython-310-x86-64-linux-gnu-samba4.so 15/usr/lib/samba/libsamba-net.cpython-310-x86-64-linux-gnu-samba4.so 16/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0 17/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0.0.1 18/usr/lib/python3.10/site-packages/samba/dsdb_dns.cpython-310-x86_64-linux-gnu.so 19/usr/lib/python3.10/site-packages/samba/dsdb.cpython-310-x86_64-linux-gnu.so 20/usr/lib/python3.10/site-packages/samba/xattr_tdb.cpython-310-x86_64-linux-gnu.so 21/usr/lib/python3.10/site-packages/samba/_ldb.cpython-310-x86_64-linux-gnu.so 22/usr/lib/python3.10/site-packages/samba/gensec.cpython-310-x86_64-linux-gnu.so 23[snip] 24 25Set pyext_PATTERN to '%s.so' to remove the suffix. 26After the patch: 27root@qemuarm64:~# find /usr/lib/ 28/usr/lib/pkgconfig/samba-policy.pc 29/usr/lib/libsamba-policy.so 30/usr/lib/samba/libsamba-python-samba4.so 31/usr/lib/samba/libsamba-net-samba4.so 32/usr/lib/libsamba-policy.so.0 33/usr/lib/libsamba-policy.so.0.0.1 34/usr/lib/python3.10/site-packages/samba/dsdb_dns.so 35/usr/lib/python3.10/site-packages/samba/dsdb.so 36/usr/lib/python3.10/site-packages/samba/xattr_tdb.so 37/usr/lib/python3.10/site-packages/samba/_ldb.so 38/usr/lib/python3.10/site-packages/samba/gensec.so 39[snip] 40 41Upstream-Status: Inappropriate [embedded specific] 42 43Signed-off-by: Yi Zhao <yi.zhao@windriver.com> 44--- 45 third_party/waf/waflib/Tools/python.py | 2 +- 46 1 file changed, 1 insertion(+), 1 deletion(-) 47 48diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py 49index b2dd1a9..2bd3545 100644 50--- a/third_party/waf/waflib/Tools/python.py 51+++ b/third_party/waf/waflib/Tools/python.py 52@@ -339,7 +339,7 @@ def check_python_headers(conf, features='pyembed pyext'): 53 x = 'MACOSX_DEPLOYMENT_TARGET' 54 if dct[x]: 55 env[x] = conf.environ[x] = str(dct[x]) 56- env.pyext_PATTERN = '%s' + (dct['EXT_SUFFIX'] or dct['SO']) # SO is deprecated in 3.5 and removed in 3.11 57+ env.pyext_PATTERN = '%s.so' 58 59 60 # Try to get pythonX.Y-config 61-- 622.25.1 63 64