alacritty: "error: linker `cc` not found" on Ubuntu 18.04 LTS, using X11

On Ubuntu 18.04 LTS, using X11.

When installing alacritty via cargo 1.27.0 (1e95190e5 2018-05-27) I get the following error:

   Compiling cc v1.0.17                                                         
   Compiling bitflags v1.0.3
   Compiling pkg-config v0.3.11
   Compiling lazy_static v1.0.1
   Compiling khronos_api v2.2.0
   Compiling downcast-rs v1.0.3
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: Could not compile `khronos_api`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `alacritty v0.1.0 (https://github.com/jwilm/alacritty#7cc9c11b)`, intermediate artifacts can be found at `/tmp/cargo-installxyENm0`

Caused by:
  build failed

I’ve tried a few things, like wiping out ~/.cargo and ensuring my cargo is up to date, but nothing I did seemed to help.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 35 (10 by maintainers)

Commits related to this issue

Most upvoted comments

for me it was I didn’t have cmake rather than gcc so sudo apt install cmake did the trick

I tried that, but it’s already installed.

~ » sudo apt install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version (4:7.3.0-3ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.

You’ll need to install gcc to build Alacritty.

Try running apt install build-essential.

I can run cc --version without any issue, so it must be installed. I guess cargo can’t find it for some reason?

cc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

looks like i missed libxcb-xfixes0-dev sorry about that

(I spent way too long on this page)

Summary

sudo apt install build-essential gcc cmake make zlib1g-dev libxcb-xfixes0-dev
cargo build -v --release

And if that doesn’t work, check these:

cc --version
gcc --version
uname -a
lsb_release -a
alias
echo $PATH
ls -l /usr
rustup toolchain list

@MavenRain Please make sure you’ve followed all the troubleshooting steps in this issue.

The most likely cause for this is that gcc is not installed on your system.

Just in case someone has the same problem:

I had the same problem under Ubuntu 18.04LTS, but for me this was solved after adding some missing entries to my PATH variable which were set in bash, but not in fish.

Edit: I forgot to clean and recompile…

For me the build somehow works in bash, but not in fish, even after setting the path to the same value.

@AchalaSB Try installing gcc.

@Asuza you should install the rustup first, if the curl method doesn’t work, you can try download manual install guide

rustup toolchain list to see if your installation matches your os. from my experience, it should be something like x86_64-unknown-linux-gnu

I’ve just verified that I can build Alacritty on Ubuntu 18.04. Could you run and show the output of:

  • uname -a
  • lsb_release -a
  • alias
  • echo $PATH
  • ls -l /usr

I am not sure what the issue could be, but maybe this information can help to diagnose it.

Hmm, super odd. What’s the path which cc gives you? Is there anything special about the way you build Alacritty? Anything that could have an effect on $PATH or something like that?

I’d make sure build-essential, gcc, cc, cmake and make are all up to date. Those are the main build tools I can think of which could be related to this. And make sure no clang is installed just because it might mess with things.