I cleaned up my system 3 weeks ago and made a fatal mistake. Well, I don't really know why, but I uninstalled sys-devel/binutils.

After I recognized the mistake I tried re-emerge, but it doesn't work. Next step was downloading stage3 from Gentoo and copying sys-devel/binutils from there to local tree.
Didn't work.

When I try to emerge something like x11-apps/xinput, I receive the following:

output from emerge:

checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/x11-apps/xinput-1.6.2/work/xinput-1.6.2_build':
configure: error: C compiler cannot create executables

config.log from emerge:

configure:3372: checking whether the C compiler works
configure:3394: x86_64-pc-linux-gnu-gcc -m32 -march=core-avx-i -mtune=core-avx-i -O2 -pipe  -Wl, -O1 -Wl, --as-needed conftest.c  >&5
x86_64-pc-linux-gnu-gcc: internal compiler error: Illegal instruction (program as)

ldd from /usr/bin/as:

linux-vdso.so.1 (0x00007ffee41b9000)
libopcodes-2.25.1.so => /usr/lib64/binutils/x86_64-pc-linux-gnu/2.25.1/libopcodes-2.25.1.so (0x00007f2045ff8000)
libbfd-2.25.1.so => /usr/lib64/binutils/x86_64-pc-linux-gnu/2.25.1/libbfd-2.25.1.so (0x00007f2045cd3000)
libz.so.1 => /lib64/libz.so.1 (0x00007f2045abd000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2045722000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f204551e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f204637f000)


  • sys-devel/binutils-2.25.1-r1
  • sys-devel/gcc-4.9.3

Any suggestions to do? Any hints? Any ideas to fix? Let me know!

2 Answers 2


Copying sys-devel/binutils didn't fix your problem because that is just the ebuild which defines the build and installation process for binutils. It doesn't work because you need that package to build anything, as you've come to realize. What you need to do instead is to copy the files that are part of that package. The files and directories are:


Copy (recursively) these files/directories from the stage 3 tarball into your live system. Afterwards, run env-update and either log out and back in or source /etc/profile to load the updated environment. Check that things work and the first thing you should do after that is emerge binutils to build that package properly and record it in your world file.

If, after this, you still cannot emerge things, you may have to repeat the process with other packages. As a worse case, you can copy the /usr and /bin hierarchy over from the stage 3 build and if you do that I'd recommend that be followed up with emerge --sync and emerge -e world to rebuild everything. Good luck.


Yes, casey is right. Short (but not quick) way is:

download current stage3 from https://www.gentoo.org/downloads/ - use correct stage3 for your architecture

unzip/untar it to /:

xz --decompress stage3-*.xz
tar -xvf stage3*.tar -C /

update environment:

source /etc/profile

emerge all again (this will take a lot of time)

emerge -avqeDN @world



I hope that it will help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .