Skip to Content.
Sympa Menu

freetds - [freetds] Compiling and using FreeTDS on Mac OS X

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Daniel Fazekas <fdsubs AT axelero.hu>
  • To: FreeTDS List <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Compiling and using FreeTDS on Mac OS X
  • Date: Sat, 06 Sep 2003 19:23:05 +0200

I'm trying to get a test environment for some of my sites up and running on Mac OS X. The last few remaining hurdles include FreeTDS, which I'd then like to use to interface with a single Microsoft SQL Server 2000 (SP3a + various hotfixes) via PHP (4.33, with the mssql extension using dblib) and sqsh.

I have no problems at all using FreeTDS to interface the very same target SQL Server (running on Windows 2000 Server) from various releases of Linux.

Getting FreeTDS to compile and work properly on Mac OS X unfortunately seems less simple. I have searched the mailing list archives and there was already some former conversation on the subject; some even having success in the end. However, that was with some really old versions, from the 0.53 era, and it looks like things are just looking worse going ahead.

Specs:
Mac OS X 10.2.6 (Jaguar) with December 2002 Developer Tools
Fink 0.5.3 is also installed with some various Unix tools missing from the former two.

gcc -v says "Apple Computer, Inc. GCC version 1175, based on gcc version 3.1 20020420 (prerelease)"

configure doesn't complain about anything, and the problems doesn't seem to matter based on what options I'm giving it (thread safety or no, etc; which was mentioned as a possible solution to some of the OS X problems in the list archives).

***

using 0.61.2, make dies after seemingly having compiled everything successfully, during the linking process:

/bin/sh ../../libtool --mode=link gcc -g -O2 -o libtds.la -rpath /usr/local/lib -version-info 2:0
:0 libtds_objects.la ../replacements/libreplacements.la
gcc -dynamiclib -flat_namespace -undefined suppress -o .libs/libtds.2.0.0.dylib -all_load ./.libs/
libtds_objects.a ../replacements/.libs/libreplacements.a ./.libs/libtds_objects.a ../replacements/.
libs/libreplacements.a -lc -install_name /usr/local/lib/libtds.2.dylib -compatibility_version 3 -current_version 3.0
ld: multiple definitions of symbol _tds_alloc_compute_results
./.libs/libtds_objects.a(mem.o) definition of _tds_alloc_compute_results in section (__TEXT,__text)
./.libs/libtds_objects.a(mem.o) definition of _tds_alloc_compute_results in section (__TEXT,__text)

And this repeated for what I suspect is every single symbol defined in FreeTDS. Over three pages of the same error message, repeating with different files and different names.

It's always libtds_object.a, the .o file varies between mem.o, token.o, util.o, login.o, read.o, write.o, convert.o, numeric.o, config.o, query.o, iconv.o, locale.o, challenge.o, threadsafe.o, vstrbuild.o, md4.o, des.o, tdsstring.o, getmac.o, atoll.o.

While most are code symbols, there's a few in data sections too, such as:
ld: multiple definitions of symbol _tds_str_empty
./.libs/libtds_objects.a(tdsstring.o) definition of _tds_str_empty in section (__DATA,__data)
./.libs/libtds_objects.a(tdsstring.o) definition of _tds_str_empty in section (__DATA,__data)

I'm not posting the whole several pages of error messages for now; because in the list archives I've seen someone already had trouble doing
that (message size limit) - and anyway, it's nothing new.

The same problem occurs with freetds-pre-utf8.tgz downloaded from freetds's current folder.

***

Using freetds-0.62.dev.20030903 from Freddy's homepage, the make process breaks even sooner, trying to compile iconv.c:

Making all in replacements
source='iconv.c' object='iconv.lo' libtool=yes \
depfile='.deps/iconv.Plo' tmpdepfile='.deps/iconv.TPlo' \
depmode=gcc /bin/sh ../../depcomp \
/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -D_FREETDS_LIBRARY_SOURCE -DTDS50 -DIODBC -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c -o iconv.lo `test -f 'iconv.c' || echo './'`iconv.c
rm -f .libs/iconv.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -D_FREETDS_LIBRARY_SOURCE -DTDS50 -DIODBC -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c iconv.c -Wp,-MD,.deps/iconv.TPlo -fno-common -DPIC -o .libs/iconv.lo
iconv.c:202: illegal expression, found `;'
cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
iconv.c: In function `iconv':
iconv.c:202: parse error before ';' token
make[2]: *** [iconv.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I have to admit I have no idea what could be causing it replacements/iconv.c has this on line 203, which looks fine to me:
return (size_t)(-1);

The same problem occurs with freetds-0.62.dev.20030814 extracted from freetds-current.tgz from freetds.org's links.

***

And the strange one: I could get freetds-0.60 to make fine following the instructions in the mailing list archives. (About specifying thread safety or just editing src/tds/asprintf.c to make some of the functions use the thread safe version unconditionally.)

"make install" went fine as well.

Still, php's make process breaks then (all's fine and working without trying to add mssql support, that is, freetds):

In file included from /usr/local/include/sybfront.h:23,
from /usr/local/include/sqlfront.h:23,
from /Users/fds/install/php/php-4.3.3/ext/mssql/php_mssql.h:36,
from main/internal_functions.c:55:
/usr/local/include/sybdb.h:97: parse error before numeric constant
/usr/local/include/sybdb.h:139: parse error before numeric constant
/usr/local/include/sybdb.h:166: parse error before numeric constant
/usr/local/include/sybdb.h:166: warning: no semicolon at end of struct or union
/usr/local/include/sybdb.h:169: parse error before '}' token
/usr/local/include/sybdb.h:169: warning: data definition has no type or storage class
/usr/local/include/sybdb.h:193: parse error before numeric constant
/usr/local/include/sybdb.h:193: warning: no semicolon at end of struct or union
/usr/local/include/sybdb.h:195: parse error before '}' token
/usr/local/include/sybdb.h:195: warning: data definition has no type or storage class
/usr/local/include/sybdb.h:204: parse error before numeric constant
/usr/local/include/sybdb.h:204: warning: no semicolon at end of struct or union
/usr/local/include/sybdb.h:217: parse error before '*' token
/usr/local/include/sybdb.h:217: warning: data definition has no type or storage class
/usr/local/include/sybdb.h:218: parse error before '*' token
/usr/local/include/sybdb.h:218: warning: data definition has no type or storage class
/usr/local/include/sybdb.h:227: parse error before '}' token
/usr/local/include/sybdb.h:227: warning: data definition has no type or storage class
/usr/local/include/sybdb.h:256: parse error before '*' token
/usr/local/include/sybdb.h:258: parse error before '*' token

And this same error message continued for every single line up until line 606, with a few (5-6) exceptions when the error message is somewhat else (not the parse error before '*' token one).


Besides, I'd much prefer to use at least 0.61... :)


Of course I'd be happy to give more information on anything needed and try any possible solution.


Any help on getting it work would be much appreciated, thanks,
--
Daniel





Archive powered by MHonArc 2.6.24.

Top of Page