automake
[Top][All Lists]
Advanced

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

Newbie: "undefined reference" error; cannot link to existing library


From: platter
Subject: Newbie: "undefined reference" error; cannot link to existing library
Date: Sun, 03 Feb 2002 14:52:37 -0600

Hello all,

Any help on this would be very much appreciated as I am completely stuck.

I am having trouble repackaging a shared library using the Automake, libtool,
and Autoconf.  I have been able to successfully build a distribution that
installs the shared library correctly, but when I try to compile a test
program that uses the library, the following error occurs:

address@hidden newsmdi]$ gcc -g -lsmdi -o test firsttest.c
/usr/local/lib/libsmdi.so: undefined reference to `pthread_create'
collect2: ld returned 1 exit status

The shared library uses functions from the pthreads library, so I tried adding
LDADD= pthread, libsmdi_la_LTLDADD = pthread, and some other variations to
my Makefile.am, and none of them worked.

It seems that the shared library is being built but not properly linked to
the other libraries that it depends on.

Will someone please let me know what I need to do to portably link to an
existing library (Makefile.am and configure.in listed below).

Thanks in advance for the help; I have looked through the docs and searched
the net with no luck.

Thanks,

John

----- Makefile.am: 

## Process this file with automake to produce Makefile.in

lib_LTLIBRARIES = libsmdi.la
libsmdi_la_SOURCES = smdi.c aspi.linux.c
libsmdi_la_LDFLAGS = -version-info 0:5:0
libsmdi_la_LTLDADD = pthread

include_HEADERS = aspi.h smdi.h

----- configure.in

dnl Process this file with autoconf to produce a configure script.

dnl From Autoconf manual:

dnl Autoconf requirements
dnl AC_INIT(package, version, bug-report-address)
dnl information on the package
dnl checks for programs
dnl checks for libraries
dnl checks for header files
dnl checks for types
dnl checks for structures
dnl checks for compiler characteristics
dnl checks for library functions
dnl checks for system services
dnl AC_CONFIG_FILES([file...])
dnl AC_OUTPUT

AC_INIT(aspi.linux.c)
AM_INIT_AUTOMAKE(opensmdi, 0.0.5)
AM_PROG_LIBTOOL
dnl Checks for programs.

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/file.h)

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.
AC_FUNC_MEMCMP

AC_OUTPUT(Makefile)



reply via email to

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