This is the mail archive of the
mailing list for the GCC project.
RE: compiling g++ 3.2.3
- From: Tan-Long Phan <longp at cae dot com>
- To: "'David Edelsohn'" <dje at watson dot ibm dot com>, lrtaylor at micron dot com
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 22 Jun 2004 10:09:32 -0400
- Subject: RE: compiling g++ 3.2.3
This is the first time I'm porting my code from Linux to AIX, thankyou very
much for your greate support. I still have another problem porting my
software to AIX. On Linux, I use ioctl to get the hardware address of my
network card : ioctl(mySocket, SIOCGIFHWADDR, (char *)wInfo); and the
hardware address is returned in wInfo->ifr_hwaddr.sa_data (wInfo is a
pointer to ifreq structure). On AIX, ifr_hwaddr is not part of ifreq
anymore, is there another way to get the hardware address on AIX
Thanks & Regards
From: David Edelsohn [mailto:email@example.com]
Sent: Monday, June 21, 2004 3:54 PM
To: firstname.lastname@example.org; longp@CAE.COM
Subject: Re: compiling g++ 3.2.3
>>>>> lrtaylor writes:
Lyle> Actually, AIX has three library concepts or types on the Power
Lyle> rather than the traditional two. There are static libraries (which
Lyle> .a archive files just like those you see on many other UNIX
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
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
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.