Skip to Content.
Sympa Menu

freetds - Re: [freetds] Using freetds-0.63 on AIX (4.3.3 or 5.1) with unixODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Using freetds-0.63 on AIX (4.3.3 or 5.1) with unixODBC
  • Date: Wed, 22 Mar 2006 21:55:28 -0500

John Wythe wrote:
> Comparing nm's from Linux vs AIX reveals that the symbols in question
> are exported on Linux, and not on AIX.
>
> For example when libsydbd is built, it makes reference to
> libtds_objects.la. On Linux tdsdump_open is an exported symbol from
> libsydbd, it isn't on AIX. It would appear that Linux statically
> links any code referenced in libtds_objects, and exports any of those
> symbols, therefore not requiring libsybdb.so to require libtds.so.
> Possibly the --static-libgcc causes this. On AIX the --static-libgcc is
> not recognized. It would appear that libtool is broken when it comes to
> building shared libraries that reference other shared libraries.

John,

I would like to help you get this straightened out. I don't have an AIX
system, though, and I don't have any definitive information. I might have
some leads.

First, this has been a bugaboo before. I guess you already know that the
conventional wisdom hereabouts for AIX is not to use shared libraries.
Just link everything statically (use the ./configure option) and you're
done. So I hear.

I reformatted your log and came up with the attached. I suspect "0654-206
Cannot process the symbol table" is the bad boy. Why cannot nm(1) process
libtds_objects.a? Perhaps you need GNU nm?

In case it helps, I think you're using the AIX linker. "-bnoentry"
wouldn't belong to GNU ld.

Exporting. The purpose behind using nm+grep to create libsybdb.exp is to
restrict the symbols exported i.e., to avoid polluting the namespace. If
that doesn't matter to you and your linker is happy without that option,
you might skip the process.

You're correct that libsybdb.so incorporates libtds_objects.a and doesn't
require libtds.so. It's that way now, and (I just checked) it's that way
in 0.63, too. AFAIK, the same is true for AIX. Here's my link statement:

gcc -shared .libs/dblib.o .libs/dbutil.o .libs/rpc.o .libs/bcp.o
.libs/xact.o \
-Wl,--whole-archive \
../tds/.libs/libtds_objects.a \
../replacements/.libs/libreplacements.a \
-Wl,--no-whole-archive \
-Wl,-soname \
-Wl,libsybdb.so.5 \
-Wl,-retain-symbols-file \
-Wl,.libs/libsybdb.exp \
-o .libs/libsybdb.so.5.0

Note the static library 'libtds_objects.a'. I think that, not the .la, is
what you want to add to your linker line.

To sum up:

1. ./configure --disable-shared might help
2. link in libtds_objects.a
3. libsybdb.exp is likely empty, causing no symbols to be exported. Drop
it if you don't need it, or perhaps use GNU nm(1).

HTH.

--jkl

== John's build log, reformatted ==
rm -fr .libs/libsybdb.a\
.libs/libsybdb.exp\
.libs/libsybdb.la\
.libs/libsybdb.lai\
.libs/libsybdb.so.5

generating symbol list for `libsybdb.la'

/usr/bin/nm -B -BCpg .libs/dblib.o\
.libs/dbutil.o\
.libs/rpc.o\
.libs/bcp.o\
.libs/xact.o\
../tds/.libs/libtds_objects.a\
../replacements/.libs/libreplacements.a\
|\
awk '{ if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
&& (substr($3,1,1) != ".")) { print $3 } }' \
| sort -u > .libs/libsybdb.exp

nm: ../tds/.libs/libtds_objects.a[convert.o]: 0654-206 Cannot process the
symbol table.

# mail will wrap this regex...
grep -E -e \

"^(db|bcp_|tdsdump_open|tdsdbopen|.*_xact|close_commit|open_commit|.?aspr
intf).*" \
".libs/libsybdb.exp" > ".libs/libsybdb.expT"

mv -f ".libs/libsybdb.expT" ".libs/libsybdb.exp"

gcc -shared -o .libs/libsybdb.so.5\
.libs/dblib.o\
.libs/dbutil.o\
.libs/rpc.o\
.libs/bcp.o\
.libs/xact.o\
-L/usr/lib\
-liconv -lc -lc \
-Wl,-bE:.libs/libsybdb.exp \
-Wl,-bnoentry ${wl}-berok

ar cru .libs/libsybdb.a .libs/libsybdb.so.5

creating libsybdb.la

(cd .libs && rm -f libsybdb.la && ln -s ../libsybdb.la libsybdb.la)
Target "all-am" is up to date.
Target "all" is up to date.
== end ==




Archive powered by MHonArc 2.6.24.

Top of Page