user16177: I have just installed the arduino IDE on my gentoo laptop. I then installed the toolchain with the following command:
crossdev -s4 avr

This does a stage 4 install of the toolchain, with all its dependecies etc.
I am following a tutorial, with my arduino uno, which I am assuming is using the Amtel ATmega328 chipset. This tutorial is simply going to turn an led on and off.
I click the verify button and I get the following errors:
/usr/libexec/gcc/avr/ld: cannot find crtatmega328p.o: No such file or directory

/usr/libexec/gcc/avr/ld: cannot find -latmega328p

collect2: error: ld returned 1 exit status

I downloaded the source files "avr-libc" compiled them and noticed inside the directory 
/avr-libc-1.8.1/avr/lib/avr5/atmega328p

That the compiled module is named crtm328p.o which is available on my pc under the directory:
/usr/avr/lib/

I dont understand what is wrong and why this is not working. The only posts relating to missing files are over 5 years old and those solutions are not working.

user39447: I had the same error, but I did everything as says in arduino wiki: https://wiki.gentoo.org/wiki/Arduino#Install_the_toolchain_using_crossdev 
and solved it, after read this discussion: https://wiki.gentoo.org/wiki/Talk:Arduino
helped: build the avr toolchain without '--stable' part of crossdev command line :
USE="-openmp -hardened -sanitize -vtv" crossdev -s4 --portage --verbose --target avr

user7508: I do not use Gentoo, but I can tell you how things work on Ubuntu 14.04,
which also installs Arduino 1.0.5. I assume Gentoo should not be that
different... The dependency tree is like this:

The package named "arduino", version 1.0.5, contains the IDE. It
depends on Java and on arduino-core.
arduino-core, version 1.0.5 also, has the Arduino core libraries. It
depends on gcc-avr, avrdude and avr-libc.
gcc-avr comes as version 4.8, avr-libc is version 1.8.0.

When you compile a program for an Uno, on the link stage avr-g++ gets
called, and it is asked to link your object files with libcore.a (the
Arduino core) and -lm (the math library). avr-g++ in turn calls the
linker (collect2) and asks it to link together
/usr/lib/avr/lib/avr5/crtm328p.o (the C runtime), your object files,
libcore.a, -lgcc (the GCC support libraries), -lm and -lc (avr-libc).
Notice that there is no crtatmega328p.o, it's called crtm328p.o instead.
And there is no -latmega328p.
For diagnosing your problem, you can set an IDE preference so that it
shows you the exact command lines it runs for compiling your program.
You can then copy and paste the last command (link stage) on a terminal.
If you add the -v option (meaning “verbose”), you will see what gcc is
asking the linker to put together.
You may be able to fix your problem with a simple symlink from
crtm328p.o to crtm328p.o. If you are using vanilla Gentoo packages, you
should then file a bug to the packager. On Ubuntu, you type
sudo apt-get install arduino and it just works.

16177: <p>I have just installed the arduino IDE on my gentoo laptop. I then installed the toolchain with the following command:</p>

<pre><code>crossdev -s4 avr
</code></pre>

<p>This does a stage 4 install of the toolchain, with all its dependecies etc.</p>

<p>I am following a tutorial, with my arduino uno, which I am assuming is using the Amtel ATmega328 chipset. This tutorial is simply going to turn an led on and off.</p>

<p>I click the verify button and I get the following errors:</p>

<pre><code>/usr/libexec/gcc/avr/ld: cannot find crtatmega328p.o: No such file or directory

/usr/libexec/gcc/avr/ld: cannot find -latmega328p

collect2: error: ld returned 1 exit status
</code></pre>

<p>I downloaded the source files "avr-libc" compiled them and noticed inside the directory </p>

<pre><code>/avr-libc-1.8.1/avr/lib/avr5/atmega328p
</code></pre>

<p>That the compiled module is named crtm328p.o which is available on my pc under the directory:</p>

<pre><code>/usr/avr/lib/
</code></pre>

<p>I dont understand what is wrong and why this is not working. The only posts relating to missing files are over 5 years old and those solutions are not working.</p>
 39447: <p>I had the same error, but I did everything as says in arduino wiki: <a href="https://wiki.gentoo.org/wiki/Arduino#Install_the_toolchain_using_crossdev" rel="nofollow noreferrer">https://wiki.gentoo.org/wiki/Arduino#Install_the_toolchain_using_crossdev</a> </p>

<p>and solved it, after read this discussion: <a href="https://wiki.gentoo.org/wiki/Talk:Arduino" rel="nofollow noreferrer">https://wiki.gentoo.org/wiki/Talk:Arduino</a></p>

<p><strong>helped</strong>: build the avr toolchain without '--stable' part of crossdev command line :</p>

<p>USE="-openmp -hardened -sanitize -vtv" crossdev -s4 --portage --verbose --target avr</p>
 7508: <p>I do not use Gentoo, but I can tell you how things work on Ubuntu 14.04,
which also installs Arduino 1.0.5. I assume Gentoo should not be that
different... The dependency tree is like this:</p>

<ul>
<li>The package named "arduino", version 1.0.5, contains the IDE. It
depends on Java and on arduino-core.</li>
<li>arduino-core, version 1.0.5 also, has the Arduino core libraries. It
depends on gcc-avr, avrdude and avr-libc.</li>
<li>gcc-avr comes as version 4.8, avr-libc is version 1.8.0.</li>
</ul>

<p>When you compile a program for an Uno, on the link stage avr-g++ gets
called, and it is asked to link your object files with libcore.a (the
Arduino core) and -lm (the math library). avr-g++ in turn calls the
linker (collect2) and asks it to link together
/usr/lib/avr/lib/avr5/crtm328p.o (the C runtime), your object files,
libcore.a, -lgcc (the GCC support libraries), -lm and -lc (avr-libc).
Notice that there is no crtatmega328p.o, it's called crtm328p.o instead.
And there is no -latmega328p.</p>

<p>For diagnosing your problem, you can set an IDE preference so that it
shows you the exact command lines it runs for compiling your program.
You can then copy and paste the last command (link stage) on a terminal.
If you add the <code>-v</code> option (meaning “verbose”), you will see what gcc is
asking the linker to put together.</p>

<p>You may be able to fix your problem with a simple symlink from
crtm328p.o to crtm328p.o. If you are using vanilla Gentoo packages, you
should then file a bug to the packager. On Ubuntu, you type
<code>sudo apt-get install arduino</code> and it just works.</p>
