Skip to Content.
Sympa Menu

freetds - [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: "John Wythe" <jwythe AT silksystems.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Using freetds-0.63 on AIX (4.3.3 or 5.1) with unixODBC
  • Date: Tue, 21 Mar 2006 18:41:16 -0800

I have searched the web, and this archive for info on compiling and running
freetds with unixODBC on AIX. There seems to be a number of posts regarding
AIX 4.3.4 and 5.1.
None seem give a definitive answer on how to do this.

Both AIX system give the same error during make about not being able to link
freebcp due to an undefined symbol (.tdsdump_open). I am trying to do the
same thing, and am getting the same results.

I managed to get past the above error by adding the libtds_objects.la, and
the libreplacements.la to the _LDADD entry for freebcp. defncopy, and bsqldb
also have the same problem, as well as tdspool, and tdssrv. After what
appears to be a successful configure and make, tsql works, but isql doesn't
(gets segmentation fault).

At first I thought this was a problem with shared libraries on AIX, and maybe
a problem with libtool. After loading gdb for AIX, I managed to locate the
source of the seg fault.
Much to my suprise gdb reported the location as being inside odbc.c in
freetds, not as I would have thought at the point that unixODBC tried to call
freetds.

It would appear that a call to tds_alloc_context inside _SQLAllocEnv is
causing the seg fault. It then occured to me that maybe the libraries were
being built with unresolved symbols much the same as freebcp, but that the
-Wl,berok was letting it go. I went and did a make in just the dblib, and
tds directories. Both report a problem generating the symbol list, neither
causes the make to fail, see ouput below.

Could this be the source of all the undefined symbols with freebcp, defncopy,
bsqldb, etc?
Could it also be the reason for the seg fault?

I have done nm's on libtds.a and libtdsodbc.a, all seems fine, although I
haven't done a thorough analysis, I suppose I should look for
tds_alloc_context.
Also I will try nm on libtds_objects.a.

In case anyone else is wondering, in order for unixODBC to work it requires a
shared (.so) file. As I have found out AIX puts both the static and shared
libraries in the .a file.
I had to extract the .so using (ar -xv libtdsodbc.a). I did the same for
libtds.a, libtdssrv.a, but that didn't fix the seg fault issue.

John

FROM dblib

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.
grep -E -e
"^(db|bcp_|tdsdump_open|tdsdbopen|.*_xact|close_commit|open_commit|.?
asprintf).*" ".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
.li
bs/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.

FROM tds

/bin/sh ../../libtool --mode=link gcc -g -O2 -L/usr/lib -o
libtds.la
-rpath /usr/lib -version-info 4:0:0 -export-symbols-regex
'^(tds_|tdsdump_|tds5_
|tds7_).*' libtds_objects.la ../replacements/libreplacements.la -liconv
-stati
c-libgcc -lc
generating symbol list for `libtds.la'
/usr/bin/nm -B -BCpg ./.libs/libtds_objects.a
../replacements/.libs/libreplace
ments.a | awk '{ if ((($2 == "T") || ($2 == "D") || ($2 == "B")) &&
(substr($3,1
,1) != ".")) { print $3 } }' | sort -u > .libs/libtds.exp
nm: ./.libs/libtds_objects.a[convert.o]: 0654-206 Cannot process the symbol
tabl
e.
grep -E -e "^(tds_|tdsdump_|tds5_|tds7_).*" ".libs/libtds.exp" >
".libs/libtds.e
xpT"
mv -f ".libs/libtds.expT" ".libs/libtds.exp"
gcc -shared -o .libs/libtds.so.4 -L/usr/lib -liconv -lc -lc
-Wl,-bE:.libs/li
btds.exp -Wl,-bnoentry ${wl}-berok
ar cru .libs/libtds.a .libs/libtds.so.4
creating libtds.la
(cd .libs && rm -f libtds.la && ln -s ../libtds.la libtds.la)
Target "all-am" is up to date.
Target "all" is up to date.







John Wythe, Systems Programmer

Phone: (800) 663-0718

Fax: (604) 468-1667

jwythe AT silksystems.com




Attachment: silk_signature.jpg
Description: JPEG image




Archive powered by MHonArc 2.6.24.

Top of Page