ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzalf_5.4.0.1/rzalfcompileaix.htm

173 lines
10 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Compile your AIX source" />
<meta name="abstract" content="You can install one of the AIX compiler products that support installation in i5/OS PASE to compile your programs in the i5/OS PASE environment." />
<meta name="description" content="You can install one of the AIX compiler products that support installation in i5/OS PASE to compile your programs in the i5/OS PASE environment." />
<meta name="DC.Relation" scheme="URI" content="rzalfpreparing.htm" />
<meta name="DC.Relation" scheme="URI" content="rzalfinstcomp.htm" />
<meta name="DC.Relation" scheme="URI" content="rzalfwhatispase.htm" />
<meta name="DC.Relation" scheme="URI" content="../rzalc/pase.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2000, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2000, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzalfcompileaix" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Compile your AIX source</title>
</head>
<body id="rzalfcompileaix"><a name="rzalfcompileaix"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Compile your AIX source</h1>
<div><p>You can install one of the AIX<sup>®</sup> compiler products that support installation
in <span class="keyword">i5/OS™</span> PASE to compile
your programs in the <span class="keyword">i5/OS</span> PASE
environment.</p>
<div class="section"><p>When your program uses AIX interfaces only, you compile with any
required AIX headers
and link with AIX libraries
to prepare binaries for <span class="keyword">i5/OS</span> PASE.
Keep in mind that <span class="keyword">i5/OS</span> PASE
does not support applications that are statically bound with AIX system-supplied
shared libraries.</p>
<p><span class="keyword">i5/OS</span> PASE
programs are structurally identical to AIX programs for PowerPC<sup>®</sup>.</p>
<p><span class="keyword">i5/OS</span> PASE (option 33 of the operating
system) does not include a compiler. You use an AIX system to compile <span class="keyword">i5/OS</span> PASE
programs, or you can optionally install one of the AIX compiler products that support installation
in <span class="keyword">i5/OS</span> PASE to compile
your programs in the <span class="keyword">i5/OS</span> PASE
environment.</p>
</div>
<div class="section"><h4 class="sectiontitle">Use AIX compilers on the pSeries<sup>®</sup> server</h4><p>You
can build <span class="keyword">i5/OS</span> PASE programs
using any AIX compiler
and linker that generate output that is compatible with the AIX ABI for PowerPC. <span class="keyword">i5/OS</span> PASE provides instruction
emulation support for binaries that use POWER™ architecture instructions that do
not exist in PowerPC (except
for IBM<sup>®</sup> POWER instructions
for cache management).</p>
</div>
<div class="section"><h4 class="sectiontitle">Use AIX compilers in <span class="keyword">i5/OS</span> PASE</h4><p><span class="keyword">i5/OS</span> PASE supports the installation
of the following separately available AIX compilers in the <span class="keyword">i5/OS</span> PASE
environment:</p>
<img src="./delta.gif" alt="Start of change" /><ul><li>IBM XL
C/C++ Enterprise Edition for AIX, V7.0 (5724-I11)</li>
<li>IBM XL
C Enterprise Edition for AIX, V7.0 (5724-I10)</li>
<li>IBM XL
Fortran Enterprise Edition for AIX, V9.1 (5724-I08)</li>
</ul><img src="./deltaend.gif" alt="End of change" />
<p>Using these products, you can develop, compile, build, and run your AIX applications
entirely within the <span class="keyword">i5/OS</span> PASE
environment on your iSeries™ server.</p>
</div>
<div class="section"><h4 class="sectiontitle">Development tools</h4><p>Many development
tools that you use on AIX (for example, <tt>ld</tt>, <tt>ar</tt>, <tt>make</tt>, <tt>yacc</tt>)
are included with <span class="keyword">i5/OS</span> PASE.
Many AIX tools
from other sources (for instance, the open-source tool <tt>gcc</tt>) can also
work in <span class="keyword">i5/OS</span> PASE.</p>
<p>The iSeries Tools
for Developers PRPQ (5799-PTL) also contains a wide array of tools to aid
in the development, building, and porting of iSeries applications. For more information
about this PRPQ, see the <a href="http://www.ibm.com/servers/enable/site/porting/tools/" target="_blank">IBM Virtual Innovation Center for Hardware</a> Web
site.</p>
</div>
<div class="section"><h4 class="sectiontitle">Compiler notes for handling of pointers</h4><ul><li>The <tt>xlc</tt> compiler provides limited support for
16-byte alignment (for type long double) by using the combination of <tt>-qlngdbl128</tt> and <tt>-qalign=natural</tt>.
Type <var class="varname">ILEpointer</var> requires these compiler options to ensure
that machine interface (MI) pointers are 16-byte aligned within structures.
Using option <tt>-qldbl128</tt> forces type long double to be a 128-bit type
that requires use of libc128.a to handle operations like <tt>printf</tt> for
long double fields. <p>An easy way to get option <tt>-qlngdbl128</tt> and
link with libc128.a is to use the <tt>xlc128</tt> command instead of the <tt>xlc</tt> command.</p>
</li>
<li>The <tt>xlc/xlC</tt> compiler currently does not provide a way to force
16-byte alignment for static or automatic variables. The compiler only guarantees
relative alignment for 128-bit long double fields within structures. The <span class="keyword">i5/OS</span> PASE version of <tt>malloc</tt> always
provides 16-byte aligned storage, and you can arrange 16-byte alignment of
stack storage.</li>
<li>Header file as400_types.h also relies on type <tt>long long</tt> to be
a 64-bit integer. <tt>xlc</tt> compiler option <tt>-qlonglong</tt> ensures
this geometry (which is not the default for all commands that run the <tt>xlc</tt> compiler).</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples
are intended for use when you are compiling your <span class="keyword">i5/OS</span> PASE
programs on an AIX system.
If you are using a compiler installed in <span class="keyword">i5/OS</span> PASE
to compile your programs, you do not need to specify compiler options for
the locations of <span class="keyword">i5/OS</span> system-unique
header files or <span class="keyword">i5/OS</span> system-unique
exports because these files will be found in their default path locations
of /usr/include/ and /usr/lib/ on an <span class="keyword">i5/OS</span> system.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 1</h4><p>The following command on an AIX system creates
an <span class="keyword">i5/OS</span> PASE program named <tt>testpgm</tt> that
can use i5/OS system-unique
interfaces exported by libc.a:</p>
<pre>xlc -o testpgm -qldbl128 -qlonglong -qalign=natural
-bI:/mydir/as400_libc.exp testpgm.c</pre>
<p>This example assumes
that the i5/OS system-unique
header files are copied to the AIX directory /usr/include and that the i5/OS system-unique
exports files are copied to the AIX directory /mydir.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 2</h4><p>The following example assumes i5/OS system-unique
headers and export files are in /pase/lib:</p>
<pre>xlc -o as400_test -qldbl128 -qlonglong -qalign=natural -H16
-l c128
-I /pase/lib
-bI:/pase/lib/as400_libc.exp as400_test.c</pre>
</div>
<div class="example"><h4 class="sectiontitle">Example 3</h4><p>The following example builds the same
program as example 2 with the same options; however, the <tt>xlc_r</tt> command
is used for a multithreaded program to ensure that the compiled application
links with threadsafe runtime libraries:</p>
<pre>xlc_r -o as400_test -qldbl128 -qlonglong -qalign=natural -H16
-l c128
-I /pase/lib
-bI:/pase/lib/as400_libc.exp as400_test.c</pre>
<p>In
the examples, if you are using <span class="keyword">i5/OS</span> PASE
support for IBM DB2
Universal Database™ (UDB) for iSeries call level interfaces (CLI),
you also need to specify -bI:/pase/include/libdb400.exp on your build command.</p>
<p>The
-bI directive tells the compiler to pass the parameter to the <tt>ld</tt> command.
The directive specifies an export file containing exported symbols from a
library to be imported by the application.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzalfinstcomp.htm">Install AIX compilers on i5/OS PASE</a></strong><br />
You can follow the steps in this topic to install AIX compilers
on <span class="keyword">i5/OS</span> PASE.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzalfpreparing.htm" title="The steps you need to take to prepare AIX programs that run effectively on i5/OS vary with the nature of your program and your actual needs for i5/OS system-unique interfaces and functions.">Prepare programs to run in i5/OS PASE</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rzalfwhatispase.htm" title="i5/OS PASE is an integrated runtime environment for AIX applications running on i5/OS.">What is i5/OS PASE?</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../rzalc/pase.htm">i5/OS PASE shells and utilities</a></div>
</div>
</div>
</body>
</html>