01.09.2014 Views

The Linux Development Platform Configuring, Using, and ... - Classes

The Linux Development Platform Configuring, Using, and ... - Classes

The Linux Development Platform Configuring, Using, and ... - Classes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CH03.fm Page 94 Monday, October 7, 2002 8:33 PM<br />

94 Chapter 3 • Compilers <strong>and</strong> Assemblers<br />

downloaded from the same location from which you downloaded the main glibc-<br />

2.2.5.tar.gz file. <strong>The</strong> following comm<strong>and</strong>s are used to extract files from these two<br />

archives:<br />

cd glibc-2.2.5<br />

tar zxvf ../ glibc-linuxthreads-2.2.5.tar.gz<br />

In old versions of glibc, you had to install add-ons like locale data <strong>and</strong> crypt library.<br />

<strong>The</strong>se are included in the latest version of glibc.<br />

Now you have to configure the library after creating a build directory. Basically this is the<br />

same process that you have done while installing GCC <strong>and</strong> binutils. This is done using the following<br />

set of comm<strong>and</strong>s:<br />

[root@conformix glibc-2.2.5]# mkdir build<br />

[root@conformix glibc-2.2.5]# cd build<br />

[root@conformix build]# ../configure --enable-addons=linuxthreads<br />

--prefix=/opt/gcc-3.0.4<br />

<strong>The</strong> actual compilation <strong>and</strong> testing is done using the following two comm<strong>and</strong>s:<br />

make<br />

make check<br />

<strong>The</strong> final install comm<strong>and</strong> is the following:<br />

make install<br />

This comm<strong>and</strong> will install components of GNU C library under /opt/gcc-3.0.4/<br />

lib because we had chosen /opt/gcc/3.0.4 as our prefix when we ran the configure<br />

script. Now you can set the appropriate paths in your Makefiles to use the new library.<br />

3.10 Compiling Pascal Programs<br />

Pascal programs can be converted to C language programs <strong>and</strong> then compiled in the usual way.<br />

<strong>The</strong> p2c comm<strong>and</strong> on <strong>Linux</strong> does this for you. Consider the following Pascal program<br />

hello.pas.<br />

(* Program to demonstrate Pascal compilation *)<br />

program Hello ;<br />

begin<br />

writeln ('Hello world')<br />

end.<br />

<strong>The</strong> following comm<strong>and</strong> will create a file hello.c which is the equivalent C version of<br />

the hello.pas program.<br />

[rr@conformix 4]$ p2c hello.pas<br />

Hello<br />

Translation completed.<br />

[rr@conformix 4]$

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!