Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Linux Compilers and Assemblers

SEP 19, 2003 By Christopher Paul, Rafeeq Rehman. Article is provided courtesy of Prentice Hall.

3.5 Assembling a Program

GNU assembler is part of GNU binary utilities package. To get the latest binutils packages, you can download it from ftp://ftp.gnu.org/gnu/binutils/. After downloading you have to use the tar command to extract source code files. The latest version at the time of writing this chapter is 2.12 and the tar command will create a directory binutils-2.12 automatically. I have extracted it in /opt directory, so the source code directory is /opt/binutils-2.12. I created another directory /opt/binutils-build to build the package. Running the configure script is the first step towards building binary utilities package. The following sequence of commands does all of these steps.

[root@conformix /opt]# cd /opt
   [root@conformix /opt]# tar zxvf binutils-2.12.tar.gz
   [root@conformix /opt]# mkdir binutils-build
   [root@conformix /opt]# cd binutils-build/
   [root@conformix binutils-build]# ../binutils-2.12/configure --prefix=/opt/gcc-3.0.4 
      --enable-shared
   [root@conformix /opt]# make LDFLAGS=-all-static tooldir=/opt/gcc-3.0.4
   [root@conformix /opt]# make tooldir=/opt/gcc-3.0.4 install
   

Note that since we have used /opt/gcc/3.0.4 as a prefix and tooldir as the destination for installation, the binary utilities will be installed in /opt/gcc-3.0.4/bin directory. As you may have noted, I have installed all software under /opt/gcc-3.0.4 so that I can use one directory for all of my tools.


Next Section 6. Handling Warning and Error messages
© 2003 Pearson Education, Inc. InformIT Division. All rights reserved.
800 East 96th Street Indianapolis, Indiana 46240