Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thanks a lot for the education. That explains why Linus isn't happy about supporting ARM in Linux.
BTW, I noticed something strange: After unzipping the toolchain, I simply cd'ed to ./bin and ran "./arm-none-linux-gnueabi-gcc -o hello hello.c", which built a statically-linked binary without my telling it where to find the include + library.
Does it work because the compiler expects those two items to be located in ../include and ../lib, respectively?
Code:
/home/joe/Downloads/LinuxHost/gcc/bin# ./arm-none-linux-gnueabi-gcc -o hello hello.c
/home/joe/Downloads/LinuxHost/gcc/bin# file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/joe/Downloads/LinuxHost/gcc/bin# ./arm-none-linux-gnueabi-readelf -s hello
Symbol table '.dynsym' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000829c 1000 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.4 (2)
2: 000082a8 592 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.4 (2)
3: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
4: 000082c0 740 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.4 (2)
/home/joe/Downloads/LinuxHost/gcc/bin# ldd ./hello
not a dynamic executable
/home/joe/Downloads/LinuxHost/gcc# ll
drwxr-xr-x 6 fred fred 4096 Feb 26 2008 arm-none-linux-gnueabi/
drwxr-xr-x 2 fred fred 4096 Apr 8 22:29 bin/
drwxr-xr-x 3 fred fred 4096 Feb 26 2008 distributed/
drwxr-xr-x 2 fred fred 4096 Feb 26 2008 include/
drwxr-xr-x 2 fred fred 4096 Feb 26 2008 info/
drwxr-xr-x 3 fred fred 4096 Feb 26 2008 lib/
drwxr-xr-x 3 fred fred 4096 Feb 26 2008 libexec/
drwxr-xr-x 4 fred fred 4096 Feb 26 2008 man/
drwxr-xr-x 8 fred fred 4096 Feb 26 2008 share/
Click here to see the post LQ members have rated as the most helpful post in this thread.
Does it work because the compiler expects those two items to be located in ../include and ../lib, respectively?
Most likely. You can confirm this by running
Code:
./arm-none-linux-gnueabi-gcc -print-search-dirs
Depending on the toolchain builder, the sysroot can be absolute or relative to the compiler. Re-arranging stuff can get you into a significant pickle.
There are some other interesting things that the compiler will spit out. Use the --help option for some suggestions.
Another thing I wonder: When cross-compiling an application because its authors didn't port it yet, is there a way to be positive the application will run safely, especially on platforms like ARM that come in very different shades?
I'm thinking of memory leaks or code that will simply crash because it was only ever tested on x86 hosts and wasn't rewritten specifically for other CPU's like the ARM.
Another thing I wonder: When cross-compiling an application because its authors didn't port it yet, is there a way to be positive the application will run safely, especially on platforms like ARM that come in very different shades?
I'm thinking of memory leaks or code that will simply crash because it was only ever tested on x86 hosts and wasn't rewritten specifically for other CPU's like the ARM.
AFAIK, it is so far impossible to be positive any code is bug free whether the bugs are related to porting issues or any other reason. There are lots of ways to include architecture dependent code, such as assumed endian-ness, IO mapping, etc. I don't know if there is any easy way to identify such constructs reliably. Thorough scrutiny of the source code is probably your best bet. I have used many open source packages built from source tarballs without any problem. I've also used a few that did have problems, most of which I never found the causes of.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.