War*_*ace 77 shell executable command-line
我只是想从命令行运行一个可执行文件./arm-mingw32ce-g++
,但后来我收到错误信息,
bash: ./arm-mingw32ce-g++: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我正在运行Ubuntu Linux 10.10.ls -l
名单
-rwxr-xr-x 1 root root 433308 2010-10-16 21:32 arm-mingw32ce-g++
Run Code Online (Sandbox Code Playgroud)
使用sudo(sudo ./arm-mingw32ce-g++
)给出
sudo: unable to execute ./arm-mingw32ce-g++: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我不知道为什么操作系统甚至无法看到文件.有什么想法吗?
Gil*_*il' 69
此错误可能意味着./arm-mingw32ce-g++
不存在(但它确实存在),或者它存在,并且是内核识别但动态加载器不可用的动态链接可执行文件.您可以通过运行查看所需的动态加载程序ldd /arm-mingw32ce-g++
; 标记的not found
是动态加载程序或您需要安装的库.
如果您尝试在amd64安装上运行32位二进制文件:
ia32-libs
.ia32-libs-multiarch
.ia32-libs-multiarch
或选择一组合理:i386
的:amd64
软件包.stu*_*zen 25
当我尝试在Ubuntu上构建Selenium源时,我遇到了这个错误.即使在我满足所有先决条件之后,具有正确shebang的简单shell脚本也无法运行.
file file-name # helped me in understanding that CRLF ending were present in the file.
Run Code Online (Sandbox Code Playgroud)
我在Vim中打开文件,我可以看到,因为我曾经在Windows机器上编辑过这个文件,它是DOS格式.我使用以下命令将文件转换为Unix格式:
dos2unix filename # actually helped me and things were fine.
Run Code Online (Sandbox Code Playgroud)
我希望每当我们跨平台编辑文件时都要注意,我们也应该注意文件格式.
bet*_*pfa 12
我在这里找到了适用于我的 Ubuntu 18 的解决方案。
sudo dpkg --add-architecture i386
Run Code Online (Sandbox Code Playgroud)
然后:
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
Run Code Online (Sandbox Code Playgroud)
我在尝试运行Python脚本时遇到了同样的错误消息 - 这不是@Warpspace的预期用例(请参阅其他评论),但这是我搜索的热门点击之一,所以也许有人会发现它很有用.
在我的情况下,它是DOS行结尾(\r\n
而不是\n
)shebang行(#!/usr/bin/env python
)会跳过.一个简单的dos2unix myfile.py
修复它.
正如其他人提到的,这是因为找不到加载程序,而不是您的可执行文件。不幸的是,消息还不够明确。
您可以通过更改可执行文件使用的加载程序来修复它,请参阅我在另一个问题中的完整答案:Multiple glibc Librarys on a single host
基本上你必须找到它尝试使用哪个加载器:
$ readelf -l arm-mingw32ce-g++ | grep interpreter
[Requesting program interpreter: /lib/ld-linux.so.2]
Run Code Online (Sandbox Code Playgroud)
然后找到等效加载程序的正确路径,并更改可执行文件以使用实际路径中的加载程序:
$ ./patchelf --set-interpreter /path/to/newglibc/ld-linux.so.2 arm-mingw32ce-g++
Run Code Online (Sandbox Code Playgroud)
您可能还需要设置包含的路径,在尝试运行它后您就会知道是否需要它。请参阅其他线程中的所有详细信息。
对于一个没有 32/64 位问题的简单 bash 脚本,我遇到了同样的错误。这可能是因为您尝试运行的脚本中有错误。这个ubuntu 论坛帖子表明,使用普通脚本文件,您可以sh
在前面添加,您可能会从中获得一些调试输出。例如
$ sudo sh arm-mingw32ce-g++
Run Code Online (Sandbox Code Playgroud)
看看你是否有任何输出。
就我而言,实际问题是我尝试执行的文件是 Windows 格式而不是 Linux。
我收到此错误,\xe2\x80\x9cNo such file or directory\xe2\x80\x9d
但它存在,因为我的文件是在 Windows 中创建的,我尝试在 Ubuntu 上运行它,并且该文件包含无效的 15\\r ,其中有新行。\n我刚刚创建了一个新文件,截断了不需要的内容
sleep: invalid time interval \xe2\x80\x9815\\r\xe2\x80\x99\nTry 'sleep --help' for more information.\nscript.sh: 5: script.sh: /opt/ag/cont: not found\nscript.sh: 6: script.sh: /opt/ag/cont: not found\nroot@Ubuntu14:/home/abc12/Desktop# vi script.sh \nroot@Ubuntu14:/home/abc12/Desktop# od -c script.sh \n0000000 # ! / u s r / b i n / e n v b\n0000020 a s h \\r \\n w g e t h t t p : /\n\n0000400 : 4 1 2 0 / \\r \\n\n0000410\nroot@Ubuntu14:/home/abc12/Desktop# tr -d \\\\015 < script.sh > script.sh.fixed\nroot@Ubuntu14:/home/abc12/Desktop# od -c script.sh.fixed \n0000000 # ! / u s r / b i n / e n v b\n0000020 a s h \\n w g e t h t t p : / /\n\n0000400 / \\n\n0000402\nroot@Ubuntu14:/home/abc12/Desktop# sh -x script.sh.fixed \n
Run Code Online (Sandbox Code Playgroud)\n