[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with static linking?

From: Micheal Smith
Subject: Issue with static linking?
Date: Mon, 15 Sep 2008 16:23:57 -0500
User-agent: Thunderbird (X11/20080807)

Hey. I'm not sure if this is more of a libtool issue, or an automake issue. I have some code that relies on libresolv to do mx lookups. This code uses functions within that library that are not exported unless compiled with the -static flag. The issue is that I also require libraries such as pam. That hiccup when compiled under that flag. Anyway, my solution was to compile my mxresolver as a libtool library compiled with the -static flag and then include it into my program via LDADD. My follows:

libmxresolv_la_SOURCES = mxresolver.c
libmxresolv_la_LDFLAGS = -static
include_HEADERS = mxresolver.h

bin_PROGRAMS = program

program_CPPFLAGS = \

program_SOURCES = main-inc.h main.c auth.c crypto.c errors.c \
                                 htable.c interface.c llist.c logging.c \
                                 smtplib.c socklib.c
dmailer_LDADD =

This has not done what I expected however. When I try to compile this I still get the undefined reference errors shown below.

gcc -g -O2 -o program main.o auth.o crypto.o errors.o htable.o interface.o llist.o logging.o smtplib.o socklib.o ./.libs/libmxresolv.a -lssl -lpthread -lpam ./.libs/libmxresolv.a(mxresolver.o): In function `mx_lookup':
undefined reference to `__ns_initparse'
undefined reference to `__ns_parserr'
undefined reference to `__ns_name_uncompress'

Any insights as to a possible solution would be greatly appreciated.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]