bug-gnulib
[Top][All Lists]
Advanced

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

Re: libposix


From: Bruno Haible
Subject: Re: libposix
Date: Mon, 4 Oct 2010 21:55:26 +0200
User-agent: KMail/1.9.9

Hello Bruce,

> /bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o pt_chown pt_chown.o 
> libposix.la
> libtool: link: gcc -g -O2 -o .libs/pt_chown pt_chown.o
> ./.libs/libposix.so -Wl,-rpath -Wl,/usr/local/lib
> ./.libs/libposix.so: undefined reference to `clock_gettime'
> collect2: ld returned 1 exit status
> make[4]: *** [pt_chown] Error 1

libposix.so ought to have been linked with -lrt. I suggest two modifications:

1)   libposix_la_LDFLAGS += -no-undefined

   This should ensure that on all platforms, the linking of libposix.so will
   fail if there are undefined references. Without waiting for a program to
   be linked with libposix.

2)   libposix_la_LIBADD += $(LIB_CLOCK_GETTIME)

   Link with the library that configure has determined is needed for
   clock_gettime. And many more:

$ for m in `./posix-modules` ; do ./gnulib-tool --extract-link-directive $m ; 
done
$(ACOS_LIBM)

$(ACOSL_LIBM)

$(ASIN_LIBM)

$(ASINL_LIBM)

$(ATAN_LIBM)

$(ATAN2_LIBM)

$(ATANL_LIBM)

$(CBRT_LIBM)

$(CEIL_LIBM)

$(CEILF_LIBM)

$(CEILL_LIBM)

$(COPYSIGN_LIBM)

$(COS_LIBM)

$(COSH_LIBM)

$(ACOSL_LIBM)

$(ERF_LIBM)

$(ERFC_LIBM)

$(EXP_LIBM)

$(EXPL_LIBM)

$(FABS_LIBM)

$(LIB_EACCESS)

$(FLOOR_LIBM)

$(FLOORF_LIBM)

$(FLOORL_LIBM)

$(FMOD_LIBM)

$(FREXP_LIBM)

$(FREXPL_LIBM)

$(LIB_CLOCK_GETTIME)

$(GETADDRINFO_LIB)

$(GETHOSTNAME_LIB)

$(HYPOT_LIBM)

$(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise

$(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise


$(INET_NTOP_LIB)

$(INET_PTON_LIB)

$(J0_LIBM)

$(J1_LIBM)

$(JN_LIBM)

$(LDEXP_LIBM)

$(LDEXPL_LIBM)

$(LGAMMA_LIBM)

$(LOG_LIBM)

$(LOG10_LIBM)

$(LOG1P_LIBM)

$(LOGB_LIBM)

$(LOGL_LIBM)

$(MODF_LIBM)

$(LIB_NANOSLEEP)

$(NEXTAFTER_LIBM)

$(POW_LIBM)

$(REMAINDER_LIBM)

$(RINT_LIBM)

$(ROUND_LIBM)

$(ROUNDF_LIBM)

$(ROUNDL_LIBM)

$(LIBSOCKET)

$(SIN_LIBM)

$(SINH_LIBM)

$(SINL_LIBM)

$(SQRT_LIBM)

$(SQRTL_LIBM)

$(TAN_LIBM)

$(TANH_LIBM)

$(TANL_LIBM)

$(TRUNC_LIBM)

$(TRUNCF_LIBM)

$(TRUNCL_LIBM)

$(GETHOSTNAME_LIB)

$(LIB_CLOCK_GETTIME)

$(Y0_LIBM)

$(Y1_LIBM)

$(YN_LIBM)


The reason is that gnulib-tool does not set _LIBADD or _LDFLAGS variables.
You have to do it, based on the 'Link:' directives in the module descriptions.

Bruno



reply via email to

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