【问题标题】:$Path in bashrc on DebianDebian 上 bashrc 中的 $Path
【发布时间】:2017-02-04 07:05:47
【问题描述】:

操作系统:Debian 8 VPS

所以我将mips-gcc comiler 放在etc 文件夹中,使用root 帐户通过ssh 连接到vps,将此导出添加到.bashrc:

export PATH=$PATH:/etc/xcompile/mips/bin

在 bin 文件夹中有 mips-gcc 二进制文件。当我尝试通过 mips-gcc 运行它时出现错误:

bashrc 在 $PATH 中找不到 mips-gcc

如何解决?

当我尝试使用 ./mips-gcc 从 bin 文件夹运行它时,我遇到了同样的错误。在我本地的 Debian 操作系统上一切正常,没有任何错误。

【问题讨论】:

  • 您能告诉我们以下命令的输出吗? file /etc/xcompile/mips/bin/mips-gcc && echo $PATH
  • 当然:/etc/xcompile/mips/bin/mips-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/xcompile/armv4l/bin:/etc/xcompile/armv6l/bin:/etc/xcompile/i586/bin:/etc/xcompile/m68k/bin:/etc/xcompile/mips/bin:/etc/xcompile/mipsel/bin:/etc/xcompile/powerpc/bin:/etc/xcompile/powerpc-440fp/bin:/etc/xcompile/sh4/bin:/etc/xcompile/sparc/bin:/etc/xcompile/armv5l/bin:/etc/xcompile/i686/bin:/usr/local/go/bin
  • 谢谢。好的,你能也显示这些命令的输出吗? which mips-gcc && mips-gcc
  • 这里:/etc/xcompile/mips/bin/mips-gcc can't find mips-gcc in $PATH
  • 所以总结一下,(1)/etc/xcompile/mips/bin/mips-gcc是可执行文件,(2)/et‌​c/xcompile/mips/binPATH中,(3)/etc/xcompile/mips/bin/mips-gcc在搜索时被which找到对于mips-gcc,但是当您尝试在没有绝对路径的情况下执行mips-gcc 时,shell 找不到任何东西。非常有趣,因为知道我认为这是不可能的!期待解决方案。

标签: debian vps


【解决方案1】:

从cmets中的分析来看,mips-gcc二进制是ELF 32-bit LSB executable,根据file,而你的系统是x86_64,根据uname -m。那是行不通的。您需要使用适合系统平台的二进制文件。

mips 下载gcc 的64 位版本。如果您的 Debian 风格是 jessie,请以用户 root 的身份执行以下操作:

1. echo "deb http://www.emdebian.org/tools/debian/ jessie main" >> /etc/apt/sources.list.d/embedian.list
2. apt-get update
3. apt-get install emdebian-archive-keyring
4. apt-get install gcc-mips-linux-gnu

【讨论】:

  • 将尝试使用 Debian x86 版本的操作系统。谢谢你的回答!
  • @Sirius 很高兴我能帮上忙!
  • 所以我已经将操作系统重新安装到 Debian 7x86,uname -m i686,从同一个链接 mips-gcc 安装,并且有同样的错误。我做错了什么?
  • @Sirius Weird。那么二进制文件必须以其他方式破坏吗?为什么不从 Emdebian 存档中安装 mips gcc
  • 您对 jessie Debian 的命令,我使用的是 Debian 7 wheezy。所以对我来说命令不同?顺便说一句,如果我输入mips-gcc 而不输入env -i bash --noprofile --norc,我会遇到同样的错误not found in $PATH。 Localy 一切正常。可能是 KVM 虚拟化中的问题或导致我正在做所有这些 trought ssh?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-10-04
  • 1970-01-01
  • 2014-09-07
  • 2013-08-20
  • 2012-05-29
  • 2011-11-07
相关资源
最近更新 更多