64-Bit
Linux 找不到存在的文件
我正在嘗試啟動並執行 Google 的 Dart 語言,但在執行 dart2js 時會出錯。我正在執行 Arch linux,並從 AUR安裝了dart-sdk 。一些相關的終端輸出如下。
% dart2js main.dart /usr/local/bin/dart2js: line 7: /usr/local/bin/dart: No such file or directory % cat /usr/local/bin/dart2js #!/bin/sh # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. BIN_DIR=`dirname $0` exec $BIN_DIR/dart --allow_string_plus=false $BIN_DIR/../lib/dart2js/lib/compiler/implementation/dart2js.dart "$@" % file /usr/local/bin/dart /usr/local/bin/dart: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0x27fe166ca015c1adfeaf3a6f9c018e7d7af46d9f, stripped % ls -alh /usr/local/bin total 4.9M drwxr-xr-x 2 root root 4.0K Jun 10 22:51 . drwxr-xr-x 12 root root 4.0K Jun 10 22:51 .. -rwxr-xr-x 1 root root 422K May 10 22:41 cargo -rwxr-xr-x 1 root root 2.7M Jun 10 22:50 dart -rwxr-xr-x 1 root root 360 Jun 6 16:20 dart2js -rwxr-xr-x 1 root root 176 Jun 6 16:20 pub -rwxr-xr-x 1 root root 166K May 10 22:41 rustc -rwxr-xr-x 1 root root 1.6M May 10 22:41 rustdoc % uname -rm 3.3.7-1-ARCH x86_64
可能是因為我執行的是 64 位作業系統而 dart 二進製文件是 32 位的嗎?
為了執行 ELF 二進制 linux 需要啟動一個程序來解碼 ELF、載入動態庫等。這個程序稱為程序解釋器。程序解釋器的名稱和完整路徑寫在 ELF 本身中
例如
$ file /usr/bin/cheese /usr/bin/cheese: ELF 32-bit LSB executable, Intel 80386 $ readelf -l /usr/bin/cheese Elf file type is EXEC (Executable file) ... Program Headers: ... INTERP 0x000154 0x08048154 0x08048154 0x00013 0x00013 R 0x1 [Requesting program interpreter: /lib/ld-linux.so.2] ...
如果沒有找到 ELF 請求的程序解釋器,BASH 會收到文件未找到錯誤並報告“沒有這樣的文件或目錄”。
正如@poige 上面所說,您需要安裝執行 32 位應用程序的基本支持。