JuliaPy / JuliaPy/PyCall.jl

Fix, warning (and make more helpful) when bitness doesn't match

Abierto
#785 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

A.
I'm conflicted if we should discourage julia snap (as it's 32-bit, or for other reasons; I see Linux Mint dropped snap for security reasons), as Jeff promoted snap.

B.
Anyway, people may still run into this problem, independently of snap (but maybe mention in in the error message?) and I'm not sure why this check doesn't work for it:

https://github.com/JuliaPy/PyCall.jl/blob/c442738dcef680412ac726ea5595b25d46dd301e/deps/build.jl#L57

```
$ sudo snap install julia --classic
julia 1.0.4 from The Julia Language (julialang✓) installed

julia> using PyCall
[ Info: Recompiling stale cache file /home/pharaldsson_sym/.julia/compiled/v1.0/PyCall/GkzkC.ji for PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0]
ERROR: LoadError: LoadError: could not load library "/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0"
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0: wrong ELF class: ELFCLASS64
Stacktrace:
[1] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.0/Libdl/src/Libdl.jl:97
[2] top-level scope at /home/pharaldsson_sym/.julia/packages/PyCall/zqDXB/src/startup.jl:47 [inlined]
[3] top-level scope at ./none:0
[4] include at ./boot.jl:317 [inlined]
[5] include_relative(::Module, ::String) at ./loading.jl:1044
[6] include at ./sysimg.jl:29 [inlined]
[7] include(::String) at /home/pharaldsson_sym/.julia/packages/PyCall/zqDXB/src/PyCall.jl:1
[8] top-level scope at none:0
[9] include at ./boot.jl:317 [inlined]
[10] include_relative(::Module, ::String) at ./loading.jl:1044
[11] include(::Module, ::String) at ./sysimg.jl:29
[12] top-level scope at none:2
[13] eval at ./boot.jl:319 [inlined]
[14] eval(::Expr) at ./client.jl:393
[15] top-level scope at ./none:3
in expression starting at /home/pharaldsson_sym/.julia/packages/PyCall/zqDXB/src/startup.jl:41
in expression starting at /home/pharaldsson_sym/.julia/packages/PyCall/zqDXB/src/PyCall.jl:34
ERROR: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to /home/pharaldsson_sym/.julia/compiled/v1.0/PyCall/GkzkC.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
[3] _require(::Base.PkgId) at ./loading.jl:960
[4] require(::Base.PkgId) at ./loading.jl:858
[5] require(::Module, ::Symbol) at ./loading.jl:853
```

FYI: I originally ran into the problem for (pyjulia, as used by) TopLoader:

```
$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import TopLoader
TopLoader V 0.0.1
Happy Loading!
-----------------

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/TopLoader/__init__.py", line 5, in
from julia import Pkg
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/home/pharaldsson_sym/.local/lib/python3.6/site-packages/julia/core.py", line 247, in load_module
elif self.julia.isafunction(juliapath):
File "/home/pharaldsson_sym/.local/lib/python3.6/site-packages/julia/core.py", line 238, in julia
self.__class__.julia = julia = Julia()
File "/home/pharaldsson_sym/.local/lib/python3.6/site-packages/julia/core.py", line 471, in __init__
self.api = LibJulia.from_juliainfo(jlinfo)
File "/home/pharaldsson_sym/.local/lib/python3.6/site-packages/julia/libjulia.py", line 195, in from_juliainfo
sysimage=juliainfo.sysimage,
File "/home/pharaldsson_sym/.local/lib/python3.6/site-packages/julia/libjulia.py", line 215, in __init__
self.libjulia = ctypes.PyDLL(libjulia_path, ctypes.RTLD_GLOBAL)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /snap/julia/13/bin/../lib/libjulia.so.1: wrong ELF class: ELFCLASS32
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with deps/build.jl around the check at line 57 and reproduce the reported ELFCLASS32/ELFCLASS64 failures from the issue. Trace why the existing check misses these mismatches, then make the failure warning identify the incompatible bitness and verify it covers both Julia/Python loading examples.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.