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 construction method of SUSE 10.1 cross-compilation environment

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the construction method of SUSE 10.1 cross-compilation environment? in order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a simpler and easier way.

Now a lot of people are using SUSE, along with the problems also appear, I have studied SUSE for a long time, but also have some small experience. Here to share with you, what we are going to talk about today is the problem of building the SUSE 10.1 cross-compilation environment. Crosstool's method of making the chain of tools is good, but it is a waste of time, because it takes hours to compile at a time, which is very troublesome, and it is not suitable for beginners. Here is another way to build a SUSE 10.1 cross-compilation environment.

1. Copy arm-linux-gcc-3.4.1.tar.bz2 to the "/" directory

Cp / mnt/hgfs/linux_tmp/arm-linux-gcc-3.4.1.tar.bz2

/ / mnt/hgfs/linux_tmp/ is my virtual machine and windows shared directory, on how to share files with the virtual machine, you can refer to my other blog post.

two。 Decompress arm-linux-gcc-3.4.1.tar.bz2

# tar-jxvf arm-linux-gcc-3.4.1.tar.bz2

The decompression process takes a period of time. The extracted files form a usr/local/arm/3.4.1/bin folder and enter this folder.

Now the cross-compiled assemblies are all under / usr/local/arm/3.4.1/bin

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

Purpose of modification: the default gcc compiler of the system is arm-linux-gcc instead of gcc, which should be clearly recognized.

Modify / etc/bash.bashrc file

# vim / etc/bash.bashrc

Add in * *:

Export PATH=$PATH:/usr/local/arm/3.4.1/bin export PATH

4. Make the new environment variable take effect immediately without restarting the computer:

# source / etc/bash.bashrc

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

# echo $PATH

The / usr/local/arm/bin is displayed, indicating that the path of the cross-compiler has been added to the PATH. At this point, the installation of the cross-compilation environment is complete.

6. Test whether the installation is successful

Mengyang:/ # arm-linux-gcc-v

The above command displays the arm-linux-gcc information and version, which is the message I displayed: mengyang:/ # arm-linux-gcc-v

Reading specs from / usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/specs

Configured

With: / work/crosstool-0.27/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure

-- target=arm-linux

-- host=i686-host_pc- linux-gnu

-- prefix=/usr/local/arm/3.4.1

-- with-headers=/usr/local/arm/3.4.1/arm-linux/include

-- with-local- prefix=/usr/local/arm/3.4.1/arm-linux

-- disable-nls

-- enable-threads=posix

-- enable-symvers=gnu

-- enable-__cxa_atexit

-- enable-languages=c,c++

-- enable-shared

-- enable-c99

-- enable-long-long

Thread model: posix

Gcc version 3.4.1

7. Compile Hello World programs and test cross-tool chains

Write down the following Hello World program and save it as hello.c

# include

Int main (void)

{

Printf ("Hello Arm Linux Gcc!\ n")

Return 0

}

Execute the following command:

# arm-linux-gcc-o hello hello.c

Sometimes there is a warning like this:

Warning: no newline at end of file

It means that there is no newline character at the end of the text. The carriage return newline character of the Unix document is one character\ n\ r of Windows Windows is two separate\ n\ r, so the one character you edited under Windows is\ r not\ n, so the compiler thinks there is an error. Just add a new line in the file *.

If there is an error in the source program, there will be a hint, without any hint, it will be passed, and you can download it to the ARM target board to run!

Then you can enter the command of file hello to check the type of the generated hello file. It is important to note that the generated executable file can only be run under the ARM system, not on the X86 PC.

To run on the PC linux, simply execute the following command:

Gcc hello.c-o hello

. / hello

Display the print results, so that the embedded development environment has been built, so that we can easily apply it.

This is the answer to the question about how to build the SUSE 10.1 cross-compilation environment. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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

Servers

Wechat

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

12
Report