Skip to contentSkip to conversation

Gentoo & qemu & non-static build

Qemu-devel New [email protected] 6 participants 7 messages Apr 4, 2004 – Apr 15, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I cannot get qemu to build on Gentoo ~x86. Is has to do with the known problem that alsa-lib is not build staticly, and therefore libsdl.a cannot be linked to, and therefore qemu cannot be build staticly also.

Output in that case:

...
gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil /usr/lib/libSDL.a(SDL_x11gl.o)(.text+0x90a): In function `X11_GL_LoadLibrary':
: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound
collect2: ld returned 1 exit status
make[1]: *** [qemu-fast] Error 1
make[1]: Leaving directory `/home/rutger/download/qemu-0.5.3/i386'

The problem on the qemu side is that I cannot get qemu to build non-staticly. I tried './configure --no-static', which gives 'static build no' (but then again, that's no different from when I remove the --no-static), but the build command still fails. It ends different however, with:

...
gcc -Wall -O2 -g -fomit-frame-pointer -g -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386.ld i386 ../dyngen.c -o ../dyngen
gcc: i386: No such file or directory
make: *** [../dyngen] Error 1
make: Leaving directory `/home/rutger/download/qemu-0.5.3/i386'

Anyone any idea on how to build qemu dynamically?

Regards,
Rutger.

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#1 lore raw
Quoted 10 lines · On Sun, Apr 04, 2004 at 10:11:19PM +0200, [email protected] wrote:

Hi,

I cannot get qemu to build on Gentoo ~x86. Is has to do with the known problem that alsa-lib is not build staticly, and therefore libsdl.a cannot be linked to, and therefore qemu cannot be build staticly also.

Output in that case:

...
gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

Try using this command instead:

gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -shared -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

It worked for me.

Quoted 8 lines

/usr/lib/libSDL.a(SDL_x11gl.o)(.text+0x90a): In function `X11_GL_LoadLibrary':
: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound
collect2: ld returned 1 exit status
make[1]: *** [qemu-fast] Error 1
make[1]: Leaving directory `/home/rutger/download/qemu-0.5.3/i386'

#2 lore raw
Quoted 9 lines · Jim C. Brown
Quoted 8 lines · On Sun, Apr 04, 2004 at 10:11:19PM +0200, [email protected] wrote:

Hi,

I cannot get qemu to build on Gentoo ~x86. Is has to do with the known problem that alsa-lib is not build staticly, and therefore libsdl.a cannot be linked to, and therefore qemu cannot be build staticly also.

Output in that case:

Quoted 8 lines
Quoted 2 lines

...
gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

Try using this command instead:

gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -shared -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

[..]

Doing a "gcc -shared [..]" ans then the rest as per the original gcc invocation worked for me, as well

Carlos

#3 lore raw

[Qemu-devel] SIGSEGV on start of qemu-fast under gentoo

Hi,

I managed to compile QEMU under gentoo using qemu-cvs-1.3.ebuild with this command at the end:

gcc -static -Wl,-T,../i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -shared -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

And I get immendiate SIGSEGV when trying to launch such created qemu-fast.

What I am doing wrong???

thanks in advance

Grzegorz

#4 lore raw

Re: [Qemu-devel] SIGSEGV on start of qemu-fast under gentoo

Hi,

It is totally _wrong_ to compile qemu-fast with a -shared option. If I used a static build there was certainly a reason :-) So you should better not compile qemu-fast if your distribution has not the right packages, as it it said in the (new) QEMU FAQ...

Fabrice.

Quoted 25 lines · Grzegorz Kulewski

Hi,

I managed to compile QEMU under gentoo using qemu-cvs-1.3.ebuild with this command at the end:

gcc -static -Wl,-T,../i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a

(quoted diff) +0 -3
-shared -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl 
-lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib 
-laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

And I get immendiate SIGSEGV when trying to launch such created qemu-fast.

What I am doing wrong???

thanks in advance

Grzegorz

_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel

#5 lore raw
In reply to Jim C. Brown
Quoted 9 lines · Jim C. Brown
Quoted 8 lines · On Sun, Apr 04, 2004 at 10:11:19PM +0200, [email protected] wrote:

Hi,

I cannot get qemu to build on Gentoo ~x86. Is has to do with the known problem that alsa-lib is not build staticly, and therefore libsdl.a cannot be linked to, and therefore qemu cannot be build staticly also.

Output in that case:

Quoted 8 lines
Quoted 2 lines

...
gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

Try using this command instead:

gcc -static -Wl,-T,/home/rutger/download/qemu-0.5.3/i386-vl.ld -o qemu-fast vl.o osdep.o block.o monitor.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o gdbstub.o sdl.o libqemu.a -shared -lm -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lm -ldl -lasound -L/usr/X11R6/lib -lX11 -lXext -laa -L/usr/lib -Wl,-rpath,/usr/lib -laa -lm -L/usr/X11R6/lib -lX11 -lncurses -lutil

It worked for me.

Works for me too, thanks!

Now trying to let qemu use /dev/tun (default of udev) instead of /dev/net/tun ...

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#6 lore raw

PATCH 1/1 /dev/tun support (was: Re: Gentoo & qemu & non-static build)

Hello

Quoted 2 lines · [email protected] wrote:

Now trying to let qemu use /dev/tun (default of udev) instead of /dev/net/tun ...

With this patch against current CVS if qemu can't open /dev/net/tun, it will try /dev/tun. Documentation and error strings adjusted.

Gabriel.

Signature · 1 line
Gabriel Ebner - reverse "ta.renbeleirbag@eg"

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.59

vl.c +11 -4
diff -u -r1.59 vl.c
@@ -765,22 +765,29 @@
 
 #else
 
+#define MAX_TUNDEV_LEN 13
+
 static int tun_open(char *ifname, int ifname_size)
 {
     struct ifreq ifr;
     int fd, ret;
+    char tundev[MAX_TUNDEV_LEN];
     
-    fd = open("/dev/net/tun", O_RDWR);
-    if (fd < 0) {
-        fprintf(stderr, "warning: could not open /dev/net/tun: no virtual network emulation\n");
+    if ((fd = open("/dev/net/tun", O_RDWR)) >= 0) {
+        strncpy(tundev, "/dev/net/tun", MAX_TUNDEV_LEN);
+    } else if ((fd = open("/dev/tun", O_RDWR)) >= 0) {
+        strncpy(tundev, "/dev/tun", MAX_TUNDEV_LEN);
+    } else {
+        fprintf(stderr, "warning: could not open either /dev/net/tun or /dev/tun: no virtual network emulation\n");
         return -1;
     }
+
     memset(&ifr, 0, sizeof(ifr));
     ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
     pstrcpy(ifr.ifr_name, IFNAMSIZ, "tun%d");
     ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
     if (ret != 0) {
-        fprintf(stderr, "warning: could not configure /dev/net/tun: no virtual network emulation\n");
+        fprintf(stderr, "warning: could not configure %s: no virtual network emulation\n", tundev);
         close(fd);
         return -1;
     }

Index: qemu-doc.texi
===================================================================
RCS file: /cvsroot/qemu/qemu/qemu-doc.texi,v
retrieving revision 1.25

qemu-doc.texi +1 -1
diff -u -r1.25 qemu-doc.texi
@@ -552,7 +552,7 @@
 properly @code{sudo} so that the command @code{ifconfig} contained in
 @file{qemu-ifup} can be executed as root. You must verify that your host
 kernel supports the TUN/TAP network interfaces: the device
-@file{/dev/net/tun} must be present.
+@file{/dev/net/tun} or @file{/dev/tun} must be present.
 
 When network is enabled, there is a virtual network connection between
 the host kernel and the emulated kernel. The emulated kernel is seen