New submission from Andreas K. Hüttel :
Hi. I have been trying to install Python on a (well prototype of a) risc-v
multilib Gentoo system, where the system library directory is /usr/lib64/lp64d
(!).
See as reference for the directories
https://www.sifive.com/blog/all-aboard-part-5-risc-v-multilib
Python as is builds and installs fine but the results are pretty much
unuseable. Symptoms are "/usr/lib64/lib64/lp64d/python3.6/site-packages"
directory name and distutils installs unable to find Python.h (it is correctly
installed in /usr/include/..., but distutils passes /usr/lib64/include as
include path).
I've tracked this down to bad values in sys.base_prefix and sys.exec_prefix:
>>> sys.base_prefix
'/usr/lib/python-exec/python3.6/../../../lib64'
Even if I set PYTHONHOME=/usr , I get '/usr/lib64'
The fix, specific for this directory layout, is to have one more directory
component stripped in Modules/getpath.c , see patch below.
With this I have been able to install Python with a normal-looking directory
layout, and distutils things install fine.
Posting this here so it gets your attention, and hoping that you're better in
coming up with a general solution than I am... probably the number of
components stripped should depend on the number of slashes in the library path,
e.g., "lib" versus "lib64/lp64d"
diff -ruN Python-3.6.8.orig/Modules/getpath.c Python-3.6.8/Modules/getpath.c
--- Python-3.6.8.orig/Modules/getpath.c 2018-12-23 22:37:14.0 +0100
+++ Python-3.6.8/Modules/getpath.c 2019-04-21 01:05:35.127440301 +0200
@@ -796,6 +796,7 @@
if (pfound > 0) {
reduce(prefix);
reduce(prefix);
+reduce(prefix);
/* The prefix is the root directory, but reduce() chopped
* off the "/". */
if (!prefix[0])
@@ -808,6 +809,7 @@
reduce(exec_prefix);
reduce(exec_prefix);
reduce(exec_prefix);
+reduce(exec_prefix);
if (!exec_prefix[0])
wcscpy(exec_prefix, separator);
}
Thanks.
------
components: Build
messages: 340667
nosy: Andreas K. Hüttel
priority: normal
severity: normal
status: open
title: building for riscv multilib (patch attached)
type: enhancement
versions: Python 3.8
___
Python tracker
<https://bugs.python.org/issue36699>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com