aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/correct-python3-lib-pathes-for-multilib-support.patch
blob: 8ca5a6a6f79f792ae28907b56399bd83fb740812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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.) */