Frequently Asked Question to AIX 3.1 and IBM RS/6000

Frequently Asked Question to AIX 3.1 and IBM RS/6000

Post by Bjorn Engs » Sat, 07 Sep 1991 21:10:39

Frequently Asked Questions to AIX 3.1 and IBM RS/6000

This is the fifth posting of the list of Frequently Asked Questions to
AIX 3.1 and IBM RS/6000.  There are quite a number of additions and
changes - thanks to you all.

The posting is organized as a digest, so popular newsreader programs
should be able to easily look up each item - at least hitting ^G in rn
will get you the next one and rn is what I happen to use.  I added lines
of underscores before each major Subject: line to make a more legible paper
print.  If you see a From: line it means that whatever follows is mostly
an unedited version of the input I have received, and that I have not
verified its contents.  If there is no From: line, I hopefully know what
I am talking about, and the entry is probably edited entries from various
sources.  All entries are numbered with major and minor subject number, e.g.

The comp.unix.aix group is really for AIX on the four platforms, RT, PS/2, 370
and RS/6000, but it has 90% or more of its traffic covering AIX 3.1 and the
RS/6000.  The newsgroups and
have postings on the PC/RT, mostly hardware and AOS 4.3, and on PS/2
hardware respectively.  There doesn't seem to be a group covering 370

This article only covers AIX 3.1 and the RS/6000, except when specifically

If you post questions to comp.unix.aix, please be sure to indicate:

- Your machine type (not all questions are to the RS/6000)

- Your exact AIX version number, i.e. AIX 3.1 is NOT sufficient, whereas
  AIX 3.1 with the 3005 update or 3.1.5 is.

All contributors are mentioned towards the end of this article.
Subject: Contents

Contents of this list, issue 5:

1. (XLC) Is the C environment special in any way?

1-1 (XLC) I cannot make alloca work

1-2 (XLC) How do I compile my BSD programs?

1-3 (XLC) Isn't the linker different from what I am used to?

1-4 (XLC) How do I link my program with a non-shared /lib/libc.a?

1-5 (XLC) How do I make my own shared library?

1-6 (XLC) I get "binder killed by signal 9" when linking my program, why?

1-7 (XLC) What's with malloc()?

1-8 (XLC) Why does xlc complain about 'extern char *strcpy()'

1-9 (XLC) Why do I get 'Parameter list cannot contain fewer ....'

2. (XLF) Fortran

2-1 (XLF) I have problems mixing fortran and C code, why?

2-2 (XLF) How do I statically bind fortran libraries and dynamically bind
          C libraries?

3. (OS) The AIX operating system - what is it?

3-1 (OS) I am used to Unix systems programming, why should I learn SMIT?

3-2 (OS) What is the Object Database.

3-3 (OS) How do I get rid of the verbose error messages?

3-4 (OS) How do I make an informative prompt in the shell?

3-5 (OS) How do I import an /etc/passwd or /etc/group file from another box?

3-6 (OS) How do I put my own text into InfoExplorer?

3-7 (OS) Who has a termcap/terminfo source for aixterm or the HFT console?

3-8 (OS) How do I put multiple backups on a single 8mm tape?

3-9 (OS) Which release of AIX do I have?

3-10 (OS) Some known problems, telnet, accounting, who

3-11 (OS) Other hints, fsck of /, X-windows and alt-cntl-backspace

3-12 (OS) How do I shrink /usr?

3-13 (OS) How do I shrink the default paging space on hd6?

3-14 (OS) I know neither Unix nor AIX - where do I find more information?

3-15 (OS) How do I backup a multi-disk volume group?

3-16 (OS) How do I see/change system parameters like number of processes per

4. (PD) Public Domain software.

4-1 (PD) Are there any ftp sites?

4-2 (PD) GNU Emacs

4-3 (PD) GNU C

4-4 (PD) Perl

4-5 (PD) X-Windows

4-6 (PD) Bash

4-7 (PD) Elm

5. (HW) Third party hardware

5-1 (HW) Disk/Tape/SCSI

5-2 (HW) Disks.

5-3 (HW) Memory

5-4 (HW) Others
Subject: 1. (XLC) Is the C environment special in any way?

Not really.  The C compiler has quite a number of options that can be used to
control how it works, which "dialect" of C it compiles, how it interprets
certain language constructs, etc.  InfoExplorer includes a Users' Guide and
a Reference Manual.

The compiler can be invoked with either xlc to invoke it in ANSI mode and cc
to invoke it in RT (i.e. IBM 6150 with AIX 2) compatible mode.  The default
options for each mode are set in the /ect/xlc.cfg file, and you can actually add
another stanza and create a link to the /bin/xlc executable.

The file /usr/lpp/xlc/bin/README.xlc has information about the C compiler, and
the file /usr/lpp/bos/bsdport contains useful information, in particular for
users used to BSD.

Subject: 1-1. (XLC) I cannot make alloca work

A famous routine, in particular in GNU context, is the allocation routine
alloca().  Alloca allocates memory in such a way that it is automatically
free'd when the block is exited.  Most implementations does this by adjusting
the stack pointer.  Since not all C environments can support it, its use
is discouraged, but it is included in the xlc compiler.  In order to make the
compiler aware that you intend to use alloca, you must put the line

#pragma alloca

before any other statements in the C source module(s) where alloca is
called.  If you don't do this, xlc will not recognize alloca as anything
special, and you will get errors during linking.

In earlier releases of the C compiler, alloca did not work well with the
optimizer turned on (-O flag), but this problem is solved now.

Subject: 1-2. (XLC) How do I compile my BSD programs?

The file /usr/lpp/bos/bsdport contains information on how to port programs
written for BSD to AIX 3.1.  The contents of this file can actually be very
useful for others as well.

A quick cc command for most "standard" BSD programs is:

  $ cc -D_BSD -D_BSD_INCLUDES  -o [loadfile] [sourcefile.c] -lbsd

If your software has system calls predefined with no prototype parameters,
also use the -D_NO_PROTO flag.

Subject: 1-3. (XLC) Isn't the linker different from what I am used to?

Yes.  It is not at all like what you are used to:

- The order of objects and libraries is normally _not_ important.  The linker
  reads _all_ objects including those from libraries into memory and does
  the actual linking in one go.  Even if you need to put a library of your
  own twice on the ld command line on other systems, it is not needed on the
  RS/6000 - doing so will even make your linking slower.

- One of the features of the linker is that it will replace an object in an
  executable with a new version of the same object:

  $ cc -o prog prog1.o prog2.o prog3.o          # make prog
  $ cc -c prog2.c                               # recompile prog2.c
  $ cc -o prog2.o prog                 # make from prog
                                                # by replacing prog2.o

- The standard C library /lib/libc.a is linked shared, which means that the
  actual code is not linked into your program, but is loaded only once and
  linked dynamically during loading of your program.

- The ld program actually calls the socalled binder in /usr/lib/bind, and you
  can give ld special options to get details about the invocation of the binder.
  These are found on the ld man page or in InfoExplorer.

You should also have a look at section 2-2 of this article, in particular if
you have mixed Fortran/C programs.

Subject: 1-4. (XLC) How do I link my program with a non-shared /lib/libc.a?

  cc -o prog -bnoso -bI:/lib/syscalls.exp obj1.o obj2.o obj3.o

  will do that for a program consisting of the three objects obj1.o, etc.-

Subject: 1-5. (XLC) How do I make my own shared library?

  To make your own shared object or library of shared objects, you should
  know that a shared object cannot have undefined symbols.  Thus, if your
  code uses any externals from /lib/libc.a, the latter MUST be linked with
  your code to make a shared object.  Likewise, you cannot split your code
  into more than one shared object if externals in one object refer to another

  Assume you have one file, sub1.c, containing a routine with no external
  references, and another one, sub2.c, calling stuff in /lib/libc.a.  You
  will also need two export files, sub1.exp, sub2.exp.  Read the example
  below together with the examples on the ld man page.

  ---- sub1.c ----------------------------------------------------------
    int addint(int a, int b)
      return a + b;
  ---- sub2.c ----------------------------------------------------------
    #include <stdio.h>

    void printint(int a)
      printf("The integer is: %d\n", a);
  ---- sub1.exp ----------------------------------------------------------
  ---- sub2.exp ----------------------------------------------------------
  ---- usesub.c ----------------------------------------------------------
      printint( addint(5,8) );

  The following commands will build your libshr.a, and compile/link the
  program usesub to use it.  Note that you need the ld option -lc for sub2shr.o
  since it calls printf from /lib/libc.a.

  $ cc  -c sub1.c
  $ ld -o sub1shr.o sub1.o -bE:sub1.exp -bM:SRE -T512 -H512
  $ cc  -c sub2.c
  $ ld -o sub2shr.o sub2.o -bE:sub2.exp -bM:SRE -T512 -H512  -lc
  $ ar r libshr.a sub1shr.o sub2shr.o
  $ cc -o usesub usesub.c -L: libshr.a
  $ usesub
  The integer is: 13

Subject: 1-6. (XLC) I get "binder killed by signal 9" when linking my program,

Very simple, your paging space is too low.  Since the linker is quite different
from normal Unix linkers and actually does much more than these, it also uses
very much virtual memory.  It is not unusual that you need 10000 pages (of 4k)
or more to execute a fairly complex linking.

If you will or can not increase your paging space, you could try this:

- Do you duplicate libraries on the ld command line?  That is never necessary.

- Do more users ...

read more »


Frequently Asked Question to AIX 3.1 and IBM RS/6000

Post by Bjorn Engs » Sat, 07 Sep 1991 21:39:41

The new list of frequently asked questions to AIX 3.1 and IBM RS/6000 has
been posted.  The diff was too large and messy so it isn't worth posting it
as well; major changes and additions are:

- Procedures for shrinking /usr and the default paging space have been updated.

- Lot of input to mixing Fortran and C and related linker problems.

- A few more BSD compiling hints.

- Information on how to interpret IBM version number such as 03.01.0005.0012.

- Information on backup of multi-disk volume groups.

- Information on how to change system parameters like number of processes per

- List of ftp sites.

The list itself has an expiry date sometime in October - this article does

Rgds, Bjorn.
Bjorn Engsig    -    ORACLE Corporation.             | Editor of FAQ-list


Frequently Asked Question to AIX 3.1 and IBM RS/6000

Post by Bjorn Engs » Tue, 10 Sep 1991 16:53:11

Here's another short note to this:

I work for Oracle, and I can therefore not do any sort of technical support
of IBM's products.  If you have questions, post them here or ask IBM, please.

Also, I am doing this purely out of technical interests, and I am sorry
but I cannot respond to any Oracle related questions, neither on AIX nor
on other systems.  Oracle questions should be asked through your normal
Oracle channels or could be posted to the comp.databases newsgroup.

Thanks, Bjorn.
Bjorn Engsig    -    ORACLE Corporation.             | Editor of FAQ-list