我在服务器上安装了 p4 命令行客户端,但发生了一些奇怪的事情。它存在,具有可执行权限,但我无法执行它,因为我收到一条错误消息,说它不存在。
我试着环顾四周,遇到这个问题的其他人都意识到他们为他们的盒子选择了错误的二进制文件,但我 100%确定我没有。
/usr/local/bin/p4 文件是:
- 0x0755
- 在我的 $PATH 目录 (/usr/local/bin) 中
- 存在于正确的位置
- 尝试以 root 和 ubuntu 用户身份执行
这是我的终端输出:
ubuntu@ubuntu:~$ sudo su
+ sudo su
root@ubuntu:/home/ubuntu# wget http://cdist2.perforce.com/perforce/r16.1/bin.freebsd100x86_64/p4
--2017-09-25 22:21:45-- http://cdist2.perforce.com/perforce/r16.1/bin.freebsd100x86_64/p4
Resolving cdist2.perforce.com (cdist2.perforce.com)... 54.192.36.127, 54.192.36.104, 54.192.36.217, ...
Connecting to cdist2.perforce.com (cdist2.perforce.com)|54.192.36.127|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3683848 (3.5M) [application/x-executable]
Saving to: ‘p4’
100%[===================================================================================================================>] 3,683,848 5.06MB/s in 0.7s
2017-09-25 22:21:46 (5.06 MB/s) - ‘p4’ saved [3683848/3683848]
root@ubuntu:/home/ubuntu# chmod +x p4
root@ubuntu:/home/ubuntu# mv p4 /usr/local/bin/
root@ubuntu:/home/ubuntu# p4
bash: /usr/local/bin/p4: No such file or directory
root@ubuntu:/home/ubuntu# ls -lah /usr/local/bin/p4
-rwxr-xr-x 1 root root 3.6M Mar 2 2017 /usr/local/bin/p4
root@ubuntu:/home/ubuntu# file /usr/local/bin/p4
/usr/local/bin/p4: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 10.0 (1000510), stripped
root@ubuntu:/home/ubuntu# uname -m
x86_64
任何帮助是极大的赞赏!
答案1
好的,我找到了解决方案,我将我的配置脚本更改为此,它运行良好。我不知道为什么这解决了我的问题...
#!/bin/bash
# bash strict and verbose mode
set -o pipefail -e -u -x
if [ ! -z `which p4` ]; then
exit 0
fi
# Installs Perforce
echo "deb http://package.perforce.com/apt/ubuntu/ trusty release" > /etc/apt/sources.list.d/perforce.list
wget -qO - https://package.perforce.com/perforce.pubkey | apt-key add -
apt-get update
apt-get install -y helix-cli
答案2
令人困惑的“没有这样的文件或目录”实际上可能是指这个(不合适的!)二进制文件试图调用的任何动态链接器。