2

I'm attempting to cross-compile a C++11 project for my Raspberry pi. In my searching online, I have come to the conclusion that I need the g++-arm-linux-gnueabihf compiler (please correct me if I am wrong here). I am running Fedora 27 on my host machine, and I can only find how to install it on Ubuntu systems. The closest I came was with this install command: sudo dnf install arm-linux-gnueabihf-{binutils,gcc,glibc}, and this was the output:

No match for argument: arm-linux-gnueabihf-binutils No match for argument: arm-linux-gnueabihf-gcc No match for argument: arm-linux-gnueabihf-glibc Error: Unable to find a match

If someone could point me to the correct compiler to download to accomplish this it would be appreciated. This is my first time cross-compiling anything, so feel free to correct me anywhere that I have gone wrong.

2 Answers 2

4

Try installing:

sudo dnf install binutils-arm-linux-gnu gcc-arm-linux-gnu glibc-arm-linux-gnu

binutils-arm-linux-gnu contains the GNU binutils for the arm-linux-gnu target. gcc-arm-linux-gnu contains GCC set up for cross compiling to ARM — but note that "Only building kernels is currently supported. Support for cross-building user space programs is not currently provided as that would massively multiply the number of packages."

glibc-arm-linux-gnu contains the GNU C library. The discussion on this bug may be relevant regarding the kernel only restriction.

5
  • 2
    This MAY solve the problem, but you should explain what it does and how this addresses the problem. Apr 9, 2018 at 14:56
  • Something to be wary of here is that the OP does not state which model of Pi this is applicable to. AFAIK, current distro cross-compilers target ARMv7+, meaning no good for the single core models, including the Pi Zero (W).
    – goldilocks
    Apr 9, 2018 at 18:17
  • It's a Rasperry Pi 3. @goldilocks
    – SH7890
    Apr 9, 2018 at 19:27
  • I have since found a way to avoid the need to cross compile to the pi (I compile on the pi itself), so I'm not sure if this works or not and do not have a way to test it currently, since I've changed some things in my project. If someone else can vouch for it solving the problem, I will accept it.
    – SH7890
    Apr 9, 2018 at 19:28
  • 1
    Unless you have something that just plain takes too long to compile on the pi, and you can't work on it on some other computer because it uses pi specific libs, compiling on the pi (and doing dev work on a big box as much as you can) is the right way to go. As noted above, putting together all the libs you need to support many userland things with a cross compiler is just too tedious.
    – goldilocks
    Apr 9, 2018 at 20:49
-1

try "dnf install arm-*" as a starter but that fouls up on a 64 bit PC. I hope it works on 32 bit or at least gives you some helpful hints

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.