From philmd at redhat.com Fri Jun 14 07:24:26 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:26 +0200 Subject: [GEDI] [PATCH 0/6] configure: Try to fix --static linking Message-ID: <20190614072432.820-1-philmd@redhat.com> 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 aarch64 host, but not yet on a x86_64 host: LINK x86_64-softmmu/qemu-system-x86_64 /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-egl /usr/bin/ld: cannot find -lmirclient /usr/bin/ld: cannot find -lmircore /usr/bin/ld: cannot find -lmircookie /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -latk-1.0 /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 /usr/bin/ld: cannot find -lselinux /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-egl /usr/bin/ld: cannot find -lmirclient /usr/bin/ld: cannot find -lmircore /usr/bin/ld: cannot find -lmircookie /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -latk-1.0 /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 /usr/bin/ld: cannot find -lselinux /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libz.so' collect2: error: ld returned 1 exit status Regards, Phil. Philippe Mathieu-Daud? (6): configure: Only generate GLUSTERFS variables if glusterfs is usable configure: Link test before auto-enabling glusterfs libraries configure: Link test before auto-enabling the libusb library configure: Link test before auto-enabling the libusbredir library configure: Link test before auto-enabling the pulseaudio library .travis.yml: Test static linking .travis.yml | 5 +++ configure | 113 +++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 90 insertions(+), 28 deletions(-) -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:27 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:27 +0200 Subject: [GEDI] [PATCH 1/6] configure: Only generate GLUSTERFS variables if glusterfs is usable In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-2-philmd@redhat.com> It is pointless and confusing to have GLUSTERFS variables in config-host.mak when glusterfs is not usable. Signed-off-by: Philippe Mathieu-Daud? --- configure | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/configure b/configure index b091b82cb3..13fd4a1166 100755 --- a/configure +++ b/configure @@ -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 -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:28 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:28 +0200 Subject: [GEDI] [PATCH 2/6] configure: Link test before auto-enabling glusterfs libraries In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-3-philmd@redhat.com> 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 Signed-off-by: Philippe Mathieu-Daud? --- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 13fd4a1166..3428adb75b 100755 --- a/configure +++ b/configure @@ -4179,9 +4179,23 @@ 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) + if test "$static" = "yes"; then + glusterfs_libs=$($pkg_config --libs --static glusterfs-api) + else + glusterfs_libs=$($pkg_config --libs glusterfs-api) + fi + # 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 -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:29 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:29 +0200 Subject: [GEDI] [PATCH 3/6] configure: Link test before auto-enabling the libusb library In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-4-philmd@redhat.com> 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 Signed-off-by: Philippe Mathieu-Daud? --- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 3428adb75b..e2511df1e3 100755 --- a/configure +++ b/configure @@ -4898,9 +4898,23 @@ 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) + if test "$static" = "yes"; then + libusb_libs=$($pkg_config --libs --static libusb-1.0) + else + libusb_libs=$($pkg_config --libs libusb-1.0) + fi + # 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" -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:30 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:30 +0200 Subject: [GEDI] [PATCH 4/6] configure: Link test before auto-enabling the libusbredir library In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-5-philmd@redhat.com> 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 Signed-off-by: Philippe Mathieu-Daud? --- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/configure b/configure index e2511df1e3..4eed33e1b1 100755 --- a/configure +++ b/configure @@ -4926,9 +4926,23 @@ 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) + if test "$static" = "yes"; then + usb_redir_libs=$($pkg_config --libs --static libusbredirparser-0.5) + else + usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) + fi + # 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" -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:31 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:31 +0200 Subject: [GEDI] [PATCH 5/6] configure: Link test before auto-enabling the pulseaudio library In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-6-philmd@redhat.com> 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 Signed-off-by: Philippe Mathieu-Daud? --- configure | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 4eed33e1b1..4d015496ae 100755 --- a/configure +++ b/configure @@ -3408,10 +3408,25 @@ 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) + if test "$static" = "yes"; then + pulse_libs=$($pkg_config --libs --static libpulse) + else + pulse_libs=$($pkg_config --libs libpulse) + fi + # 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 -- 2.20.1 From philmd at redhat.com Fri Jun 14 07:24:32 2019 From: philmd at redhat.com (=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=) Date: Fri, 14 Jun 2019 09:24:32 +0200 Subject: [GEDI] [PATCH 6/6] .travis.yml: Test static linking In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <20190614072432.820-7-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daud? --- This job currently fails: 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-egl /usr/bin/ld: cannot find -lmirclient /usr/bin/ld: cannot find -lmircore /usr/bin/ld: cannot find -lmircookie /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -latk-1.0 /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 /usr/bin/ld: cannot find -lselinux /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-egl /usr/bin/ld: cannot find -lmirclient /usr/bin/ld: cannot find -lmircore /usr/bin/ld: cannot find -lmircookie /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -latk-1.0 /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 /usr/bin/ld: cannot find -lselinux /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libz.so' collect2: error: ld returned 1 exit status Makefile:204: recipe for target 'qemu-system-lm32' failed make[1]: *** [qemu-system-lm32] Error 1 Makefile:472: recipe for target 'subdir-lm32-softmmu' failed make: *** [subdir-lm32-softmmu] Error 2 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 08502c0aa2..6962fff826 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" -- 2.20.1 From ndevos at redhat.com Fri Jun 14 07:43:10 2019 From: ndevos at redhat.com (Niels de Vos) Date: Fri, 14 Jun 2019 09:43:10 +0200 Subject: [GEDI] [PATCH 1/6] configure: Only generate GLUSTERFS variables if glusterfs is usable In-Reply-To: <20190614072432.820-2-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> <20190614072432.820-2-philmd@redhat.com> Message-ID: <20190614074310.GA1188@ndevos-x270> On Fri, Jun 14, 2019 at 09:24:27AM +0200, Philippe Mathieu-Daud? wrote: > It is pointless and confusing to have GLUSTERFS variables > in config-host.mak when glusterfs is not usable. > > Signed-off-by: Philippe Mathieu-Daud? Looks good to me, thanks. Reviewed-by: Niels de Vos > --- > configure | 36 ++++++++++++++++++------------------ > 1 file changed, 18 insertions(+), 18 deletions(-) > > diff --git a/configure b/configure > index b091b82cb3..13fd4a1166 100755 > --- a/configure > +++ b/configure > @@ -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 > -- > 2.20.1 > From philmd at redhat.com Fri Jun 14 08:40:32 2019 From: philmd at redhat.com (=?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?=) Date: Fri, 14 Jun 2019 10:40:32 +0200 Subject: [GEDI] [PATCH 2/6] configure: Link test before auto-enabling glusterfs libraries In-Reply-To: <20190614072432.820-3-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> <20190614072432.820-3-philmd@redhat.com> Message-ID: <0855a9ee-631b-29e6-cafa-7b7d988cbf1b@redhat.com> On 6/14/19 9:24 AM, Philippe Mathieu-Daud? wrote: > 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 > > Signed-off-by: Philippe Mathieu-Daud? > --- > configure | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/configure b/configure > index 13fd4a1166..3428adb75b 100755 > --- a/configure > +++ b/configure > @@ -4179,9 +4179,23 @@ 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) > + if test "$static" = "yes"; then > + glusterfs_libs=$($pkg_config --libs --static glusterfs-api) > + else > + glusterfs_libs=$($pkg_config --libs glusterfs-api) > + fi I just noticed in ./configure: case "$opt" in --static) static="yes" LDFLAGS="-static $LDFLAGS" QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" ;; And pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" query_pkg_config() { "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" } pkg_config=query_pkg_config So I shouldn't need to test "$static" = "yes" and manually add --static. (same apply to other patches in this series). I'll see what's wrong... > + # 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 > From philmd at redhat.com Fri Jun 14 08:48:03 2019 From: philmd at redhat.com (=?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?=) Date: Fri, 14 Jun 2019 10:48:03 +0200 Subject: [GEDI] [PATCH 0/6] configure: Try to fix --static linking In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: On 6/14/19 9:24 AM, Philippe Mathieu-Daud? wrote: > 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 > aarch64 host, but not yet on a x86_64 host: > > LINK x86_64-softmmu/qemu-system-x86_64 > /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-egl > /usr/bin/ld: cannot find -lmirclient > /usr/bin/ld: cannot find -lmircore > /usr/bin/ld: cannot find -lmircookie > /usr/bin/ld: cannot find -lepoxy > /usr/bin/ld: cannot find -latk-1.0 > /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 > /usr/bin/ld: cannot find -lselinux > /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-egl > /usr/bin/ld: cannot find -lmirclient > /usr/bin/ld: cannot find -lmircore > /usr/bin/ld: cannot find -lmircookie > /usr/bin/ld: cannot find -lepoxy > /usr/bin/ld: cannot find -latk-1.0 > /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 > /usr/bin/ld: cannot find -lselinux > /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libz.so' > collect2: error: ld returned 1 exit status This one is funny, when installing libvte on Ubuntu 18.04: LINK x86_64-softmmu/qemu-system-x86_64 c++: error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory c++: error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory c++: error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory c++: error: /usr/lib/x86_64-linux-gnu/libunistring.so: No such file or directory $ pkg-config --libs --static vte-2.91 -lvte-2.91 -lgtk-3 -latk-bridge-2.0 -latspi -ldbus-1 -lpthread -lsystemd -lgdk-3 -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 -lgio-2.0 -lz -lresolv -lselinux -lmount -lgmodule-2.0 -pthread -ldl -lgobject-2.0 -lffi -lglib-2.0 -pthread -lpcre -pthread -lgnutls -lgmp /usr/lib/x86_64-linux-gnu/libunistring.so -lidn2 -lhogweed -lgmp -lnettle -ltasn1 -lp11-kit -lz $ 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 The fix is probably "sudo ln -s libunistring.so.2 /usr/lib/x86_64-linux-gnu/libunistring.so". From peter.maydell at linaro.org Fri Jun 14 08:53:50 2019 From: peter.maydell at linaro.org (Peter Maydell) Date: Fri, 14 Jun 2019 09:53:50 +0100 Subject: [GEDI] [Qemu-devel] [PATCH 0/6] configure: Try to fix --static linking In-Reply-To: <20190614072432.820-1-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> Message-ID: On Fri, 14 Jun 2019 at 08:27, Philippe Mathieu-Daud? wrote: > 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. 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. thanks -- PMM From alex.bennee at linaro.org Fri Jun 14 13:58:09 2019 From: alex.bennee at linaro.org (Alex =?utf-8?Q?Benn=C3=A9e?=) Date: Fri, 14 Jun 2019 14:58:09 +0100 Subject: [GEDI] [Qemu-devel] [PATCH 0/6] configure: Try to fix --static linking In-Reply-To: References: <20190614072432.820-1-philmd@redhat.com> Message-ID: <8736kce0b2.fsf@zen.linaroharston> Peter Maydell writes: > On Fri, 14 Jun 2019 at 08:27, Philippe Mathieu-Daud? wrote: >> 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. > > 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. It would be nice to have a --static-user config flag and deprecate the --static flag. I don't think there is a decent use case for system emulation targets. The Gentoo ebuild currently jumps through hoops to build QEMU by doing the build twice, first for softmmu targets and then for user targets. I suspect all of that is mostly to handle the reasonable "static-user" use case which is what people really want*. *I'm guessing -- Alex Benn?e From alex.bennee at linaro.org Fri Jun 14 14:03:04 2019 From: alex.bennee at linaro.org (Alex =?utf-8?Q?Benn=C3=A9e?=) Date: Fri, 14 Jun 2019 15:03:04 +0100 Subject: [GEDI] [PATCH 6/6] .travis.yml: Test static linking In-Reply-To: <20190614072432.820-7-philmd@redhat.com> References: <20190614072432.820-1-philmd@redhat.com> <20190614072432.820-7-philmd@redhat.com> Message-ID: <871rzwe02v.fsf@zen.linaroharston> Philippe Mathieu-Daud? writes: > Signed-off-by: Philippe Mathieu-Daud? > --- > This job currently fails: > > 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-egl > /usr/bin/ld: cannot find -lmirclient > /usr/bin/ld: cannot find -lmircore > /usr/bin/ld: cannot find -lmircookie > /usr/bin/ld: cannot find -lepoxy > /usr/bin/ld: cannot find -latk-1.0 > /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 > /usr/bin/ld: cannot find -lselinux > /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-egl > /usr/bin/ld: cannot find -lmirclient > /usr/bin/ld: cannot find -lmircore > /usr/bin/ld: cannot find -lmircookie > /usr/bin/ld: cannot find -lepoxy > /usr/bin/ld: cannot find -latk-1.0 > /usr/bin/ld: cannot find -lgdk_pixbuf-2.0 > /usr/bin/ld: cannot find -lselinux > /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libz.so' > collect2: error: ld returned 1 exit status > Makefile:204: recipe for target 'qemu-system-lm32' failed > make[1]: *** [qemu-system-lm32] Error 1 > Makefile:472: recipe for target 'subdir-lm32-softmmu' failed > make: *** [subdir-lm32-softmmu] Error 2 > --- > .travis.yml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/.travis.yml b/.travis.yml > index 08502c0aa2..6962fff826 100644 > --- a/.travis.yml > +++ b/.travis.yml > @@ -92,6 +92,11 @@ matrix: > - CONFIG="--disable-user --target-list-exclude=${MAIN_SOFTMMU_TARGETS}" > > > + # Test static linking > + - env: > + - CONFIG="--static --target-list=lm32-softmmu" > + > + It's probably more useful to have a: CONFIG="--disable-system --static" In fact arguably we could just add it to the first --disable-system stanza as there are other linux-user builds scattered about to catch the cases where we break dynamically linked linux-user builds. > # Just build tools and run minimal unit and softfloat checks > - env: > - BASE_CONFIG="--enable-tools" -- Alex Benn?e From peter.maydell at linaro.org Fri Jun 14 14:30:36 2019 From: peter.maydell at linaro.org (Peter Maydell) Date: Fri, 14 Jun 2019 15:30:36 +0100 Subject: [GEDI] [Qemu-devel] [PATCH 0/6] configure: Try to fix --static linking In-Reply-To: <8736kce0b2.fsf@zen.linaroharston> References: <20190614072432.820-1-philmd@redhat.com> <8736kce0b2.fsf@zen.linaroharston> Message-ID: On Fri, 14 Jun 2019 at 14:58, Alex Benn?e wrote: > It would be nice to have a --static-user config flag and deprecate the > --static flag. I don't think there is a decent use case for system > emulation targets. It would be really tricky to build half with static and half without: our configure and build system really assumes that fundamental stuff like "what libraries" and "what compiler flags" are the same across the whole of the build. Is --static-user really much better than: * allow --static --disable-system --disable-tools * forbid --static without --disable-system --disable-tools * require users to build the static usermode binaries separately from the system/tools build (which is in practice what we have now) ? Debian wants both static usermode and non-static usermode binaries, so they'd still need to build multiple times anyway. thanks -- PMM From philmd at redhat.com Fri Jun 14 15:17:08 2019 From: philmd at redhat.com (=?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?=) Date: Fri, 14 Jun 2019 17:17:08 +0200 Subject: [GEDI] [Qemu-devel] [PATCH 0/6] configure: Try to fix --static linking In-Reply-To: References: <20190614072432.820-1-philmd@redhat.com> <8736kce0b2.fsf@zen.linaroharston> Message-ID: On 6/14/19 4:30 PM, Peter Maydell wrote: > On Fri, 14 Jun 2019 at 14:58, Alex Benn?e wrote: > >> It would be nice to have a --static-user config flag and deprecate the >> --static flag. I don't think there is a decent use case for system >> emulation targets. > > It would be really tricky to build half with static and half > without: our configure and build system really assumes that > fundamental stuff like "what libraries" and "what compiler flags" > are the same across the whole of the build. > > Is --static-user really much better than: > * allow --static --disable-system --disable-tools > * forbid --static without --disable-system --disable-tools > * require users to build the static usermode binaries separately > from the system/tools build > > (which is in practice what we have now) ? > > Debian wants both static usermode and non-static usermode > binaries, so they'd still need to build multiple times anyway. Glad to read, so the v2 of this series is worthful.