public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking on AIX
@ 2005-08-15 21:36 John Ling
  2005-08-16  3:35 ` David Edelsohn
  0 siblings, 1 reply; 9+ messages in thread
From: John Ling @ 2005-08-15 21:36 UTC (permalink / raw)
  To: gcc-help

Hello I am having problems linking using GCC on AIX 5.2.0.0.

Here is my problem.  Even though I am pointing to the library called 
libubic.a, it is unable to resolve the references within that library. 
I think the libuic.a is good as the names to these references show up 
when i use the dump command on the libubic.a library.  Does anyone know 
why and how I can get the compilation to read this library?

g++ -g -O2 -o bin/tax2seq atlas/cpp/src/apps/tax2seq.o  -Llib/.libs 
-lseqget /usr/local/mysql/lib/libmysqlclient.a 
/flash/home/jling/install/lib/libubic.a -lz 
-Wl,-blibpath:/space/home/jling/atlas/lib/.libs:/flash/home/jling/install/lib:/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2:/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/../../..:/usr/lib:/lib
ld: 0711-317 ERROR: Undefined symbol: .TaxGet::TaxGet[in-charge](char 
const*)
ld: 0711-317 ERROR: Undefined symbol: 
.TaxGet::getTaxonId(std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >)
ld: 0711-317 ERROR: Undefined symbol: .TaxGet::taxonId2Taxtree(int)
ld: 0711-317 ERROR: Undefined symbol: 
.Tax::loadTaxonIdList(std::list<int, std::allocator<int> >&)
ld: 0711-317 ERROR: Undefined symbol: .MysqlDb::~MysqlDb [not-in-charge]()
ld: 0711-317 ERROR: Undefined symbol: .Tax::~Tax [in-charge]()
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.
collect2: ld returned 8 exit status
make: *** [bin/tax2seq] Error 1


Thanks,
John Ling

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-15 21:36 Linking on AIX John Ling
@ 2005-08-16  3:35 ` David Edelsohn
  2005-08-16 17:42   ` John Ling
  0 siblings, 1 reply; 9+ messages in thread
From: David Edelsohn @ 2005-08-16  3:35 UTC (permalink / raw)
  To: John Ling; +Cc: gcc-help

>>>>> John Ling writes:

> Does anyone know why and how I can get the compilation to read this
> library?

	Is the library a shared library?  If so, are the symbols exported
from the library?

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-16  3:35 ` David Edelsohn
@ 2005-08-16 17:42   ` John Ling
  2005-08-16 17:54     ` David Edelsohn
  0 siblings, 1 reply; 9+ messages in thread
From: John Ling @ 2005-08-16 17:42 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-help

Actually though I am hoping for shared libraries but I am uncertain if 
they are actually being installed.  During my build I do have a file 
named ./lib/.libs/libubic.so.0 that is created within my source directory.

However, I am trying to link to the libraries in the install directory 
outside this source directory.  In the install directory I have 
lib/libubic.a and lib/libubic.la.

Did the shared component not get installed properly?  i.e. should I 
expect the file libubic.so.0 to be installed along with libubic.a and 
libubuic.la?  How can I tell whether the symbols are exported from the 
library?

Thanks,
John Ling



David Edelsohn wrote:
>>>>>>John Ling writes:
> 
> 
>>Does anyone know why and how I can get the compilation to read this
>>library?
> 
> 
> 	Is the library a shared library?  If so, are the symbols exported
> from the library?
> 
> David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-16 17:42   ` John Ling
@ 2005-08-16 17:54     ` David Edelsohn
  2005-08-16 18:35       ` John Ling
  0 siblings, 1 reply; 9+ messages in thread
From: David Edelsohn @ 2005-08-16 17:54 UTC (permalink / raw)
  To: John Ling; +Cc: gcc-help

>>>>> John Ling writes:

John> Actually though I am hoping for shared libraries but I am uncertain if 
John> they are actually being installed.  During my build I do have a file 
John> named ./lib/.libs/libubic.so.0 that is created within my source directory.

John> However, I am trying to link to the libraries in the install directory 
John> outside this source directory.  In the install directory I have 
John> lib/libubic.a and lib/libubic.la.

John> Did the shared component not get installed properly?  i.e. should I 
John> expect the file libubic.so.0 to be installed along with libubic.a and 
John> libubuic.la?  How can I tell whether the symbols are exported from the 
John> library?

	Traditional AIX shared libraries are achives of shared objects.
If you look at the archive with "ar tv" or the AIX "dump -H" command, you
should see the shared object .so file as a member of the archive.

	The GCC C++ ABI name mangling prepends an underscore to symbols.
AIX's default behavior for exporting symbols from shared libaries does not
export symbols with prepended underscores.  You probably need to
explicitly create an export list of the symbols that should be exported
from the shared object inside the archive library.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-16 17:54     ` David Edelsohn
@ 2005-08-16 18:35       ` John Ling
  2005-08-16 19:02         ` David Edelsohn
  0 siblings, 1 reply; 9+ messages in thread
From: John Ling @ 2005-08-16 18:35 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-help

I tried "ar tv" on libubic.a and I get what I think is correct:

rwxr-xr-x  1409/105   7391044 Aug 16 10:59 2005 libubic.so.0
rw-r--r--  1409/105   210082 Aug 02 10:56 2005 Fasta.o
rw-r--r--  1409/105   293687 Aug 02 10:56 2005 FastaLoader.o
rw-r--r--  1409/105   332056 Aug 02 10:56 2005 Dbrc.o
rw-r--r--  1409/105   237825 Aug 02 10:56 2005 MysqlDb.o
rw-r--r--  1409/105   309442 Aug 02 10:56 2005 Tax.o
rw-r--r--  1409/105    69525 Aug 02 10:56 2005 TaxonIdName.o
rw-r--r--  1409/105    93349 Aug 02 10:56 2005 TaxGet.o
rw-r--r--  1409/105      648 Aug 02 10:56 2005 Tclap.o
rw-r--r--  1409/105   265350 Aug 02 10:56 2005 Stats.o
rw-r--r--  1409/105    81579 Aug 02 10:56 2005 StatsDb.o

Yet, libubic.a remains in the hidden directory lib/.libs which I would 
have expected to have been included with the installed library 
libubic.a.  This seems odd to me and make me wonder how libubic.a can 
find this .so file.  I tried to copy it into the install directory along 
with the installed libubuic.a but without any change to my linking problem.

Also in this hidden directory is libubic.exp.  A good chunk of this file 
contains names prepended with underscores, such as 
"_Allocate__3stdHc_UlPc_Pc", but there are other names without an 
underscore such as "TaxonId__11TaxonIdNameCFv".
Is this the export list that you suggest I modify/create?

Much appreciated,

John Ling

David Edelsohn wrote:
> 
> 	Traditional AIX shared libraries are achives of shared objects.
> If you look at the archive with "ar tv" or the AIX "dump -H" command, you
> should see the shared object .so file as a member of the archive.
> 
> 	The GCC C++ ABI name mangling prepends an underscore to symbols.
> AIX's default behavior for exporting symbols from shared libaries does not
> export symbols with prepended underscores.  You probably need to
> explicitly create an export list of the symbols that should be exported
> from the shared object inside the archive library.
> 
> David
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-16 18:35       ` John Ling
@ 2005-08-16 19:02         ` David Edelsohn
  2005-08-17 17:45           ` John Ling
  0 siblings, 1 reply; 9+ messages in thread
From: David Edelsohn @ 2005-08-16 19:02 UTC (permalink / raw)
  To: John Ling; +Cc: gcc-help

>>>>> John Ling writes:

John> I tried "ar tv" on libubic.a and I get what I think is correct:

John> rwxr-xr-x  1409/105   7391044 Aug 16 10:59 2005 libubic.so.0
John> rw-r--r--  1409/105   210082 Aug 02 10:56 2005 Fasta.o
John> rw-r--r--  1409/105   293687 Aug 02 10:56 2005 FastaLoader.o
John> rw-r--r--  1409/105   332056 Aug 02 10:56 2005 Dbrc.o
John> rw-r--r--  1409/105   237825 Aug 02 10:56 2005 MysqlDb.o
John> rw-r--r--  1409/105   309442 Aug 02 10:56 2005 Tax.o
John> rw-r--r--  1409/105    69525 Aug 02 10:56 2005 TaxonIdName.o
John> rw-r--r--  1409/105    93349 Aug 02 10:56 2005 TaxGet.o
John> rw-r--r--  1409/105      648 Aug 02 10:56 2005 Tclap.o
John> rw-r--r--  1409/105   265350 Aug 02 10:56 2005 Stats.o
John> rw-r--r--  1409/105    81579 Aug 02 10:56 2005 StatsDb.o

	This is incorrect.  It looks like the library contains both shared
object and static objects.  You should build one other the other, not
both. 

John> Yet, libubic.a remains in the hidden directory lib/.libs which I would 
John> have expected to have been included with the installed library 
John> libubic.a.  This seems odd to me and make me wonder how libubic.a can 
John> find this .so file.  I tried to copy it into the install directory along 
John> with the installed libubuic.a but without any change to my linking problem.

	Your actions are incorrect.  Do not install the .so file.  The .so
file should be archived, as is occurring.

John> Also in this hidden directory is libubic.exp.  A good chunk of this file 
John> contains names prepended with underscores, such as 
John> "_Allocate__3stdHc_UlPc_Pc", but there are other names without an 
John> underscore such as "TaxonId__11TaxonIdNameCFv".
John> Is this the export list that you suggest I modify/create?

	If the export file already is being created, that's fine.  The
problem may be the two different objects in the archive.  You probably
should use --disable-shared or --disable-static when configuring libtool.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-16 19:02         ` David Edelsohn
@ 2005-08-17 17:45           ` John Ling
  2005-08-17 17:48             ` David Edelsohn
  0 siblings, 1 reply; 9+ messages in thread
From: John Ling @ 2005-08-17 17:45 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-help

Ok having attempted to build both static and shared was the problem.  I 
opted to build only static by configuring with --disable-shared and so I 
believe it build the static version of the library.  Now when I do an 
'ar tv' on my static library I get nothing returned.  Is this normal?

Unfortunately, when I try to compile using this library I get the following:

g++ -g -O2 -o bin/ac2gi atlas/cpp/src/apps/ac2gi.o 
lib/.libs/libseqget.a /usr/local/mysql/lib/libmysqlclient.a 
/flash/home/jling/install/lib/libubic.a -lz
collect2: /flash/home/jling/install/lib/libubic.a: not a COFF file
make: *** [bin/ac2gi] Error 1

What does it take to get that library into COFF format?

Thank You,
John Ling

David Edelsohn wrote:
>>>>>>John Ling writes:
> 
> 
> John> I tried "ar tv" on libubic.a and I get what I think is correct:
> 
> John> rwxr-xr-x  1409/105   7391044 Aug 16 10:59 2005 libubic.so.0
> John> rw-r--r--  1409/105   210082 Aug 02 10:56 2005 Fasta.o
> John> rw-r--r--  1409/105   293687 Aug 02 10:56 2005 FastaLoader.o
> John> rw-r--r--  1409/105   332056 Aug 02 10:56 2005 Dbrc.o
> John> rw-r--r--  1409/105   237825 Aug 02 10:56 2005 MysqlDb.o
> John> rw-r--r--  1409/105   309442 Aug 02 10:56 2005 Tax.o
> John> rw-r--r--  1409/105    69525 Aug 02 10:56 2005 TaxonIdName.o
> John> rw-r--r--  1409/105    93349 Aug 02 10:56 2005 TaxGet.o
> John> rw-r--r--  1409/105      648 Aug 02 10:56 2005 Tclap.o
> John> rw-r--r--  1409/105   265350 Aug 02 10:56 2005 Stats.o
> John> rw-r--r--  1409/105    81579 Aug 02 10:56 2005 StatsDb.o
> 
> 	This is incorrect.  It looks like the library contains both shared
> object and static objects.  You should build one other the other, not
> both. 
> 
> John> Yet, libubic.a remains in the hidden directory lib/.libs which I would 
> John> have expected to have been included with the installed library 
> John> libubic.a.  This seems odd to me and make me wonder how libubic.a can 
> John> find this .so file.  I tried to copy it into the install directory along 
> John> with the installed libubuic.a but without any change to my linking problem.
> 
> 	Your actions are incorrect.  Do not install the .so file.  The .so
> file should be archived, as is occurring.
> 
> John> Also in this hidden directory is libubic.exp.  A good chunk of this file 
> John> contains names prepended with underscores, such as 
> John> "_Allocate__3stdHc_UlPc_Pc", but there are other names without an 
> John> underscore such as "TaxonId__11TaxonIdNameCFv".
> John> Is this the export list that you suggest I modify/create?
> 
> 	If the export file already is being created, that's fine.  The
> problem may be the two different objects in the archive.  You probably
> should use --disable-shared or --disable-static when configuring libtool.
> 
> David
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-17 17:45           ` John Ling
@ 2005-08-17 17:48             ` David Edelsohn
  2005-08-18 19:16               ` John Ling
  0 siblings, 1 reply; 9+ messages in thread
From: David Edelsohn @ 2005-08-17 17:48 UTC (permalink / raw)
  To: John Ling; +Cc: gcc-help

>>>>> John Ling writes:

John> Ok having attempted to build both static and shared was the problem.  I 
John> opted to build only static by configuring with --disable-shared and so I 
John> believe it build the static version of the library.  Now when I do an 
John> 'ar tv' on my static library I get nothing returned.  Is this normal?

John> Unfortunately, when I try to compile using this library I get the following:

John> g++ -g -O2 -o bin/ac2gi atlas/cpp/src/apps/ac2gi.o 
John> lib/.libs/libseqget.a /usr/local/mysql/lib/libmysqlclient.a 
John> /flash/home/jling/install/lib/libubic.a -lz
John> collect2: /flash/home/jling/install/lib/libubic.a: not a COFF file
John> make: *** [bin/ac2gi] Error 1

John> What does it take to get that library into COFF format?

	"not a COFF file" in this instance probably means that it's
empty.  When you built the library, where did it actually load the object
files? 

	It is better to avoid libtool for exactly these types of problems.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linking on AIX
  2005-08-17 17:48             ` David Edelsohn
@ 2005-08-18 19:16               ` John Ling
  0 siblings, 0 replies; 9+ messages in thread
From: John Ling @ 2005-08-18 19:16 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-help

Ok thank you.  I have just removed the Libtool references during my 
builds on the AIX platform.  But I'm opting to keep Libtool in my 
package for now.

Certainly, this quirk with Libtool on AIX is not particularly pleasant.

Thanks,
John Ling

David Edelsohn wrote:
>>>>>>John Ling writes:
> 
> 
> John> Ok having attempted to build both static and shared was the problem.  I 
> John> opted to build only static by configuring with --disable-shared and so I 
> John> believe it build the static version of the library.  Now when I do an 
> John> 'ar tv' on my static library I get nothing returned.  Is this normal?
> 
> John> Unfortunately, when I try to compile using this library I get the following:
> 
> John> g++ -g -O2 -o bin/ac2gi atlas/cpp/src/apps/ac2gi.o 
> John> lib/.libs/libseqget.a /usr/local/mysql/lib/libmysqlclient.a 
> John> /flash/home/jling/install/lib/libubic.a -lz
> John> collect2: /flash/home/jling/install/lib/libubic.a: not a COFF file
> John> make: *** [bin/ac2gi] Error 1
> 
> John> What does it take to get that library into COFF format?
> 
> 	"not a COFF file" in this instance probably means that it's
> empty.  When you built the library, where did it actually load the object
> files? 
> 
> 	It is better to avoid libtool for exactly these types of problems.
> 
> David

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-08-18 19:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-15 21:36 Linking on AIX John Ling
2005-08-16  3:35 ` David Edelsohn
2005-08-16 17:42   ` John Ling
2005-08-16 17:54     ` David Edelsohn
2005-08-16 18:35       ` John Ling
2005-08-16 19:02         ` David Edelsohn
2005-08-17 17:45           ` John Ling
2005-08-17 17:48             ` David Edelsohn
2005-08-18 19:16               ` John Ling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).