GCC 2.95 bug on AIX 4.1
Boyce Byerly
boyce.byerly@tavve.com
Fri Apr 28 07:15:00 GMT 2000
I wanted to report a linker bug in G++, version 2.95,
specific to AIX 4.1.5. I know the compiler works fine
on Solaris 2.5, 2.5, and 2.8, Linux 6.1, and HPUX 10.20.
It's a slightly complicated bug; basically, the linker
fails to resolve symbols in cases where two libraries have
similar names, in particular a common prefix.
Here's the directory layout, simplified:
--eReporter--aix4
|
--TscView----aix4--libtscview.a
|
--gdchart0.94-aix4-libgdc.a
|
+-gd1.3--aix4-libgd.a
The eReporter directory contains a source program with a 'main'.
It must link against the TscView library (-ltscview), as it
uses some functions from there. On Solaris, that's all it needs
to do. However, on AIX, the tscview library contains some other
references to the libgdc.a library, and wants to resolve against
those symbols (it doesn't really NEED to do that, but I guess that's
a separate bug report).
In turn, libgdc.a contains symbols that are resolved by libgd.a. (This
is
the gd graphics library; gdchart0.94b is a library that does
business presentation graphics). However, I could never get
AIX to resolve those symbols. I tried moving the -lgd and -lgdc
around in the link instruction, made sure the -L's were pointing
to the right thing, and so forth. The only thing that would
work was using the 'ar' command to shove everything into one
single common library.
I found another work around this morning. If you rename the
'libgd.a' library to something else, say, 'libxxx.a', and
link against that (-lxxx) everything works fine.
I'll bet that, when you're searching through multiple
libraries to resolve symbols, somebody used a
"strncmp()" function to decide what library you're in,
and based the
"n" (length of the comparison) on the name of the
library. Thus, "libgdc.a" and "libgd.a" are
not properly distinguished from one another, and
the symbols are not found.
Overall, though, a very nice compiler; thanks
for keeping it up.
-Boyce Byerly
TAVVE Software Company
More information about the Gcc-bugs
mailing list