From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryn2M-0003CR-53 for qemu-devel@nongnu.org; Sat, 18 Feb 2012 11:21:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ryn2K-0002mm-9E for qemu-devel@nongnu.org; Sat, 18 Feb 2012 11:21:25 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39604 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryn2J-0002mH-VI for qemu-devel@nongnu.org; Sat, 18 Feb 2012 11:21:24 -0500 Message-ID: <4F3FD001.4070703@suse.de> Date: Sat, 18 Feb 2012 17:21:21 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1328720797-29857-1-git-send-email-roger.pau@entel.upc.edu> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] build: add needed missing libraries libm and librt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roger Pau Monne Cc: Blue Swirl , qemu-devel@nongnu.org, xen-devel@lists.xen.org Am 18.02.2012 09:24, schrieb Blue Swirl: > On Wed, Feb 8, 2012 at 17:06, Roger Pau Monne = 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 >=20 > This is Linux man page, is this correct for all OS we support? No, not for Haiku or Mac OS X. > 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. >=20 >> Signed-off-by: Roger Pau Monne >> --- >> 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+=3D-lz $(LIBS_TOOLS) >> +LIBS+=3D-lz -lm -lrt $(LIBS_TOOLS) NACK. You need to make sure it either lands in $(LIBS_TOOLS) or is added via a new variable with host-dependent contents. >> >> ifdef BUILD_DOCS >> DOCS=3Dqemu-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 :=3D $(BUILD_DIR)/qapi-generated >> test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS +=3D= -I $(qapi-dir) >> -qemu-ga$(EXESUF): LIBS =3D $(LIBS_QGA) >> +qemu-ga$(EXESUF): LIBS =3D $(LIBS_QGA) -lm NACK. Either needs to do LIBS +=3D or must go in $(LIBS_QGA) or new conditionalized variable. >> >> $(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=3D$(QEMU_PROG) >> STPFILES=3D >> >> +LIBS+=3D-lrt >> + >> ifndef CONFIG_HAIKU >> LIBS+=3D-lm >> endif Here's the special treatment that avoids adding -lm on Haiku host because it doesn't have a libm.so (git-blame would've told you it's in libroot.so there); on Darwin there's a compatibility symlink but it's in libSystem.dylib actually and an ifndef would be appropriate as well. POSIX does not mandate -lm for math functions. Would moving this snippet to Makefile.objs help? What system are you on anyway and are you actually using upstream qemu.git? openSUSE 12.1 does not complain, and without a test case it's hard to find a solution here. Andreas >> -- >> 1.7.9 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg