Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to install the Raspberry Pi cross compiler on my Linux host machine?
    text
    copied!<p>I am attempting to get cross-compiling for Raspberry Pi working on my Ubuntu machine. </p> <p>During my initial attempts I was using the arm-linux-gnueabi compiler, which is available in the Ubuntu repo. I got this working. I was able to build all my dependencies and use the cross-compiler in my cmake project.</p> <p>However, I believe I should be using the hf version, so I switched to arm-linux-gnueabihf. Then I realized that this does not work with Raspberry Pi since it is armv6.</p> <p>After some Googling, I then found the <a href="https://github.com/raspberrypi/tools" rel="nofollow noreferrer">pre-built toolchain from GitHub</a>.</p> <p>I downloaded the toolchain, but I don't really understand how to "install" it. I extracted the files to my home directory. The directory structure looks like this:</p> <pre><code>/gcc-linearo-arm-linux-gnueabihf-raspbian /arm-linux-gnueabihf /bin (contains g++, gcc, etc) /lib (contains libstdc++ library) /bin (contains arm-linux-gnueabihf-g++, arm-linux-gnueabihf-...) /lib (gcc lib stuff) </code></pre> <p>If I change directory to the INNER bin folder I am able to compile a test program from the terminal without any problems.</p> <pre><code>~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/ arm-linux-gnueabihf/bin$ g++ test.cpp -o test </code></pre> <p>I then tried to compile a test program in the OUTER bin folder, which contains the prefixed versions of the tools.</p> <pre><code> ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin$ arm-linux-gnueabihf-g++ test.cpp -o test </code></pre> <p>However, when I try to use the compiler now (from outside the inner bin directory), it is unable to find the libstdc++ shared library that comes with the toolchain:</p> <pre><code>arm-linux-gnueabihf-gcc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory. </code></pre> <p>Furthermore, I want to be able to use the compiler without having to navigate to the bin directory. So I tried adding the OUTER bin directory (since I want the prefixed versions) and both lib directories to my PATH:</p> <pre><code>export PATH=$PATH:~/tools/.../bin export PATH=$PATH:~/tools/.../lib export PATH=$PATH:~/tools/.../.../lib </code></pre> <p>However, this results in the same error. How should I "install" the toolchain so that I can use the toolchain from everywhere, just like I can when I use the cross-compilers from the Ubuntu repo?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload