Skip to contentSkip to conversation

configure: Fix softmmu --static linking

PATCH In review Philippe Mathieu-Daudé 2 participants 14 messages Jun 14, 2019 – Jul 1, 2019

lore
Share & tools
lore
#0 lore raw

v2 cover configure: Fix softmmu --static linking

Hi,

Apparently QEMU static linking is slowly bitroting. Obviously it depends the libraries an user has installed, anyway it seems there are not much testing done.

This series fixes few issues, enough to build QEMU on a Ubuntu 18.04 host.

Peter commented on v1:

The main reason for supporting static linking is so we can build the user-mode emulators. Almost always the problems with static linking the softmmu binaries and the tools are issues with the distro's packaging of the static libraries (pkg-config files which specify things that don't work for static is a common one).

So we could put in a lot of checking of "is what pkg-config tells us broken". Or we could just say "we don't support static linking for anything except the usermode binaries". We should probably phase in deprecation of that because it's possible somebody's using it seriously, but it seems like a fairly weird thing to do to me.

I share his view on this (restricting static linking to qemu-user) but since the work was already done when I read his comment, I still send the v2.

Since v1:
- pkg-config already use the '--static' argument, do not add it twice
- Fixed x86_64 host builds (was missing GTK and OpenGL patches)
- Added Niels R-b tag on the first patch
- The Travis-CI job now succeeds:
https://travis-ci.org/philmd/qemu/jobs/545653697 (6 min 7 sec)

Regards,

Phil.

Philippe Mathieu-Daudé (9):
configure: Only generate GLUSTERFS variables if glusterfs is usable
configure: Link test before auto-enabling GlusterFS libraries
configure: Link test before auto-enabling libusb library
configure: Link test before auto-enabling libusbredir library
configure: Link test before auto-enabling PulseAudio library
configure: Link test before auto-enabling OpenGL libraries
configure: Link test before auto-enabling GTK libraries tests/docker: Kludge for missing libunistring.so symlink on Ubuntu

    18.04

.travis.yml: Test softmmu static linking

 .travis.yml                                |   5 +
 configure                                  | 121 ++++++++++++++++-----
 tests/docker/dockerfiles/ubuntu1804.docker |   4 +
 3 files changed, 100 insertions(+), 30 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/9 configure: Only generate GLUSTERFS variables if glusterfs is usable

It is pointless and confusing to have GLUSTERFS variables in config-host.mak when glusterfs is not usable.

---
 configure | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
configure +18 -18
index b091b82cb3..13fd4a1166 100755
@@ -7118,30 +7118,30 @@ if test "$glusterfs" = "yes" ; then
   echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
   echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
   echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
-fi
 
-if test "$glusterfs_xlator_opt" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
-fi
+  if test "$glusterfs_xlator_opt" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
+  fi
 
-if test "$glusterfs_discard" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
-fi
+  if test "$glusterfs_discard" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
+  fi
 
-if test "$glusterfs_fallocate" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
-fi
+  if test "$glusterfs_fallocate" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
+  fi
 
-if test "$glusterfs_zerofill" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
-fi
+  if test "$glusterfs_zerofill" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
+  fi
 
-if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
-fi
+  if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
+  fi
 
-if test "$glusterfs_iocb_has_stat" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
+  if test "$glusterfs_iocb_has_stat" = "yes" ; then
+    echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
+  fi
 fi
 
 if test "$libssh2" = "yes" ; then
Signature · 1 line
2.20.1
Reviewed-by on v2 1/9
#2 lore raw

Re: [Qemu-devel] [PATCH v2 1/9] configure: Only generate GLUSTERFS variables if glusterfs is usable

Quoted 8 lines · Philippe Mathieu-Daudé

It is pointless and confusing to have GLUSTERFS variables in config-host.mak when glusterfs is not usable.

---
 configure | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw

PATCH v2 2/9 configure: Link test before auto-enabling GlusterFS libraries

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the libraries link correctly before considering them as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -lgfapi
  /usr/bin/ld: cannot find -lglusterfs
  /usr/bin/ld: cannot find -lgfrpc
  /usr/bin/ld: cannot find -lgfxdr
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1
  $ fgrep gf config-host.mak
  GLUSTERFS_LIBS=-lacl -lgfapi -lglusterfs -lgfrpc -lgfxdr -luuid
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
configure +11 -1
index 13fd4a1166..fe0e2e1b75 100755
@@ -4179,9 +4179,19 @@ fi
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
   if $pkg_config --atleast-version=3 glusterfs-api; then
-    glusterfs="yes"
     glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
     glusterfs_libs=$($pkg_config --libs glusterfs-api)
+    # Packaging for the static libraries is not always correct.
+    # At least ubuntu 18.04 ships only shared libraries.
+    write_c_skeleton
+    if ! compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
+        if test "$glusterfs" = "yes" ; then
+          error_exit "glusterfs check failed."
+        fi
+        glusterfs="no"
+    else
+        glusterfs="yes"
+    fi
     if $pkg_config --atleast-version=4 glusterfs-api; then
       glusterfs_xlator_opt="yes"
     fi
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 3/9 configure: Link test before auto-enabling libusb library

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the library links correctly before considering it as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -ludev
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1
  $ fgrep udev config-host.mak
  LIBUSB_LIBS=-lusb-1.0 -ludev -pthread
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
configure +11 -1
index fe0e2e1b75..2ebaa32746 100755
@@ -4894,9 +4894,19 @@ fi
 # check for libusb
 if test "$libusb" != "no" ; then
     if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
-        libusb="yes"
         libusb_cflags=$($pkg_config --cflags libusb-1.0)
         libusb_libs=$($pkg_config --libs libusb-1.0)
+        # Packaging for the static libraries is not always correct.
+        # At least ubuntu 18.04 ships only shared libraries.
+        write_c_skeleton
+        if ! compile_prog "$libusb_cflags" "$libusb_libs" ; then
+            if test "$libusb" = "yes" ; then
+              error_exit "libusb check failed."
+            fi
+            libusb="no"
+        else
+            libusb="yes"
+        fi
     else
         if test "$libusb" = "yes"; then
             feature_not_found "libusb" "Install libusb devel >= 1.0.13"
Signature · 1 line
2.20.1
#5 lore raw

PATCH v2 4/9 configure: Link test before auto-enabling libusbredir library

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the library links correctly before considering it as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -lusbredirparser
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1
  $ fgrep redir config-host.mak
  USB_REDIR_LIBS=-lusbredirparser
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
configure +11 -1
index 2ebaa32746..0dd6e8bed3 100755
@@ -4918,9 +4918,19 @@ fi
 # check for usbredirparser for usb network redirection support
 if test "$usb_redir" != "no" ; then
     if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
-        usb_redir="yes"
         usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
         usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
+        # Packaging for the static libraries is not always correct.
+        # At least ubuntu 18.04 ships only shared libraries.
+        write_c_skeleton
+        if ! compile_prog "$usb_redir_cflags" "$usb_redir_libs" ; then
+            if test "$usb_redir" = "yes" ; then
+              error_exit "usbredir check failed."
+            fi
+            usb_redir="no"
+        else
+            usb_redir="yes"
+        fi
     else
         if test "$usb_redir" = "yes"; then
             feature_not_found "usb-redir" "Install usbredir devel"
Signature · 1 line
2.20.1
#6 lore raw

PATCH v2 5/9 configure: Link test before auto-enabling PulseAudio library

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the library links correctly before considering it as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -lpulse
  /usr/bin/ld: cannot find -lpulsecommon-11.1
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1
  $ fgrep pulse config-host.mak
  PULSE_LIBS=-L/usr/lib/aarch64-linux-gnu/pulseaudio -lpulse -lpulsecommon-11.1
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
configure +15 -4
index 0dd6e8bed3..449dbd69ce 100755
@@ -3408,10 +3408,21 @@ for drv in $audio_drv_list; do
 
     pa | try-pa)
     if $pkg_config libpulse --exists; then
-        pulse_libs=$($pkg_config libpulse --libs)
-        audio_pt_int="yes"
-        if test "$drv" = "try-pa"; then
-            audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
+        pulse_cflags=$($pkg_config --cflags libpulse)
+        pulse_libs=$($pkg_config --libs libpulse)
+        # Packaging for the static libraries is not always correct.
+        # At least ubuntu 18.04 ships only shared libraries.
+        write_c_skeleton
+        if ! compile_prog "$pulse_cflags" "$pulse_libs" ; then
+            unset pulse_cflags pulse_libs
+            if test "$drv" = "try-pa"; then
+                audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//')
+            fi
+        else
+            audio_pt_int="yes"
+            if test "$drv" = "try-pa"; then
+                audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
+            fi
         fi
     else
         if test "$drv" = "try-pa"; then
Signature · 1 line
2.20.1
#7 lore raw

PATCH v2 6/9 configure: Link test before auto-enabling OpenGL libraries

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the libraries link correctly before considering them as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-lm32-softmmu
  [...]
  LINK    lm32-softmmu/qemu-system-lm32
  /usr/bin/ld: cannot find -lepoxy
  /usr/bin/ld: cannot find -lgbm
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-lm32' failed
  make[1]: *** [qemu-system-lm32] Error 1
  $ fgrep epoxy config-host.mak
  OPENGL_LIBS=-lepoxy -ldl -lgbm -ldl
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
configure +14 -4
index 449dbd69ce..a3da5adf80 100755
@@ -4133,11 +4133,21 @@ if test "$opengl" != "no" ; then
   if $pkg_config $opengl_pkgs; then
     opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
     opengl_libs="$($pkg_config --libs $opengl_pkgs)"
-    opengl=yes
-    if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
-        gtk_gl="yes"
+    # Packaging for the static libraries is not always correct.
+    # At least ubuntu 18.04 ships only shared libraries.
+    write_c_skeleton
+    if ! compile_prog "$opengl_cflags" "$opengl_libs" ; then
+        if test "$opengl" = "yes" ; then
+          error_exit "opengl check failed."
+        fi
+        opengl=no
+    else
+        opengl=yes
+        if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
+            gtk_gl="yes"
+        fi
+        QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
     fi
-    QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
   else
     if test "$opengl" = "yes" ; then
       feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
Signature · 1 line
2.20.1
#8 lore raw

PATCH v2 7/9 configure: Link test before auto-enabling GTK libraries

In reply to Philippe Mathieu-Daudé

Similarly to commit a73e82ef912, test the libraries link correctly before considering them as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-lm32-softmmu
  [...]
  LINK    lm32-softmmu/qemu-system-lm32
  /usr/bin/ld: cannot find -lgtk-3
  /usr/bin/ld: cannot find -latk-bridge-2.0
  /usr/bin/ld: cannot find -latspi
  /usr/bin/ld: cannot find -lsystemd
  /usr/bin/ld: cannot find -lgdk-3
  /usr/bin/ld: cannot find -lwayland-cursor
  /usr/bin/ld: cannot find -lwayland-egl
  /usr/bin/ld: cannot find -lwayland-client
  /usr/bin/ld: cannot find -lepoxy
  /usr/bin/ld: cannot find -lgraphite2
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-lm32' failed
  make[1]: *** [qemu-system-lm32] Error 1
  $ fgrep gdk config-host.mak
  GTK_LIBS=-lgtk-3 -latk-bridge-2.0 -latspi -ldbus-1 -lpthread -lsystemd -lgdk-3 -lgio-2.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lXfixes -lxkbcommon -lwayland-cursor -lwayland-egl -lwayland-client -lepoxy -ldl -lpangocairo-1.0 -lpangoft2-1.0 -lharfbuzz -lm -lgraphite2 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lz -lpixman-1 -lfontconfig -lexpat -lfreetype -lexpat -lfreetype -lpng16 -lm -lz -lm -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp -lgdk_pixbuf-2.0 -lm -lpng16 -lm -lz -lm -lz -lgio-2.0 -lz -lresolv -lselinux -lmount -lgmodule-2.0 -pthread -ldl -lgobject-2.0 -lffi -lglib-2.0 -pthread -lpcre -pthread -lX11 -lpthread -lxcb -lXau -lXdmcp
VTE_CFLAGS=-pthread -I/usr/include/vte-2.91 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/p11-kit-1
  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
configure +11 -1
index a3da5adf80..ffd269b34f 100755
@@ -2782,7 +2782,17 @@ if test "$gtk" != "no"; then
             gtk_cflags="$gtk_cflags $x11_cflags"
             gtk_libs="$gtk_libs $x11_libs"
         fi
-        gtk="yes"
+        # Packaging for the static libraries is not always correct.
+        # At least ubuntu 18.04 ships only shared libraries.
+        write_c_skeleton
+        if ! compile_prog "$gtk_cflags" "$gtk_libs" ; then
+            if test "$gtk" = "yes" ; then
+              error_exit "gtk check failed."
+            fi
+            gtk="no"
+        else
+            gtk="yes"
+        fi
     elif test "$gtk" = "yes"; then
         feature_not_found "gtk" "Install gtk3-devel"
     else
Signature · 1 line
2.20.1
#9 lore raw

PATCH v2 8/9 tests/docker: Kludge for missing libunistring.so symlink on Ubuntu 18.04

In reply to Philippe Mathieu-Daudé

When linking statically on Ubuntu 18.04 we get:

  $ make subdir-x86_64-softmmu
  [...]
     LINK    x86_64-softmmu/qemu-system-x86_64
  c++: error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory

