summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2016-10-28 09:04:46 +0800
committerKai Kang <kai.kang@windriver.com>2016-11-01 11:28:28 +0800
commitd2329bbbddbfe000ef6d0cdf17975bef6cf96f51 (patch)
tree7fd6ff4da4c4e2c4bfa0d7404cb692dc8e120631
parentc4a0a672c739f3d3a4da497884d3c979a6594ccc (diff)
downloadpoky-contrib-kangkai/python3_and_dbus.tar.gz
poky-contrib-kangkai/python3_and_dbus.tar.bz2
poky-contrib-kangkai/python3_and_dbus.zip
python3: fix library search pathkangkai/python3_and_dbus
When enable multilib, it fails to run 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 0x00007f62ea5b2700 (most recent call first): | Aborted (core dumped) The root cause is the module search path /usr/lib is wrong for x86-64 when multilib is enabled. So replace fixed path string with right macro. Clean up python-3.3-multilib.patch for Modules/getpath.c at same time. Signed-off-by: Kai Kang <kai.kang@windriver.com>
-rw-r--r--meta/recipes-devtools/python/python3/correct-python3-lib-pathes-for-multilib-support.patch49
-rw-r--r--meta/recipes-devtools/python/python3/python-3.3-multilib.patch13
-rw-r--r--meta/recipes-devtools/python/python3_3.5.2.bb1
3 files changed, 55 insertions, 8 deletions
diff --git a/meta/recipes-devtools/python/python3/correct-python3-lib-pathes-for-multilib-support.patch b/meta/recipes-devtools/python/python3/correct-python3-lib-pathes-for-multilib-support.patch
new file mode 100644
index 00000000000..8ca5a6a6f79
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/correct-python3-lib-pathes-for-multilib-support.patch
@@ -0,0 +1,49 @@
+When enable multilib, it fails to run 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 0x00007f62ea5b2700 (most recent call first):
+| Aborted (core dumped)
+
+The root cause is the module search path /usr/lib is wrong for x86-64 when
+multilib is enabled. So replace fixed path string with right macro.
+
+Upstream-Status: Pending
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+diff --git a/Modules/getpath.c b/Modules/getpath.c
+index 18deb60..d22af53 100644
+--- a/Modules/getpath.c
++++ b/Modules/getpath.c
+@@ -494,7 +494,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, NULL);
+
+ if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
+ Py_FatalError(
+@@ -683,7 +683,7 @@ calculate_path(void)
+ }
+ else
+ wcsncpy(zip_path, _prefix, MAXPATHLEN);
+- joinpath(zip_path, L"lib/python00.zip");
++ joinpath(zip_path, LIB L"/python00.zip");
+ bufsz = wcslen(zip_path); /* Replace "00" with version */
+ zip_path[bufsz - 6] = VERSION[0];
+ zip_path[bufsz - 5] = VERSION[2];
+@@ -695,7 +695,7 @@ calculate_path(void)
+ fprintf(stderr,
+ "Could not find platform dependent libraries <exec_prefix>\n");
+ wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
+- joinpath(exec_prefix, L"lib/lib-dynload");
++ joinpath(exec_prefix, LIB L"/lib-dynload");
+ }
+ /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
+
diff --git a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
index 056e8e76311..f7e73eed91e 100644
--- a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
+++ b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
@@ -7,6 +7,11 @@ get the sys.lib from python itself and do not use hardcoded value of 'lib'
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
+Remove the section to add a global var in Modules/getpath.c that the global var
+has been removed from python3 upstream.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
Index: Python-3.5.2/Include/pythonrun.h
===================================================================
--- Python-3.5.2.orig/Include/pythonrun.h
@@ -130,14 +135,6 @@ Index: Python-3.5.2/Modules/getpath.c
#ifndef LANDMARK
#define LANDMARK L"os.py"
#endif
-@@ -113,6 +120,7 @@ static wchar_t prefix[MAXPATHLEN+1];
- static wchar_t exec_prefix[MAXPATHLEN+1];
- static wchar_t progpath[MAXPATHLEN+1];
- static wchar_t *module_search_path = NULL;
-+static wchar_t *lib_python = L"" LIB_PYTHON;
-
- /* Get file status. Encode the path to the locale encoding. */
-
Index: Python-3.5.2/Python/getplatform.c
===================================================================
--- Python-3.5.2.orig/Python/getplatform.c
diff --git a/meta/recipes-devtools/python/python3_3.5.2.bb b/meta/recipes-devtools/python/python3_3.5.2.bb
index e6cbb9c56d6..7e6f0194017 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://setup.py-find-libraries-in-staging-dirs.patch \
file://configure.ac-fix-LIBPL.patch \
file://python3-fix-CVE-2016-1000110.patch \
+ file://correct-python3-lib-pathes-for-multilib-support.patch \
"
SRC_URI[md5sum] = "8906efbacfcdc7c3c9198aeefafd159e"
SRC_URI[sha256sum] = "0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40"