我看到还有其他类似的问题,但那里的答案对我不起作用。
我正在使用我下载的Julia 1.9.2(Linux、x86-64、glibc)预构建二进制文件并尝试执行二进制文件,但出现以下错误。
bash: ./julia: cannot execute: required file not found
我能够在我的机器上执行所有其他二进制文件。我的理解是,这是因为 bash 找不到执行该文件所需的解释器。在这种情况下它应该是一个装载机,我猜?这是 的输出file
,
$ file julia
julia: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.4.0, with debug_info, not stripped
和ldd
$ ldd julia
linux-vdso.so.1 (0x00007ffdae587000)
libdl.so.2 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libdl.so.2 (0x00007fe5955f4000)
libpthread.so.0 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libpthread.so.0 (0x00007fe5955ef000)
libc.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 (0x00007fe595409000)
libjulia.so.1 => /home/chaitanyak/Downloads/julia-1.9.2/bin/./../lib/libjulia.so.1 (0x00007fe5953e6000)
/lib64/ld-linux-x86-64.so.2 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007fe5955fb000)
我在用NixOS 23.05.2573.61676e4dcfee (Stoat) x86_64
。
ldd 的详细输出
$ ldd -v julia
linux-vdso.so.1 (0x00007ffcd2942000)
libdl.so.2 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libdl.so.2 (0x00007efd29f12000)
libpthread.so.0 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libpthread.so.0 (0x00007efd29f0d000)
libc.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 (0x00007efd29d27000)
libjulia.so.1 => /home/chaitanyak/Downloads/julia-1.9.2/bin/./../lib/libjulia.so.1 (0x00007efd29d04000)
/lib64/ld-linux-x86-64.so.2 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007efd29f19000)
Version information:
./julia:
libc.so.6 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libdl.so.2:
libc.so.6 (GLIBC_ABI_DT_RELR) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libpthread.so.0:
libc.so.6 (GLIBC_ABI_DT_RELR) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.3) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2
/home/chaitanyak/Downloads/julia-1.9.2/bin/./../lib/libjulia.so.1:
libdl.so.2 (GLIBC_2.3.3) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libdl.so.2
libdl.so.2 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libdl.so.2
libpthread.so.0 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libpthread.so.0
libc.so.6 (GLIBC_2.2.5) => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
编辑
我还尝试直接使用可能的解释器。
$ /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 julia
julia: error while loading shared libraries: julia: cannot open shared object file: No such file or directory
$ /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/ld-linux-x86-64.so.2 julia
julia: error while loading shared libraries: julia: cannot open shared object file: No such file or directory
因此,它看起来无法打开某些.so
文件,但没有提供其名称。
编辑2
我运行了口译员gdb
,它提供了更多信息。
(gdb) r Downloads/julia-1.9.2/bin/julia
Starting program: /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/ld-linux-x86-64.so.2 Downloads/julia-1.9.2/bin/julia
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libthread_db.so.1".
[Detaching after fork from child process 29527]
[New Thread 0x7ffff17ff6c0 (LWP 29528)]
ERROR: could not load library "/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/../lib/julia/sys.so"
/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/../lib/julia/sys.so: cannot open shared object file: No such file or directory
[Thread 0x7ffff7dae0c0 (LWP 29524) exited]
[Thread 0x7ffff17ff6c0 (LWP 29528) exited]
[New process 29524]
[Inferior 1 (process 29524) exited with code 01]
(gdb)
所以,它似乎正试图sys.so
在 nix 商店内找到与 Julia 一起发货的产品。那么,这是一个 nix 特有的问题吗?是为 Julia 1.9 创建 nix 包的唯一解决方法吗?
编辑3
因此,Julia 附带了自己的共享对象文件,并且二进制文件尝试相对于我的 nix 存储中的其他位置搜索它们,而不是在那里搜索它们。使用 patchelf 修改 julia 二进制文件的 RPATH 是否可以解决此问题?
答案1
朱莉娅 1.9 是已在 nixpkgs 中提供。由于某种原因,Julia 1.8 是最高结果,这就是我可能错过它的原因。
因此,这个特定问题属于在 NixOS 上执行非 NixOS 二进制文件的一般类别,并且具有已经涵盖了 Unix 堆栈交换。