This library is pulled in by GTK:

  $ pkg-config --libs --static gtk+-3.0
  -lgtk-3 -latk-bridge-2.0 -latspi -ldbus-1 -lpthread -lsystemd -lgdk-3 -lgio-2.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lXfixes -lxkbcommon -lwayland-cursor -lwayland-egl -lwayland-client -lepoxy -ldl -lpangocairo-1.0 -lpangoft2-1.0 -lharfbuzz -lm -lgraphite2 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lz -lpixman-1 -lfontconfig -lexpat -lfreetype -lexpat -lfreetype -lpng16 -lm -lz -lm -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp -lgdk_pixbuf-2.0 -lm -lpng16 -lm -lz -lm -lz -lgio-2.0 -lz -lresolv -lselinux -lmount -lgmodule-2.0 -pthread -ldl -lgobject-2.0 -lffi -lglib-2.0 -pthread -lpcre -pthread

However, while the library is presentm, its symlink is missing:

  $ ls -ld /usr/lib/x86_64-linux-gnu/libunistring.so
  ls: cannot access '/usr/lib/x86_64-linux-gnu/libunistring.so': No such file or directory
  $ ls -ld /usr/lib/x86_64-linux-gnu/libunistring.so*
  lrwxrwxrwx. 1 root root      21 Mar  3  2018 /usr/lib/x86_64-linux-gnu/libunistring.so.2 -> libunistring.so.2.1.0
  -rw-r--r--. 1 root root 1562664 Mar  3  2018 /usr/lib/x86_64-linux-gnu/libunistring.so.2.1.0

Fix the issue by creating the missing symlink manually.

---
 tests/docker/dockerfiles/ubuntu1804.docker | 4 ++++
 1 file changed, 4 insertions(+)
tests/docker/dockerfiles/ubuntu1804.docker +4 -0
index 2e2900150b..7e45c52166 100644
@@ -54,4 +54,8 @@ ENV PACKAGES flex bison \
 RUN apt-get update && \
     apt-get -y install $PACKAGES
 RUN dpkg -l $PACKAGES | sort > /packages.txt
+# The libunistring2 package does not create a symlink to libunistring.so
+# Create it manually to fix:
+# error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory
+RUN ln -s libunistring.so.2 /usr/lib/x86_64-linux-gnu/libunistring.so
 ENV FEATURES clang pyyaml sdl2
Signature · 1 line
2.20.1
#10 lore raw

PATCH v2 9/9 .travis.yml: Test softmmu static linking

In reply to Philippe Mathieu-Daudé

Add a test to avoid the ./configure script to bitrot.

---
 .travis.yml | 5 +++++
 1 file changed, 5 insertions(+)
.travis.yml +5 -0
index 08502c0aa2..6962fff826 100644
@@ -92,6 +92,11 @@ matrix:
         - CONFIG="--disable-user --target-list-exclude=${MAIN_SOFTMMU_TARGETS}"
 
 
+    # Test static linking
+    - env:
+        - CONFIG="--static --target-list=lm32-softmmu"
+
+
     # Just build tools and run minimal unit and softfloat checks
     - env:
         - BASE_CONFIG="--enable-tools"
Signature · 1 line
2.20.1
#11 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 25 lines · Philippe Mathieu-Daudé

Hi,

Apparently QEMU static linking is slowly bitroting. Obviously it depends the libraries an user has installed, anyway it seems there are not much testing done.

This series fixes few issues, enough to build QEMU on a Ubuntu 18.04 host.

Peter commented on v1:

The main reason for supporting static linking is so we can build the user-mode emulators. Almost always the problems with static linking the softmmu binaries and the tools are issues with the distro's packaging of the static libraries (pkg-config files which specify things that don't work for static is a common one).

So we could put in a lot of checking of "is what pkg-config tells us broken". Or we could just say "we don't support static linking for anything except the usermode binaries". We should probably phase in deprecation of that because it's possible somebody's using it seriously, but it seems like a fairly weird thing to do to me.

Quoted 3 lines

I share his view on this (restricting static linking to qemu-user) but since the work was already done when I read his comment, I still send the v2.

Alex, any comment?

Patch #1 could go via trivial@, the other should be made obsolete by the Paolo's switch to Meson.

Quoted 28 lines

Since v1:
- pkg-config already use the '--static' argument, do not add it twice
- Fixed x86_64 host builds (was missing GTK and OpenGL patches)
- Added Niels R-b tag on the first patch
- The Travis-CI job now succeeds:
https://travis-ci.org/philmd/qemu/jobs/545653697 (6 min 7 sec)

Regards,

Phil.

Philippe Mathieu-Daudé (9):
configure: Only generate GLUSTERFS variables if glusterfs is usable
configure: Link test before auto-enabling GlusterFS libraries
configure: Link test before auto-enabling libusb library
configure: Link test before auto-enabling libusbredir library
configure: Link test before auto-enabling PulseAudio library
configure: Link test before auto-enabling OpenGL libraries
configure: Link test before auto-enabling GTK libraries tests/docker: Kludge for missing libunistring.so symlink on Ubuntu

    18.04

.travis.yml: Test softmmu static linking

 .travis.yml                                |   5 +
 configure                                  | 121 ++++++++++++++++-----
 tests/docker/dockerfiles/ubuntu1804.docker |   4 +
 3 files changed, 100 insertions(+), 30 deletions(-)
#12 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Hi,

Apparently QEMU static linking is slowly bitroting. Obviously it depends the libraries an user has installed, anyway it seems there are not much testing done.

Bitrotting implies that it actually worked in the first place.

AFAIK, configure has never been capable of auto-enabling the correct set of libraries for static linking, if you have the equiv dyn libraries present.

I always assumed that anyone who is static loinking QEMU is passing a big long list of --disable-XXXX args to turn off all the 3rd party libs for which they don't have a static build present.

Quoted 19 lines

This series fixes few issues, enough to build QEMU on a Ubuntu 18.04 host.

Peter commented on v1:

The main reason for supporting static linking is so we can build the user-mode emulators. Almost always the problems with static linking the softmmu binaries and the tools are issues with the distro's packaging of the static libraries (pkg-config files which specify things that don't work for static is a common one).

So we could put in a lot of checking of "is what pkg-config tells us broken". Or we could just say "we don't support static linking for anything except the usermode binaries". We should probably phase in deprecation of that because it's possible somebody's using it seriously, but it seems like a fairly weird thing to do to me.

Quoted 3 lines

I share his view on this (restricting static linking to qemu-user) but since the work was already done when I read his comment, I still send the v2.

I share Peter's view that we ought to restrict static linking to be allowed exclusively for user-mode-only builds of QEMU. This is a use case with a compelling reason to need static builds. It is not bitrotting as the main distros all do a static user-mode only QEMU build, alongside the main everything, fully dynamic build.

Static builds of system emulators & other tools get essentially no testing by developers, distros, or our CI systems. If they do work it is largely by luck, and likely requires the user to pass many --disable-XXX flags. While your patches do make configure a bit nicer in this respect, if we're going to deprecate static builds of non-user-mode parts, then making static builds easier feels undesirable.

Lets just get a deprecation warning in right now for this imminent release.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#13 lore raw
Quoted 47 lines · Daniel P. Berrangé
Quoted 5 lines · Philippe Mathieu-Daudé

Hi,

Apparently QEMU static linking is slowly bitroting. Obviously it depends the libraries an user has installed, anyway it seems there are not much testing done.

Bitrotting implies that it actually worked in the first place.

AFAIK, configure has never been capable of auto-enabling the correct set of libraries for static linking, if you have the equiv dyn libraries present.

I always assumed that anyone who is static loinking QEMU is passing a big long list of --disable-XXXX args to turn off all the 3rd party libs for which they don't have a static build present.

Quoted 19 lines

This series fixes few issues, enough to build QEMU on a Ubuntu 18.04 host.

Peter commented on v1:

The main reason for supporting static linking is so we can build the user-mode emulators. Almost always the problems with static linking the softmmu binaries and the tools are issues with the distro's packaging of the static libraries (pkg-config files which specify things that don't work for static is a common one).

So we could put in a lot of checking of "is what pkg-config tells us broken". Or we could just say "we don't support static linking for anything except the usermode binaries". We should probably phase in deprecation of that because it's possible somebody's using it seriously, but it seems like a fairly weird thing to do to me.

Quoted 3 lines

I share his view on this (restricting static linking to qemu-user) but since the work was already done when I read his comment, I still send the v2.

I share Peter's view that we ought to restrict static linking to be allowed exclusively for user-mode-only builds of QEMU. This is a use case with a compelling reason to need static builds. It is not bitrotting as the main distros all do a static user-mode only QEMU build, alongside the main everything, fully dynamic build.

Quoted 7 lines

Static builds of system emulators & other tools get essentially no testing by developers, distros, or our CI systems. If they do work it is largely by luck, and likely requires the user to pass many --disable-XXX flags. While your patches do make configure a bit nicer in this respect, if we're going to deprecate static builds of non-user-mode parts, then making static builds easier feels undesirable.

OK, I agree then.

Quoted 7 lines

Lets just get a deprecation warning in right now for this imminent release.

Regards,
Daniel