Differences
This shows you the differences between the selected revision and the current version of the page.
howto:crosscompile 2011/05/29 20:15 | howto:crosscompile 2017/09/06 18:38 current | ||
---|---|---|---|
Line 8: | Line 8: | ||
For the cross-compiler ('user' is an example username): | For the cross-compiler ('user' is an example username): | ||
- | <code>cd /home/user | + | <code bash>cd /home/user |
tar xjf cross-compiler-armv5l.tar.bz2 | tar xjf cross-compiler-armv5l.tar.bz2 | ||
rm cross-compiler-armv5l.tar.bz2 | rm cross-compiler-armv5l.tar.bz2 | ||
export PATH=/home/user/cross-compiler-armv5l/bin:$PATH</code> | export PATH=/home/user/cross-compiler-armv5l/bin:$PATH</code> | ||
Then you would compile programs with armv5l-tool, e.g. armv5l-gcc | Then you would compile programs with armv5l-tool, e.g. armv5l-gcc | ||
+ | |||
+ | If you are using configure/make programs, you will need to follow the documentation for cross-compilation. You will also want the programs to be installed in a different directory from /usr/local so you can copy them later. For GNU and compatible programs, it is usually this: | ||
+ | <code bash>export CC=armv5l-gcc | ||
+ | ./configure --host=arm-unknown-linux --prefix=/home/user/arm # example directory | ||
+ | make | ||
+ | make install</code> | ||
For the native compiler: | For the native compiler: | ||
- | <code>cd /mnt/HD_a2 | + | <code bash>cd /mnt/HD_a2 |
tar xjf mini-native-armv5l.tar.bz2 | tar xjf mini-native-armv5l.tar.bz2 | ||
rm mini-native-armv5l.tar.bz2 | rm mini-native-armv5l.tar.bz2 | ||
Line 26: | Line 32: | ||
You might get this error when using make with the native compiler. You can either download a patched version here: {{:download:make.gz}} or recompile make, adding the following line to main.c after the includes: | You might get this error when using make with the native compiler. You can either download a patched version here: {{:download:make.gz}} or recompile make, adding the following line to main.c after the includes: | ||
- | int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle){} | + | <code c>int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle){}</code> |
==== Cross vs Native compile ==== | ==== Cross vs Native compile ==== |