[freetds] freeTDS configure works but make doesn't

James K. Lowden jklowden at freetds.org
Wed May 15 21:32:36 EDT 2013


On Tue, 14 May 2013 16:13:04 +0000
"Vann, David" <dvann2 at valleyhealthlink.com> wrote:

> Problem solved.
> 
> I thought for sure I had configured with LIB path settings, but this
> is what was needed.  I used both LIBPATH and LD_LIBRARY_PATH.  I
> think AIX uses LIBPATH
> 
> export OBJECT_MODE=64
> export CFLAGS=-maix64 
> export LIBPATH=/usr/local/lib
> export LD_LIBRARY_PATH=/usr/local/lib
> ./configure --prefix=/usr/local --with-unixodbc=/usr/local
> --with-tdsver=8.0 --enable-msdblib 2>&1 | tee configure.log
> 
> After that the make worked.

http://seriousbirder.com/blogs/aix-shared-and-static-libraries-explained/

http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds3%2Fld.htm

Thanks for following up with the outcome.  I'm not quite sure how that
fixed the problem, even though I'm sure you needed LIBPATH.  Let's
compare notes.  

As IBM's documentation says (a little obliquely), the value of LIBPATH,
if extant, is 

	"used as the default library path information." 
and
	"[T]he default library path information is written in the loader
section of the output file."   

IOW, LIBPATH causes the linker to embed a library search path in the
executable.  

In ELF executables, there's a place for something called the RPATH,
which is a set of paths to be searched by the runtime linker to find
shared objects.  (Many Linux distributions discourage the use of
RPATH.  Let's just say that if you control the installation directory,
RPATH will make your life simpler.)  

Most ELF-based systems -- Linux and the BSDs -- use the GNU
static linker, which sets the RPATH via the "-R" or "-rpath" option.  No
environment variable provides a default RPATH to the GNU linker.  

Entirely distinct is the -L option: it tells the static linker -- the
thing producing the executable -- where to search for libraries, both
static and dynamic. 

AIX it seems uses XCOFF, not ELF, but has a similar notion of embedding
a library search path in the executable.  Instead of -R or -rpath, the
AIX linker uses -blibpath or, in its absence, the value of LIBPATH.  

You're using --prefix=/usr/local, so you correctly have
"LIBPATH=/usr/local/lib".  That way, after "make install", when the
runtime linker loads fisql, it will consult the RPATH (equivalent) it
finds "in the output file" (i.e., the fisql binary) and will find the
library, libsybdb.a (on AIX), that provides the db-lib symbols.  (Your
linker command line also uses -L../../dblib/.libs to point the static
linker at the pre-installed library location.)  

What's confusing is that setting LIBPATH solved your build-time
problem, because LIBPATH isn't used at build-time for symbol
resolution: "LIBPATH is not used when searching for libraries that are
specified from the command line."  The linker should have found those
symbols in ../../dblib/.libs/libsybdb.a.  

LD_LIBRARY_PATH, by the way, is not a build-time variable.  It is used
only by the runtime linker; see the documentaiton for dlopen(3).  On
AIX, LIBPATH also serves to inform dlopen(3) at runtime, exactly as
LD_LIBRARY_PATH does.  

So, you needed LIBPATH, yes.  But according to the documentation I
found, the lack of LIBPATH shouldn't have prevented linking.  It would
have prevented running unless you'd set it or LD_LIBRARY_PATH at
runtime.  

HTH.  

--jkl

> 
> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
> Lowden Sent: Sunday, May 12, 2013 4:22 PM To:
> freetds at lists.ibiblio.org Subject: Re: [freetds] freeTDS configure
> works but make doesn't
> 
> On Thu, 9 May 2013 13:13:40 +0000
> "Vann, David" <dvann2 at valleyhealthlink.com> wrote:
> 
> > libtool: link: /usr/local/TDS/freetds-0.91/compile gcc
> > -D_THREAD_SAFE -maix64 -W declaration-after-statement
> > -o .libs/fisql fisql.o terminal.o edit.o handlers.o interrupt.o
> > -L/usr/local/lib -L../../dblib/.libs
> > -lsybdb ../../replacements/.libs/libreplacements.a -liconv -lcurses
> > -lreadline -lpthreads -Wl,-blibpath:/usr/local/lib:/usr/lib:/lib
> >
> > ld: 0711-317 ERROR: Undefined symbol: .dbcoltype
> > ld: 0711-317 ERROR: Undefined symbol: .dbcollen
> > ld: 0711-317 ERROR: Undefined symbol: .dbcolname
> > ld: 0711-317 ERROR: Undefined symbol: .dbdead
> > ld: 0711-317 ERROR: Undefined symbol: .dbinit
> > ld: 0711-317 ERROR: Undefined symbol: .dblogin
> 
> fisql uses db-lib, and these are db-lib symbols.  You are correctly
> linking to libsybdb; that's what "-lsybdb" does.  However, the linker
> is not finding that library, or (unlikely) the library it does find
> doesn't export those symbols.  
> 
> I would use the AIX equivalent of nm(1) to
> examine ../../dblib/.libs/libsybdb.a (if that's what it's called) to
> make sure e.g. dbinit is defined as a public symbol.  Potentially
> there's a 32-bit version in /usr/local/lib that's hiding the 64-bit
> version in your build tree.  That would explain why you can build the
> 32-bit version.  
> 
> I'm not sure why -L/usr/local/lib appears first among the -L options.
> ISTM it shouldn't be there at all, because fisql should be linked to
> the library in the build tree that will be installed when fisql is
> installed.  
> 
> HTH.  
> 
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds


More information about the FreeTDS mailing list