* [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
@ 2011-05-10 18:16 Douglas Mencken
2011-05-20 10:07 ` Andy Wingo
0 siblings, 1 reply; 6+ messages in thread
From: Douglas Mencken @ 2011-05-10 18:16 UTC (permalink / raw)
To: bug-guile
I'm trying to build guile-v2.0.1-53-g8f6a4b2, and got the following errors:
CC guile-guile.o
CCLD guile
./.libs/libguile-2.0.so: warning: the use of `tmpnam' is dangerous,
better use `mkstemp'
./.libs/libguile-2.0.so: warning: gethostbyaddr is obsolescent, use
getaddrinfo() instead.
./.libs/libguile-2.0.so: warning: gethostbyname is obsolescent, use
getnameinfo() instead.
./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
collect2: ld returned 1 exit status
make[3]: *** [guile] Error 1
with make V=1:
Making all in libguile
make[2]: Entering directory
`/root/build-farm/guile-v2.0.1-53-g8f6a4b2.builddir/libguile'
make all-am
make[3]: Entering directory
`/root/build-farm/guile-v2.0.1-53-g8f6a4b2.builddir/libguile'
/bin/bash ../libtool --tag=CC --mode=link
powerpc-gnu-linux-uclibc-gcc -pthread -Wall -Wmissing-prototypes
-Wdeclaration-after-statement -Wswitch-enum -fvisibility=hidden -g -O2
-pthread -o guile guile-guile.o libguile-2.0.la -lcrypt -lm
libtool: link: powerpc-gnu-linux-uclibc-gcc -pthread -Wall
-Wmissing-prototypes -Wdeclaration-after-statement -Wswitch-enum
-fvisibility=hidden -g -O2 -pthread -o .libs/guile guile-guile.o
./.libs/libguile-2.0.so -L/usr/lib /usr/lib/libgc.so -lpthread
/usr/lib/libffi.so /usr/lib/libunistring.so /usr/lib/libiconv.so
/usr/lib/libgmp.so /usr/lib/libltdl.so -ldl -lcrypt -lm -pthread
./.libs/libguile-2.0.so: warning: the use of `tmpnam' is dangerous,
better use `mkstemp'
./.libs/libguile-2.0.so: warning: gethostbyaddr is obsolescent, use
getaddrinfo() instead.
./.libs/libguile-2.0.so: warning: gethostbyname is obsolescent, use
getnameinfo() instead.
./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
collect2: ld returned 1 exit status
make[3]: *** [guile] Error 1
To get clock_getcpuclockid, it is needed to link with librt, where
this symbol is present (see also
http://joysofprogramming.com/undefined-reference-to-clock_getcpuclockid/).
Current workaround:
# cd libguile/
# /bin/bash ../libtool --tag=CC --mode=link
powerpc-gnu-linux-uclibc-gcc -pthread -Wall -Wmissing-prototypes
-Wdeclaration-after-statement -Wswitch-enum -fvisibility=hidden -g -O2
-pthread -o guile guile-guile.o libguile-2.0.la -lcrypt -lm -lrt
libtool: link: powerpc-gnu-linux-uclibc-gcc -pthread -Wall
-Wmissing-prototypes -Wdeclaration-after-statement -Wswitch-enum
-fvisibility=hidden -g -O2 -pthread -o .libs/guile guile-guile.o
./.libs/libguile-2.0.so -L/usr/lib /usr/lib/libgc.so -lpthread
/usr/lib/libffi.so /usr/lib/libunistring.so /usr/lib/libiconv.so
/usr/lib/libgmp.so /usr/lib/libltdl.so -ldl -lcrypt -lm -lrt -pthread
./.libs/libguile-2.0.so: warning: the use of `tmpnam' is dangerous,
better use `mkstemp'
./.libs/libguile-2.0.so: warning: gethostbyaddr is obsolescent, use
getaddrinfo() instead.
./.libs/libguile-2.0.so: warning: gethostbyname is obsolescent, use
getnameinfo() instead.
(i.e. it builds and links; after that, guile build process can be
resumed with make in source tree)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
2011-05-10 18:16 [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid' Douglas Mencken
@ 2011-05-20 10:07 ` Andy Wingo
2011-05-20 16:49 ` Andy Wingo
2011-05-21 10:38 ` Douglas Mencken
0 siblings, 2 replies; 6+ messages in thread
From: Andy Wingo @ 2011-05-20 10:07 UTC (permalink / raw)
To: Douglas Mencken; +Cc: bug-guile
Hi Douglas,
On Tue 10 May 2011 20:16, Douglas Mencken <dougmencken@gmail.com> writes:
> To get clock_getcpuclockid, it is needed to link with librt, where
> this symbol is present
Can you check your config.log for mentions of clock_gettime ?
For example in mine I have:
configure:25329: checking for library containing clock_gettime
configure:25377: result: -lrt
configure:25389: checking for clock_gettime
configure:25389: result: yes
configure:25389: checking for clock_settime
configure:25389: result: yes
> I'm trying to build guile-v2.0.1-53-g8f6a4b2, and got the following errors:
>
> CC guile-guile.o
> CCLD guile
> ./.libs/libguile-2.0.so: warning: the use of `tmpnam' is dangerous,
> better use `mkstemp'
> ./.libs/libguile-2.0.so: warning: gethostbyaddr is obsolescent, use
> getaddrinfo() instead.
> ./.libs/libguile-2.0.so: warning: gethostbyname is obsolescent, use
> getnameinfo() instead.
> ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
> collect2: ld returned 1 exit status
> make[3]: *** [guile] Error 1
Odd. To have gotten here you had to have built libguile already, which
indeed should have linked to -lrt. Can you grep your libguile/Makefile
for LIB_CLOCK_GETTIME ?
Is it perhaps that clock_getcpuclockid is in -lrt but clock_gettime is
in your libc?
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
2011-05-20 10:07 ` Andy Wingo
@ 2011-05-20 16:49 ` Andy Wingo
2011-05-21 12:50 ` Douglas Mencken
2011-05-21 10:38 ` Douglas Mencken
1 sibling, 1 reply; 6+ messages in thread
From: Andy Wingo @ 2011-05-20 16:49 UTC (permalink / raw)
To: Douglas Mencken; +Cc: bug-guile
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
On Fri 20 May 2011 12:07, Andy Wingo <wingo@pobox.com> writes:
> Hi Douglas,
>
> On Tue 10 May 2011 20:16, Douglas Mencken <dougmencken@gmail.com> writes:
>
>> To get clock_getcpuclockid, it is needed to link with librt, where
>> this symbol is present
Does this patch fix it for you?
[-- Attachment #2: 0001-check-for-clock_getcpuclockid-in-gl_CLOCK_TIME.patch --]
[-- Type: text/plain, Size: 1567 bytes --]
From 5ad05b93a3f02be7c66fbab9c49e23ca314b7c33 Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Fri, 20 May 2011 18:48:33 +0200
Subject: [PATCH] check for clock_getcpuclockid in gl_CLOCK_TIME
* acinclude.m4 (gl_CLOCK_TIME): It could be that clock_gettime is in
libc but clock_getcpuclockid is not, so check for that explicitly.
---
acinclude.m4 | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index ba8b090..5bd1ced 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -529,8 +529,14 @@ AC_DEFUN([gl_CLOCK_TIME],
AC_SUBST([LIB_CLOCK_GETTIME])
gl_saved_libs=$LIBS
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_gettime clock_settime])
+ [if test "$ac_cv_search_clock_gettime" = "none required"; then
+ AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
+ [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
+ || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
+ [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+ else
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
+ fi])
+ AC_CHECK_FUNCS([clock_gettime clock_settime clock_getcpuclockid])
LIBS=$gl_saved_libs
])
--
1.7.5.1
[-- Attachment #3: Type: text/plain, Size: 26 bytes --]
--
http://wingolog.org/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
2011-05-20 10:07 ` Andy Wingo
2011-05-20 16:49 ` Andy Wingo
@ 2011-05-21 10:38 ` Douglas Mencken
1 sibling, 0 replies; 6+ messages in thread
From: Douglas Mencken @ 2011-05-21 10:38 UTC (permalink / raw)
To: Andy Wingo; +Cc: bug-guile
> Can you grep your libguile/Makefile for LIB_CLOCK_GETTIME ?
There's empty definition.
LIB_CLOCK_GETTIME =
> Is it perhaps that clock_getcpuclockid is in -lrt but clock_gettime is
> in your libc?
clock_gettime is in both of them:
/lib # readelf -s librt.so.0 | grep clock
42: 00001cb4 68 FUNC GLOBAL DEFAULT 6 clock_gettime
44: 00001a78 172 FUNC GLOBAL DEFAULT 6 clock_nanosleep
64: 00001b74 88 FUNC GLOBAL DEFAULT 6 clock_getcpuclockid
/lib # readelf -s libc.so.0 | grep clock
166: 0000fcf4 72 FUNC GLOBAL DEFAULT 6 clock_gettime
514: 00011868 72 FUNC GLOBAL DEFAULT 6 clock_settime
537: 0000fa84 72 FUNC GLOBAL DEFAULT 6 clock_getres
762: 0002a588 56 FUNC GLOBAL DEFAULT 6 clock
but getcpuclockid is only in librt.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
2011-05-20 16:49 ` Andy Wingo
@ 2011-05-21 12:50 ` Douglas Mencken
2011-06-17 9:18 ` Andy Wingo
0 siblings, 1 reply; 6+ messages in thread
From: Douglas Mencken @ 2011-05-21 12:50 UTC (permalink / raw)
To: Andy Wingo; +Cc: bug-guile
> + AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
> + [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
> + || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
> + [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
> Does this patch fix it for you?
Yes!
CCLD libguile-2.0.la
CC guile-guile.o
CCLD guile
./.libs/libguile-2.0.so: warning: the use of `tmpnam' is dangerous,
better use `mkstemp'
./.libs/libguile-2.0.so: warning: gethostbyaddr is obsolescent, use
getaddrinfo() instead.
./.libs/libguile-2.0.so: warning: gethostbyname is obsolescent, use
getnameinfo() instead.
flex -t ./c-tokenize.lex > c-tokenize.c || { rm c-tokenize.c; false; }
GEN c-tokenize.o
GEN guile_filter_doc_snarfage
SNARF alist.doc
...
Cool. Thank you. I hope this patch would be in mainstream.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid'
2011-05-21 12:50 ` Douglas Mencken
@ 2011-06-17 9:18 ` Andy Wingo
0 siblings, 0 replies; 6+ messages in thread
From: Andy Wingo @ 2011-06-17 9:18 UTC (permalink / raw)
To: Douglas Mencken; +Cc: bug-guile
On Sat 21 May 2011 14:50, Douglas Mencken <dougmencken@gmail.com> writes:
>> + AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
>> + [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
>> + || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
>> + [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
>> Does this patch fix it for you?
>
> Yes!
Thanks for the testing, applied to git. I also sent a mail to
bug-gnulib regarding this issue.
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-17 9:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 18:16 [build error] ./.libs/libguile-2.0.so: undefined reference to `clock_getcpuclockid' Douglas Mencken
2011-05-20 10:07 ` Andy Wingo
2011-05-20 16:49 ` Andy Wingo
2011-05-21 12:50 ` Douglas Mencken
2011-06-17 9:18 ` Andy Wingo
2011-05-21 10:38 ` Douglas Mencken
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).