P
P
pixik2015-12-10 11:28:13
linux
pixik, 2015-12-10 11:28:13

How to compile "hello world" to c++ using cross compilation?

Hello!
Explain or share a clear tutorial on how to use cross compilation?
For example, you need to compile Hello World written in c++ for ARM Cortex™-A7 using gcc. How to do it?
I've read manuals, but mostly they are about how to compile the linux kernel for "such and such" architecture. There are a lot of body movements from which it is difficult for a beginner to pick out key points.
Thanks everyone!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2015-12-11
@jcmvbkbc

how to use cross compilation

Exactly the same as the usual one, but instead of the usual compiler, call the cross-compiler.
arm-buildroot-linux-gnueabi-gcc hello-world.c -o hello-world
If you have any build system -- see the build system documentation on how to specify the architecture and compiler.
For example, for autotools, you would call ./configure --target=arm-linux-gnueabi CC=arm-buildroot-linux-gnueabi-gcc
(or --host=arm-linux-gnueabi, depending on the application itself).

A
Anton Zhukov, 2015-12-10
@MrCheater

https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question