This is the mail archive of the
mailing list for the GCC project.
Re: compiling g++ 3.2.3
>>>>> lrtaylor writes:
Lyle> Actually, AIX has three library concepts or types on the Power platform
Lyle> rather than the traditional two. There are static libraries (which are
Lyle> .a archive files just like those you see on many other UNIX platforms),
Lyle> shared libraries (which are special .a archive files that are built in
Lyle> such as way as to be linked in dynamically at run time - as opposed to
Lyle> statically like normal .a files are), and shared objects (the
Lyle> traditional .so file). The terms "shared library" and "shared object"
Lyle> are not synonymous on AIX like they essentially are on many other UNIX
AIX treats shared libraries (an archive of shared objects) and
shared objects the same. An executable or shared object depends on a
shared object archive member of the shared library. The shared library
may contain both shared objects and non-shared objects.
".so" file extension and shared object are completely separate and
orthogonal concepts. On AIX, a shared object can have any file extension.
The AIX linker only recognizes certain extensions when one does not refer
to the entire filename (e.g., -lfoo). On AIX, ".so" file extension
normally corresponds to shared objects with the additional semantics of
runtime linking for compatibility with other Unixes. A shared object can
be named shr.o or libfoo.a or libbar.so, for example. The ".so" file
extension is a convention on AIX but does not itself imply any different
Lyle> AIX links to libraries ending in .a by default. This does not mean that
Lyle> it is linking statically by default, unless the library it finds is a
Lyle> static library. In order to tell the linker to link to .so files by
Lyle> default, you need to specify the -brtl option (for run-time linking as
Lyle> they call it). That's the option that is passed to IBM's VisualAge
Lyle> compiler, so I don't know if GCC recognizes it. If it doesn't, then you
Lyle> might try '-Wl,-brtl'.
-brtl tells the linker to look for ".so" file extension as well
and changes the semantics to runtime linking, but ".so" does not mean
runtime linking unless the developer follows the naming conventions.
GCC does not require runtime linking. GCC libstdc++ is built
runtime linking ready (with -G option), but applications do not link using
-brtl by default. It only helps in corner cases (like user overriding
One can add -Wl,-brtl to GCC link line and it will work, but it is
better to avoid those semantics unless needed.
The AIX command
$ dump -H <filename>
prints the shared library dependencies and will show if the library was
Bottom line: ".a" file extension does not mean static linking.