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

Re: [Xen-devel] [Qemu-devel] [PATCH] build: add needed missing libraries libm and librt



On Wed, Feb 8, 2012 at 17:06, Roger Pau Monne <roger.pau@xxxxxxxxxxxxx> wrote:
> libm is used in cutils.c, but the library was not specified
> when linking some binaries, throwing the following error:
>
> cutils.o: In function `strtosz_suffix_unit':
> /home/royger/xen-clean/tools/qemu-xen-dir/cutils.c:354: undefined
> reference to `__isnan'
> /home/royger/xen-clean/tools/qemu-xen-dir/cutils.c:357: undefined
> reference to `modf'
> collect2: ld returned 1 exit status
>
> According to modf man page [0], -lm should be used when linking.
>
> librt is used in qemu-time.c, but again the library was not specified
> at link time, throwing the following error:
>
> /home/royger/xen-clean/tools/qemu-xen-dir/qemu-timer.c:597: undefined
> reference to `timer_gettime'
> /home/royger/xen-clean/tools/qemu-xen-dir/qemu-timer.c:610: undefined
> reference to `timer_settime'
> ../qemu-timer.o: In function `dynticks_start_timer':
> /home/royger/xen-clean/tools/qemu-xen-dir/qemu-timer.c:565: undefined
> reference to `timer_create'
> ../qemu-timer.o: In function `dynticks_stop_timer':
> /home/royger/xen-clean/tools/qemu-xen-dir/qemu-timer.c:583: undefined
> reference to `timer_delete'
> collect2: ld returned 1 exit status
>
> According to timer_getttime man page [1], -lrt should be used when
> linking.
>
> [0] http://linux.die.net/man/3/modf
> [1] http://linux.die.net/man/2/timer_gettime

This is Linux man page, is this correct for all OS we support?

We already have a test for -lrt in configure, but it looks like it
does not detect your case correctly. You should fix that instead.

> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
> ---
> ÂMakefile    Â|  Â4 ++--
> ÂMakefile.target | Â Â2 ++
> Â2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 301c75e..e2c3cd4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -34,7 +34,7 @@ configure: ;
>
> Â$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
>
> -LIBS+=-lz $(LIBS_TOOLS)
> +LIBS+=-lz -lm -lrt $(LIBS_TOOLS)
>
> Âifdef BUILD_DOCS
> ÂDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 
> QMP/qmp-commands.txt
> @@ -170,7 +170,7 @@ test-coroutine: test-coroutine.o qemu-timer-common.o 
> async.o $(coroutine-obj-y)
> Â$(qapi-obj-y): $(GENERATED_HEADERS)
> Âqapi-dir := $(BUILD_DIR)/qapi-generated
> Âtest-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I 
> $(qapi-dir)
> -qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
> +qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) -lm
>
> Â$(qapi-dir)/test-qapi-types.c $(qapi-dir)/test-qapi-types.h :\
> Â$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
> diff --git a/Makefile.target b/Makefile.target
> index a111521..95d6bc0 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -33,6 +33,8 @@ endif
> ÂPROGS=$(QEMU_PROG)
> ÂSTPFILES=
>
> +LIBS+=-lrt
> +
> Âifndef CONFIG_HAIKU
> ÂLIBS+=-lm
> Âendif
> --
> 1.7.9
>
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.