Normally ".a"
does mean a static library. However, in adapting the initial report (in 2008) describing the AIX 5 shared library configuration there was some miscommunication and ".a"
was used for both static and shared libraries. That was finally corrected last year (see changelog).
AIX 4, by the way, used a much more complicated scheme, so shared libraries for ncurses were first implemented on AIX 5.
Packagers prefer shared libraries. So what you have is a shared library named libncurses.a
(legal, but not conventional). This is not created with the archiver ar
, but using the loader ld
. To see that they are different, you can try
ar tv libncurses.a
(with the appropriate directory). Likely ar
will say something like
ar: 0707-108 File libncurses.a is not an archive file.
while file
may give a more informative message:
libncurses.a: executable (RISC System/6000) or object module not stripped
You can however build ncurses from source. In that case (no matter what version), the default builds static libraries. You need not install those into the system area, but can configure ncurses using the --prefix
option to install into a different directory.
As suggested in another answer, there is a workaround using the -bdynamic
and -bstatic
options of AIX's ld
(loader), e.g., changing
xlc -o foo foo.c -lncurses
to
xlc -o foo foo.c -bstatic -lncurses -ldynamic
However, this is partly dependent upon the loader's search path and the name of the archive. If the archive is named libncurses.a
, the command works as given. If it is named libncurses.so
(as in current sources), then this command is needed to link against the shared library:
xlc -o foo foo.c -brtl -lncurses
But this command (which one might suppose to provide the static linkage using the libncurses.so
file) does not succeed:
xlc -o foo foo.c -brtl -bstatic -lncurses -bdynamic