Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the installation of arm-linux-gcc cross-compiler

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Arm-linux-gcc cross-compiler installation is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Download arm-linux-gcc-4.4.3.tar.gz from the Internet.

1. Decompress # tar-zxvf arm-linux-gcc-4.4.3.tar.gz

2. Open the decompressed directory and copy the FriendlyARM folder to the folder usr/local/.

Cd / usr/local/

Cp-rv FriendlyARM / usr/local/

(cross-compiled assemblies are all in / usr/local/arm/4.4.3/bin)

3. Modify the environment variable to add the path of the cross compiler to the PATH.

Method 1 (untested): modify / etc/bash.bashrc file

# vi / etc/bash.bashrc

Add at the end:

Export PATH=$PATH:/usr/local/FriendlyARM/toolschain/4.4.3/bin

Export PATH

Method 2 (test, useless): modify / etc/profile file:

# vi / etc/profile

Add path settings, add the following at the end, and save the / etc/profile file:

Export PATH=$PATH:/usr/local/FriendlyARM/toolschain/4.4.3/bin

Method 3: # export PATH=$PATH:/usr/local/FriendlyARM/toolschain/4.4.3/bin

In fact, you can just use method three directly.

4. Make the new environment variable effective immediately.

Corresponding method 1 (untested): # source / root/.bashrc

Corresponding method 2 (untested): # source / etc/profile

5. Check whether the path is added to the PATH:

# echo $PATH

The / usr/local/FriendlyARM/toolschain/4.4.3/bin is displayed, indicating that the path of the cross-compiler has been added to the PATH.

6. Test whether the installation is successful

# arm-linux-gcc-v

Displays arm-linux-gcc information and version. Arm-linux-gcc installed successfully.

7. Try it out.

Write hello.c program under vi.

Int main () {

Printf ("hello!\ n")

Return 0

}

# arm-linux-gcc hello.c-o hello (same as gcc hello.c-o hello).

There are the following errors:

/ usr/local/FriendlyARM/toolschain/4.4.3/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1: / usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by / usr/local/FriendlyARM/toolschain/4.4.3/lib/libppl_c.so.2)

/ usr/local/FriendlyARM/toolschain/4.4.3/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1: / usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by / usr/local/FriendlyARM/toolschain/4.4.3/lib/libppl.so.7)

Reason: strings / usr/lib/libstdc++.so.6 | grep GLIBC. The returned result has no GLIBCXX_3.4.9, and then enter ls-l / usr/lib/libstdc++.so.6. The result is:

Lrwxrwxrwx 1 root root 18 02-13 19:06 / usr/lib/libstdc++.so.6-> libstdc++.so.6.0.8

Libstdc++.so.6 is a soft link that links to libstdc++.so.6.0.8. Libstdc++.so.6.0.8, however, does not have `GLIBCXX_3.4.9'. The version is too low.

Solution:

Download libstdc++.so.6.0.10 on the Internet. Put it in the / urs/lib directory.

Delete libstdc++.so.6. Rm-rf / usr/lib/libstdc++.so.6.

Third, redo libstdc++.so.6. Soft link, ln-s / usr/lib/libstdc++.so.6.0.10 / usr/lib/libstdc++.so.6.

Then, re-enter # arm-linux-gcc hello.c-o hello. You can see that the compilation was successful. Run # hello, "cannot execute binary file".

Files compiled by arm-linux-gcc can only be run on the arm development board, so the prompt is correct here.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report