[OE-core] [PATCH] python3: fix failure to run python3 in a multilib env or when BASELIB != lib
Jagadeesh Krishnanjanappa
jkrishnanjanappa at mvista.com
Sat Feb 18 04:59:49 UTC 2017
Having hard coded "lib" string in lib_python path, searches for modules
under /usr/lib/python3.x directory. This would result in an error on
multilib environment, where BASELIB is other than lib.
Example: On qemux86-64 with base_libdir and libdir as /lib64 and /usr/lib64
respectively, would result in below error when python3 is executed:
-- snip --
root at qemux86-64:~# python3
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f65dbb53700 (most recent call first):
Aborted
root at qemux86-64:~#
-- snip --
Similar issue observed at:
https://knowledge.windriver.com/en-us/000_Products/000/010/040/040/000_LIN8-4040_%3A_python3_does_not_work_in_a_multilib_environment
Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
---
...remove-hard-coded-lib-string-for-multilib.patch | 37 ++++++++++++++++++++++
meta/recipes-devtools/python/python3_3.5.2.bb | 1 +
2 files changed, 38 insertions(+)
create mode 100644 meta/recipes-devtools/python/python3/python-3.5.2-remove-hard-coded-lib-string-for-multilib.patch
diff --git a/meta/recipes-devtools/python/python3/python-3.5.2-remove-hard-coded-lib-string-for-multilib.patch b/meta/recipes-devtools/python/python3/python-3.5.2-remove-hard-coded-lib-string-for-multilib.patch
new file mode 100644
index 0000000..786f086
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/python-3.5.2-remove-hard-coded-lib-string-for-multilib.patch
@@ -0,0 +1,37 @@
+Having hard coded "lib" string in lib_python path, searches for modules
+under /usr/lib/python3.x directory. This would result in an error on
+multilib environment, where BASELIB is other than lib.
+
+Example: On qemux86-64 with base_libdir and libdir as /lib64 and /usr/lib64
+respectively, would result in below error when python3 is executed:
+-- snip --
+root at qemux86-64:~# python3
+Could not find platform independent libraries <prefix>
+Could not find platform dependent libraries <exec_prefix>
+Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
+Fatal Python error: Py_Initialize: Unable to get the locale encoding
+ImportError: No module named 'encodings'
+
+Current thread 0x00007f65dbb53700 (most recent call first):
+Aborted
+root at qemux86-64:~#
+-- snip --
+
+Note: LIB is defined with actual base_libdir used via -DLIB during
+compilation.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
+diff -Naurp Python-3.5.2_org/Modules/getpath.c Python-3.5.2/Modules/getpath.c
+--- Python-3.5.2_org/Modules/getpath.c 2017-02-17 00:58:28.312583182 +0530
++++ Python-3.5.2/Modules/getpath.c 2017-02-17 01:01:58.984805492 +0530
+@@ -502,7 +502,7 @@ calculate_path(void)
+ _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
+ _prefix = Py_DecodeLocale(PREFIX, NULL);
+ _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
+- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
++ lib_python = Py_DecodeLocale(LIB "/python" VERSION, NULL);
+
+ if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
+ Py_FatalError(
diff --git a/meta/recipes-devtools/python/python3_3.5.2.bb b/meta/recipes-devtools/python/python3_3.5.2.bb
index 2ff7c9e..26f49f6 100644
--- a/meta/recipes-devtools/python/python3_3.5.2.bb
+++ b/meta/recipes-devtools/python/python3_3.5.2.bb
@@ -37,6 +37,7 @@ SRC_URI += "\
file://configure.ac-fix-LIBPL.patch \
file://python3-fix-CVE-2016-1000110.patch \
file://upstream-random-fixes.patch \
+ file://python-3.5.2-remove-hard-coded-lib-string-for-multilib.patch \
"
SRC_URI[md5sum] = "8906efbacfcdc7c3c9198aeefafd159e"
SRC_URI[sha256sum] = "0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40"
--
2.7.4
More information about the Openembedded-core
mailing list