This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Compilation of python (modules) for foreign target platform problem.
Type: compile error Stage: resolved
Components: Cross-Build Versions: Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Alex.Willmer, complement, doko, iritkatriel
Priority: normal Keywords: patch

Created on 2016-05-24 05:14 by complement, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
0001-Compilation-modules-for-foreign-target-platform.patch complement, 2016-05-25 04:08 [PATCH 1/2] Compilation modules for foreign target platform
0002-Compilation-ssl-module-for-foreign-target-platform.patch complement, 2016-05-25 04:09 [PATCH 2/2] Compilation ssl module for foreign target platform
0001-Compilation-modules-for-foreign-target-platform.patch complement, 2016-05-25 04:12 [PATCH 1/2] Compilation modules for foreign target platform
0002-Compilation-ssl-module-for-foreign-target-platform.patch complement, 2016-05-25 04:13 [PATCH 2/2] Compilation ssl module for foreign target platform
Messages (10)
msg266225 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-05-24 05:14
Compilation of python for foreign target platform problem.

Host arch is x86_64, target arch is arm (arm32).

Configuration is (target arch part):

        (cd build-python && \
        DESTDIR=${SYSROOT} \
        PKG_CONFIG=true \
        LIBFFI_INCLUDEDIR= \
        PATH=${CURDIR}/host-python-home/bin:$$PATH \
        PYTHONHOME=${CURDIR}/host-python-home/lib \
        PYTHONPATH=${CURDIR}/host-python-home/lib/python3.5 \
        ../cpython/configure \
          --host=${TARGET_CROSS} \
          --build=${BUILD_M_ARCH}-unknown-linux-gnu \
          --prefix=/usr \
          --sysconfdir=/etc \
          --localstatedir=/var \
          --enable-shared \
          --disable-ipv6 \
          --with-system-ffi \
          --with-system-expat \
          --without-ensurepip \
          --cache-file=config.cache\
        )
        sed -e 's/#define HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1/#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE/' -i build-python/pyconfig.h
        sed -e '/^PGEN=/ s|=.*$$|=\t\t${CURDIR}/build-python-native/Parser/pgen|' -e '/^LDFLAGS=/ s|=.*$$|=\t\t-L.|' -e '/^\$$(PGEN):/,+1d' -e '/^LIBFFI_INCLUDEDIR=/ s|=.*$$|=|' -i build-python/Makefile

Problem: option -I/usr/include passed to compiler during modules compilation. This lead to fails, due to target platform is different from host.

Suggested patch resolve the issue for me.

BTW, pass -I/usr/include is useless even for native builds.
msg266298 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-05-25 04:08
for 3.5 branch
msg266299 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-05-25 04:09
for 3.5 branch
msg266300 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-05-25 04:12
for 2.7 branch
msg266301 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-05-25 04:13
for 2.7 branch
msg267345 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-06-04 23:28
The 0002-* patches look fine, however the 0001-* patches are wrong if you are in a Multi-Arch environment, where you can find valid headers in /usr/include.  From my point of view, the set of include and header directories should be directly initialized from the compiler defaults, and not hard coded.
msg267520 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-06-06 07:32
Matthias,

This question is really for you:

fc1903166 (doko                    2012-09-21 13:52:29 +0200  422)         if multiarch_path_component != '':
fc1903166 (doko                    2012-09-21 13:52:29 +0200  423)             add_dir_to_list(self.compiler.library_dirs,
fc1903166 (doko                    2012-09-21 13:52:29 +0200  424)                             '/usr/lib/' + multiarch_path_component)
fc1903166 (doko                    2012-09-21 13:52:29 +0200  425)             add_dir_to_list(self.compiler.include_dirs,
fc1903166 (doko                    2012-09-21 13:52:29 +0200  426)                             '/usr/include/' + multiarch_path_component)
fc1903166 (doko                    2012-09-21 13:52:29 +0200  427)             return
msg267533 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-06-06 14:55
sorry, I don't understand your last comment.
msg267538 - (view) Author: Petr Ovtchenkov (complement) Date: 2016-06-06 16:09
This mean that code for search in /usr/include/... in multiarch environment was added by you in commit fc1903166 2012-09-21 13:52:29 +0200, so in my suggestion I just don't change behaviour of you code.

As for my opinion, any additions of -I/usr/include/... are wrong: compiler either see it without such -I... or shouldn't see it at all (as for cross), or require hint from builder (something like CURSES_CFLAGS=-I/home/bluser/new_curses/include).
msg412092 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-29 18:37
2.7 and 3.5 are no longer maintained. Please create a new issue if you are still having this problem with a current version (>= 3.9).
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71288
2022-01-29 18:37:52iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg412092

resolution: out of date
stage: resolved
2016-06-06 16:09:37complementsetmessages: + msg267538
2016-06-06 14:55:56dokosetmessages: + msg267533
2016-06-06 07:32:30complementsetmessages: + msg267520
2016-06-04 23:28:23dokosetmessages: + msg267345
2016-05-28 15:31:22ned.deilysetnosy: + doko
2016-05-25 04:13:33complementsetfiles: + 0002-Compilation-ssl-module-for-foreign-target-platform.patch

messages: + msg266301
2016-05-25 04:12:48complementsetfiles: + 0001-Compilation-modules-for-foreign-target-platform.patch

messages: + msg266300
versions: + Python 2.7
2016-05-25 04:09:12complementsetfiles: + 0002-Compilation-ssl-module-for-foreign-target-platform.patch

messages: + msg266299
2016-05-25 04:08:04complementsetfiles: + 0001-Compilation-modules-for-foreign-target-platform.patch

messages: + msg266298
2016-05-25 04:05:55complementsetfiles: - cpython.patch
2016-05-24 05:14:47complementcreate