因此我尝试安装 ruby 但是运行时rbenv install -v 2.2.3
出现以下错误:
/tmp/ruby-build.20161217084514.23075 ~
Downloading ruby-2.2.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.bz2
/tmp/ruby-build.20161217084514.23075/ruby-2.2.3 /tmp/ruby-build.20161217084514.23075 ~
Installing ruby-2.2.3...
config.guess already exists
config.sub already exists
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/ruby-build.20161217084514.23075/ruby-2.2.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
BUILD FAILED (Ubuntu 14.04 using ruby-build 20161121-14-gd799bdd)
Inspect or clean up the working tree at /tmp/ruby-build.20161217084514.23075
Results logged to /tmp/ruby-build.20161217084514.23075.log
Last 10 log lines:
config.sub already exists
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/ruby-build.20161217084514.23075/ruby-2.2.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
我不是专家,但看起来 gcc 可能丢失了,我尝试通过安装 gcc,sudo apt-get install gcc
但出现以下错误:
Setting up gcc (4:4.8.2-1ubuntu6) ...
update-alternatives: error: alternative path /usr/bin/gcc doesn't exist
dpkg: error processing package gcc (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
gcc
E: Sub-process /usr/bin/dpkg returned an error code (1)
这是我尝试过的:
sudo apt-get install build-essential
然后
sudo dpkg --purge gcc
sudo apt-get clean
sudo apt-get -f install
但这些都不起作用。我认为这甚至可能与权限有关,我最近不得不恢复 /var/,从那时起就出现了不少不相关的权限/所有权错误。知道是什么原因造成的吗?
编辑:
当我运行时update-alternatives --query cc
我得到以下结果:
update-alternatives: error: no alternatives for cc
当我跑步时,ls -l /usr/bin/{cc,gcc}
我得到了以下结果:
ls: cannot access /usr/bin/cc: No such file or directory
lrwxrwxrwx 1 root root 7 Apr 7 2014 /usr/bin/gcc -> gcc-4.8
跑步ls -ld /var/lib/dpkg/alternatives/{,cc}
让我:
ls: cannot access /var/lib/dpkg/alternatives/cc: No such file or directory
drwxrwxr-x 2 mre mre 4096 Dec 17 00:06 /var/lib/dpkg/alternatives/
通过跑步sudo apt-get install --reinstall gcc-4.8 gcc
我得到了:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,047 kB of archives.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for gcc:amd64
然后我发现这回答并且它起作用了所以现在 gcc 正在编译但是当我运行时rbenv install -v 2.2.3
我得到了这个:
Last 10 log lines:
config.guess already exists
config.sub already exists
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/ruby-build.20161217125354.10629/ruby-2.2.3':
configure: error: C compiler cannot create executables
See `config.log' for more details