Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 880059 - dev-lang/python fails to cross compile to armv7 with: ../Python-3.10.8/Include/pyport.h:746:2: error: #error "LONG_BIT definition appears wrong for platform
Summary: dev-lang/python fails to cross compile to armv7 with: ../Python-3.10.8/Includ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-06 14:34 UTC by tt_1
Modified: 2022-12-06 22:26 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
compressed build log from armv7-cross (python-3.10.8.log.gz,7.36 KB, application/gzip)
2022-11-06 14:34 UTC, tt_1
Details
output from emerge --info (armv7) (emerge-info,5.38 KB, text/plain)
2022-11-06 14:35 UTC, tt_1
Details
compressed build log from armv7-cross (build.log.gz,7.33 KB, application/gzip)
2022-11-07 08:38 UTC, tt_1
Details
config.log from cross compile attempt (config.log.gz,40.92 KB, application/gzip)
2022-11-07 08:39 UTC, tt_1
Details
output from emerge --info (amd64 host) (emerge-info,8.22 KB, text/plain)
2022-11-12 06:42 UTC, tt_1
Details
compressed build log with gcc-11.3.0 (build.log.gz,7.38 KB, application/gzip)
2022-11-12 14:22 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2022-11-06 14:34:45 UTC
Created attachment 828095 [details]
compressed build log from armv7-cross

from the build log: 

x86_64-pc-linux-gnu-gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG  -O2 -march=znver1 -pipe   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I/var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include/internal -IObjects -IInclude -IPython -I. -I/var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include   -I/usr/armv7a-unknown-linux-gnueabihf/usr/include/ncursesw -fPIC -DPy_BUILD_CORE -o Objects/bytes_methods.o /var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Objects/bytes_methods.c
In file included from /var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include/Python.h:50,
                 from /var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Parser/string_parser.c:3:
/var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include/pyport.h:746:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  746 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~
In file included from /var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include/Python.h:50,
                 from /var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Parser/peg_api.c:1:
/var/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/Include/pyport.h:746:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  746 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."


I don't know what happens here, but emerge -pv dev-lang/python tells me that =dev-lang/python-3.10.6_p2 compiled fine: 


emerge-armv7a-unknown-linux-gnueabihf -pv dev-lang/python

[ebuild     U  ] dev-lang/python-3.10.8_p2:3.10::gentoo [3.10.6_p2:3.10::gentoo] to /usr/armv7a-unknown-linux-gnueabihf/ USE="ensurepip gdbm ncurses readline sqlite ssl xml -bluetooth -build -examples -hardened -libedit -lto -pgo -test -tk -verify-sig" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB


Ideas, suggestions?
Comment 1 tt_1 2022-11-06 14:35:31 UTC
Created attachment 828097 [details]
output from emerge --info (armv7)
Comment 2 tt_1 2022-11-06 14:58:35 UTC
working for 3.10 branch are:

dev-lang/python-3.10.6_p2
dev-lang/python-3.10.6_p3
dev-lang/python-3.10.6_p4
dev-lang/python-3.10.7

dev-lang/python-3.10.7 with this commit breaks it: https://github.com/gentoo/gentoo/commit/29d2314810bd8e1de73df5c3ebe30c826281c253
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 18:58:00 UTC
I bet this is because I tested with sparc64 and not sparc (bitness).
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 07:47:44 UTC
*** Bug 880137 has been marked as a duplicate of this bug. ***
Comment 5 Larry the Git Cow gentoo-dev 2022-11-07 08:03:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5cb1ccc95873d55f9f643b043f3f7493fd31eee

commit e5cb1ccc95873d55f9f643b043f3f7493fd31eee
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-11-07 07:57:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-11-07 07:57:49 +0000

    dev-lang/python: append ncurses include path after CBUILD Python is built
    
    We don't want to contaminate the mini CBUILD Python cross build
    with paths in SYSROOT.
    
    Bug: https://bugs.gentoo.org/880059
    Bug: https://bugs.gentoo.org/880137
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/python/python-3.10.8_p2.ebuild        | 10 +++++-----
 dev-lang/python/python-3.11.0_p1.ebuild        | 10 +++++-----
 dev-lang/python/python-3.12.0_alpha1_p1.ebuild | 10 +++++-----
 dev-lang/python/python-3.8.15_p2.ebuild        | 10 +++++-----
 dev-lang/python/python-3.9.15_p2.ebuild        | 10 +++++-----
 5 files changed, 25 insertions(+), 25 deletions(-)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 08:04:49 UTC
I don't think the ncurses bit is sufficient, just a start. Can you share the config.logs?
Comment 7 tt_1 2022-11-07 08:38:30 UTC
Created attachment 828221 [details]
compressed build log from armv7-cross

new build log with ncurses change
Comment 8 tt_1 2022-11-07 08:39:24 UTC
Created attachment 828223 [details]
config.log from cross compile attempt

this is the only config.log I was able to find inside of work, it does x86_64 things only I'm afraid
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-12 05:13:03 UTC
Would you mind giving me some crossdev commands from scratch to get to this?

I've tried and I really can't reproduce it yet even with the same tuple :(
Comment 10 tt_1 2022-11-12 06:42:50 UTC
Created attachment 831685 [details]
output from emerge --info (amd64 host)

The host is amd64 on a multilib profile, maybe that contributes?
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-12 07:10:38 UTC
(In reply to tt_1 from comment #10)
> Created attachment 831685 [details]
> output from emerge --info (amd64 host)
> 
> The host is amd64 on a multilib profile, maybe that contributes?

Mine is too. :(

Can you try give some instructions from scratch?
Comment 12 tt_1 2022-11-12 14:20:02 UTC
its nothing special really: 

crossdev -S armv7a-unknown-linux-gnueabihf --libc 2.35-r11

when done, adjust make.profile symlinks to use profiles/default/arm/17.0/armv7a/ 

edit make.conf, adjust ACCEPT_KEYWORDS to arm only, dropping ~arm

edit make.conf, add -su to global flags, and -rsync-verify ( the latter is too much hassle for no benefit, but you won't get there anyway ) 

add =sys-libs/glibc-2.35-r11 ~arm to package.accept_keywords of /usr/armv7a-unknown-linux-gnueabihf

and finally populate your userland with: emerge-armv7a-unknown-linux-gnueabihf -auvND world - the process will stop with dev-lang/python and the error above.
Comment 13 tt_1 2022-11-12 14:22:19 UTC
Created attachment 831947 [details]
compressed build log with gcc-11.3.0

initial bug was with gcc-10.4.0 toolchain, I recompiled it with more recent gcc, but same result
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-13 22:17:01 UTC
Thanks, reproduced. At first, I thought it was out-of-source build being a bit broken, but it happens when I copy S too.
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-06 17:29:04 UTC
We suspect https://archives.gentoo.org/gentoo-dev/message/aebd8c41144bcb933a2d91fd15f0598d will fix this.
Comment 16 tt_1 2022-12-06 18:33:54 UTC
(In reply to Sam James from comment #15)
> We suspect
> https://archives.gentoo.org/gentoo-dev/message/
> aebd8c41144bcb933a2d91fd15f0598d will fix this.

this looks good to me in terms of compiling, it works now on armv7a
Comment 17 James Le Cuirot gentoo-dev 2022-12-06 22:26:42 UTC
I've merged the fix.