-
Notifications
You must be signed in to change notification settings - Fork 102
System image compilation and --compiled-modules=no is broken in Python >= 3.9 #459
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hmm... It does seem that Python < 3.9 and >= 3.9 are different. In Python 3.8, Python 3.8.12 (default, Oct 24 2021, 03:28:30)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> proc = ctypes.CDLL(None)
>>> proc.main
<_FuncPtr object at 0x7fd729264700>
>>> proc._start
<_FuncPtr object at 0x7fd729264880>
>>> proc.Py_Main
<_FuncPtr object at 0x7fd729264940> However, it is missing in Python 3.9:
and in Python 3.10 Python 3.10.0 (default, Oct 24 2021, 00:31:24) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> proc = ctypes.CDLL(None)
>>> proc.main
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/arakaki/.pyenv/versions/3.10.0/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "/home/arakaki/.pyenv/versions/3.10.0/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /home/arakaki/.pyenv/versions/3.10.0/bin/python3.10: undefined symbol: main
>>> proc._start
<_FuncPtr object at 0x7fe19e328940>
>>> proc.Py_Main
<_FuncPtr object at 0x7fe19e328a00> Python 3.10 installed via |
$ objdump -dC ~/.pyenv/versions/3.9.7/bin/python3.9 | grep -e '<main>' -e '<_start>' -A10
0000000000000720 <main>:
720: e9 db ff ff ff jmpq 700 <Py_BytesMain@plt>
725: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
72c: 00 00 00
72f: 90 nop
0000000000000730 <_start>:
730: 31 ed xor %ebp,%ebp
732: 49 89 d1 mov %rdx,%r9
735: 5e pop %rsi
736: 48 89 e2 mov %rsp,%rdx
739: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
73d: 50 push %rax
73e: 54 push %rsp
73f: 4c 8d 05 6a 01 00 00 lea 0x16a(%rip),%r8 # 8b0 <__libc_csu_fini>
746: 48 8d 0d f3 00 00 00 lea 0xf3(%rip),%rcx # 840 <__libc_csu_init>
74d: 48 8d 3d cc ff ff ff lea -0x34(%rip),%rdi # 720 <main>
754: ff 15 86 08 20 00 callq *0x200886(%rip) # 200fe0 <__libc_start_main@GLIBC_2.2.5>
75a: f4 hlt
75b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
In Python >= 3.9,
Julia(compiled_modules=False)
fails withWith
Julia(debug=True, compiled_modules=False)
, it showsNote that lines 41 to 76 as mentioned in the stack trace have this code:
--- https://github.com/JuliaPy/PyCall.jl/blob/4e5c12cfc597a0e911d42fe661aabd4f1cd74a5f/src/startup.jl#L41-L76
Since the system image compilation script uses
--compiled-modules=no
for Julia >= 1.5, this also breakspython3 -m julia.sysimage sys.so
.For full traces of this failure mode in CI, see: #458 (comment)
The text was updated successfully, but these errors were encountered: