Skip to Content.
Sympa Menu

freetds - Re: [freetds] compiling tsql

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] compiling tsql
  • Date: Sat, 26 May 2007 13:49:06 -0400

Tim Goossens wrote:
> Is tsql.o merely build out of tsql.c and the headers files mentioned in
> tsql.c?

Except for rare #include tricks, a .o file always has one and only one .c
antecedant.

Here's a command line to compile tsql in build/src/apps (a directory you'd
have to create yourself):

gcc -DHAVE_CONFIG_H \
-I. \
-I../../../src/apps \
-I../../../include \
-I../../include \
-I/usr/pkg/include \
-D_FREETDS_LIBRARY_SOURCE \
-DDEBUG=1 \
-g \
-O2 \
-o tsql \
-static \
-L/usr/pkg/lib \
-L../tds/.libs \
-L../replacements/.libs \
../../../src/apps/tsql.c \
-lreadline \
-ltds \
-lreplacements \
-ltermcap

gcc will compile and link in one step; to compile only (creating tsql.o),
add -c to the above.

This command links statically. If you want dynamic linking, you have to
either embed the RPATH in the executable or otherwise tell the runtime
linker where the shared objects are to be found.

This command uses the configure-generated config.h. You can trim config.h
considerably, but if you try to do without it altogether, you'll find
tsql.c relies heavily on #if tests for header files and some other
functionality. You can safely remove readline (readline is why I add
/usr/pkg to my include and link paths). I think readline is what creates
the dependency on libtermcap, btw.

> Anyway, I am really grateful for your help and I have learned allot
> reading this list.

Always a good thing. You're welcome.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page