-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET) #68156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Currently there is only one platform directory for all linux architectures, there are two reasons to have a separate directory for each architecture:
This would then remove Lib/plat-linux and introduce some Lib/plat-$(PLATFORM_TRIPLET) directories. |
ping? I would like to get this into 3.5. |
+1 from me. |
+1 from the Python team from Fedora, the patch looks good from downstream standpoint. |
I don't know what problems I might have run into previously, but it's working now and seems fine to me. +1 |
This would likely improve life for folks with cross-compile toolchains. |
attaching an updated patch. besides renaming of the platform directory, the following changes are made:
One outstanding issue probably is the generation of the platform directory in the source tree, not in the build tree (but this is existing behaviour). This should address bpo-12619 (this patch probably needs an update), |
This may be of interest for iOS and Android cross-compilation, so I've added Xavier de Gaye to the nosy list, while Russell Keith-Magee added himself. |
New changeset 78d2cb7f66b6 by doko in branch 'default':
|
now checked in, after 3.6.0a2, to watch behaviour on different platforms. Still needs doc updates. |
New changeset a062c60c9f7d by doko in branch 'default':
|
New changeset e2b09c00ee24 by Ned Deily in branch 'default': |
There is a problem with the current implementation. When running ./configure using compilers other than a current gcc, for example, when using clang or older versions of gcc, the build variable MULTIARCH may not get set because those compilers do not support --print-multiarch: configure.ac:744 But, a bit later in ./configure, PLATFORM_TRIPLET gets set as a result of running conftest.c. The end result is that PLATFORM_TRIPET is non-empty but MULTIARCH is empty. Still later in configure.ac (around 4477: if test x$PLATFORM_TRIPLET = x; then So, the value of LIBPL is extended to include PLATFORM_TRIPLET regardless of whether MULTIARCH has a value. This causes problems at runtime because get_makefile_filename() in Lib/sysconfig.py now uses the value of sys.implemntation's _multiarch attribute (whose value is compiled in sysmodule.c from MULTIARCH) to form the path to the config directory (the equivalent of LIBPL). In these cases, sys.implementation will have no_multiarch attribute so sysconfig looks for the config directory in the pre-3.6 location (e.g. .../lib/python3.6/config-3.6m) even though it was installed in the new location (.../lib/python3.6/config-3.6m-darwin). Fortunately, both test_sysconfig and test_distutils catch this: ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/uxd/lib/python3.6/test/test_sysconfig.py", line 346, in test_srcdir
self.assertTrue(os.path.isdir(srcdir), srcdir)
AssertionError: False is not true : /py/dev/3x/root/uxd/lib/python3.6/config-3.6dm ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/uxd/lib/python3.6/test/test_sysconfig.py", line 414, in test_get_makefile_filename
self.assertTrue(os.path.isfile(makefile), makefile)
AssertionError: False is not true : /py/dev/3x/root/uxd/lib/python3.6/config-3.6dm/Makefile ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/uxd/lib/python3.6/distutils/tests/test_sysconfig.py", line 61, in test_srcdir
self.assertTrue(os.path.isdir(srcdir), srcdir)
AssertionError: False is not true : /py/dev/3x/root/uxd/lib/python3.6/config-3.6dm I'm not sure what the best solution is. |
The same problem occurs when cross-compiling for Android and running test_sysconfig and test_distutils. Some other points:
|
This is misleading. Actually, test_sysconfig and test_distutils do not fail when run from the source tree, but fail on an installed python, whatever the compilation mode: native or cross-compilation. |
Regeneration of the platdir files needs to be aware of the value of sysroot [1]. For example on Android cross-builds, sysroot must be set to the path of the headers and libraries for the targeted Android API level corresponding to a version of the Android libc and a version of Android. So, automatically regenerating those files in this case requires to look into the CC, CFLAGS and CPPFLAGS environment variables for sysroot. OTOH RTLD_* constants are exposed in the posix module (bpo-13226) and the platdir files usefulness is limited now. Cross building from one linux architecture to another is possible with gnu make VPATH support by building outside the source tree. Android is also a linux architecture and building outside the source tree makes sense, not only to work around the problem described in the second item of msg241143, but also to build for different Android API levels and identify the results of those builds. It is not clear that the changes made in this issue fixes correctly bpo-22724, see msg269359. I think the scope of this isssue should be restricted to multiarch build systems, i.e. when gcc has been configured with '--enable-multiarch' [2]. [1] Options for Directory Search: https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html |
To reproduce the problem on any system where Python is built with configure: $ mkdir -p tmp/build tmp/install
$ cd tmp
$ hg clone https://hg.python.org/cpython cpython
$ cd build
$ $(cd ../cpython && pwd)/configure --prefix=$(cd ../install && pwd) && make install
$ ../install/bin/python3 -m test -v test_sysconfig
[snip] ====================================================================== Traceback (most recent call last):
File "/path_to/tmp/install/lib/python3.6/test/test_sysconfig.py", line 346, in test
_srcdir
self.assertTrue(os.path.isdir(srcdir), srcdir)
AssertionError: False is not true : /path_to/tmp/install/lib/python3.6/config-3.6m ====================================================================== Traceback (most recent call last):
File "/path_to/tmp/install/lib/python3.6/test/test_sysconfig.py", line 414, in test
_get_makefile_filename
self.assertTrue(os.path.isfile(makefile), makefile)
AssertionError: False is not true : /path_to/tmp/install/lib/python3.6/config-3.6m/Makefile Ran 21 tests in 0.063s FAILED (failures=2, skipped=2) |
This problem occured for the first time on the "installed Python" buildbot (setup by Zachary) at Those "installed Python" buildbot are very helpful, thanks Zachary. |
The reason I would like this problem fixed is that the test suite is run on an installed Python when cross-compiling, obviously you cannot run the test suite with the cross-compiled Python on the source tree of the build system. |
It's not just broken for cross-compiling. As I noted earlier, it's broken when using other than gcc, such as is the case with current OS X systems. This needs to be fixed before release. |
It is also broken for gcc, see the buildbot 'compile' output. |
New changeset ddc4bdae5e41 by Ned Deily in branch 'default': |
Any update on this issue? test_srcdir() of test_sysconfig still fails on "x86 Gentoo Installed with X 3.x" buildbot. I opened the issue bpo-27798 which was closed a duplicate of this issue. First failure of the buildbot: http://buildbot.python.org/all/builders/x86%20Gentoo%20Installed%20with%20X%203.x/builds/747 This build contains many changes. I don't know which one introduced the issue?
Ned Deily: "This needs to be fixed before release." I agree. I use the release blocker priority as a reminder. Well, if the issue cannot be fixed, I suggest to revert changes related to this issue. "It's not just broken for cross-compiling. As I noted earlier, it's broken when using other than gcc, such as is the case with current OS X systems." test_sysconfig fails on "x86 Gentoo Installed with X 3.x" buildbot which uses GCC. Extract of the configure output: checking for gcc... gcc |
please could somebody test the attached patch (I'm also trying to setup a gentoo env)? The idea is to keep the multiarch and triplet macros in sync. diff -r a7f3678f9509 configure.ac
--- a/configure.ac Sat Aug 20 03:05:13 2016 +0200
+++ b/configure.ac Sat Aug 20 03:54:39 2016 +0200
@@ -882,6 +882,8 @@
if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
fi
+elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
+ MULTIARCH=$PLATFORM_TRIPLET
fi
if test x$PLATFORM_TRIPLET = x; then
PLATDIR=plat-$MACHDEP |
I've just tried doko's patch on Arch Linux. Before this patch there are three test failures in test_distutils and test_sysconfig, just like Gentoo. After the patch, all tests in test_distutils and test_sysconfig pass. On my PC both By the way, could you attach this patch file to roundup, so that others can download it? Reference: Arch Linux's build script of python-hg: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-hg |
New changeset 5c77488830bc by doko in branch 'default':
|
now fixed. |
Changeset 5c77488830bc brings a regression - Android build fails with the following message: export H2PY; H2PY="$PYTHON_FOR_BUILD /home/yen/python3-android/src/cpython/build-target/../Tools/scripts/h2py.py"; \ The previous changeset 1902e1d79e25 builds fine. Prepending From the message seems plat-* directories are re-generated with a different name. Is it expected? |
Oh didn't see the title of this issue. Here's the patch for Android. |
I don't see how the suggested android fix is related, and what it is supposed to fix. It adds the env command before setting the environment variables, which should be a no-op. However I think we should introduce different platform triplets for android. Please follow-up in http://bugs.python.org/issue27917 |
Well changes in this issue are not the root cause of my problem - it just exposes a broken implementation done long time ago. I'll examine more and open a new bug. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: