Undefined References

Bug #1193628 reported by jean-christophe manciot
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
QEMU
Won't Fix
Undecided
Unassigned

Bug Description

I've been able to make qemu on ubuntu 13.04 for all last releases: 1.4.0 -> 1.5.0

Unfortunately, when I launch one of them with a Cisco ASA, it crashes inside GNS3 (latest release) for Ubuntu.
The top GNS3 developer told me they experienced similar results and advised me to use qemu 1.1.0.

The problem is that I cannot link that version. I always have these errors:

"LINK qemu-ga
qemu-timer.o: In function `dynticks_rearm_timer':
/home/actionmystique/Downloads/qemu-1.1.0/qemu-timer.c:538: undefined reference to `timer_gettime'
/home/actionmystique/Downloads/qemu-1.1.0/qemu-timer.c:551: undefined reference to `timer_settime'
qemu-timer.o: In function `dynticks_stop_timer':
/home/actionmystique/Downloads/qemu-1.1.0/qemu-timer.c:524: undefined reference to `timer_delete'
qemu-timer.o: In function `dynticks_start_timer':
/home/actionmystique/Downloads/qemu-1.1.0/qemu-timer.c:510: undefined reference to `timer_create'
collect2: error: ld returned 1 exit status
make: *** [qemu-ga] Error 1"

The man pages say we need to link with '-lrt' option, but I could not find it in the Makefile.
I do not know how to correct this issue.

Revision history for this message
Peter Maydell (pmaydell) wrote :

As you note, 1.1 is now pretty old; you will be much better off in the long run investigating why your guest OS doesn't work under current QEMU.

Revision history for this message
Michael Tokarev (mjt+launchpad-tls) wrote :

This is a change in glibc. Since version 2.17, clock_gettime() and friends were moved from -lrt to the main libc, so for linking with clock_gettime(), -lrt isn't needed anymore.

However, (old) qemu configure only checked clock_gettime(), and used other functions like timer_create() &Co above.

There was a patch:

commit 8bacde8d86a09699207d85d4bab06162aed18dc4
Author: Natanael Copa <email address hidden>
Date: Wed Sep 12 09:06:51 2012 +0000

    configure: properly check if -lrt and -lm is needed

    Fixes build against uClibc.

    uClibc provides 2 versions of clock_gettime(), one with realtime
    support and one without (this is so you can avoid linking in -lrt
    unless actually needed). This means that the clock_gettime() don't
    need -lrt. We still need it for timer_create() so we check for this
    function in addition.

    We also need check if -lm is needed for isnan().

    Both -lm and -lrt are needed for libs_qga.

which was applied past qemu-1.2, so 1.4 and 1.5 versions have it, and _should_ work fine.

Thanks,

/mjt

Revision history for this message
jean-christophe manciot (manciot-jeanchristophe) wrote :

@Peter Maydell (pmaydell): you're right, but in the meantime, I needed to find another solution.

@Michael Tokarev (mjt+launchpad-tls): Thanks a lot for your answer, it helped me pass this hindrance... to find 2 other obstacles.

Regarding the first one: I patched the two files as recommended (and added comments to the third one). There's a confusing thing though: the displayed "configure" file is very different from the one which is distributed with the 1.1.0 release, so the line numbers are not correct.
The patch needs to be done from line #2569, instead of #2673.

Anyway, I was able to continue making qemu until this error:
" LINK lm32-softmmu/qemu-system-lm32
/usr/bin/ld: milkymist-tmu2.o: undefined reference to symbol 'XFree'
/usr/bin/ld: note: 'XFree' is defined in DSO /usr/lib/i386-linux-gnu/libX11.so.6 so try adding it to the linker command line
/usr/lib/i386-linux-gnu/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [qemu-system-lm32] Error 1
make: *** [subdir-lm32-softmmu] Error 2"

I had to apply another patch to "configure" from here: http://permalink.gmane.org/gmane.comp.emulators.qemu/193007

Then I ran into another issue:
" CC cris-linux-user/signal.o
/home/actionmystique/Downloads/qemu-1.1.0/linux-user/signal.c:3479:24: error: field ‘info’ has incomplete type
make[1]: *** [signal.o] Error 1
make: *** [subdir-cris-linux-user] Error 2"

This was solved with a last patch on "linux-user/signal.c" from: http://git.qemu.org/?p=qemu.git;a=commit;h=02d2bd5d57812154cfb978bc2098cf49d551583d

And now I'm finally able to compile, link and install qemu-1.1.0 on Ubuntu 13.04 without any error! :)

N.B: I have attached the four files as tar.gz for further reference; you may want to include these new files into qemu 1.1.0.

Revision history for this message
Thomas Huth (th-huth) wrote :

QEMU 1.1.0 is not maintained anymore, so closing this as "Won't fix".

Changed in qemu:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.