Package Details: qemu-user-static 7.0.0-2

Git Clone URL: https://aur.archlinux.org/qemu-user-static.git (read-only, click to copy)
Package Base: qemu-user-static
Description: Statically linked binaries of Qemu with user emulation. Useful for containers/chroot environment with binfmt.
Upstream URL: http://wiki.qemu.org/
Licenses: GPL2, LGPL2.1
Provides: qemu-user-static
Submitter: falstaff_ch
Maintainer: crab2313
Last Packager: crab2313
Votes: 25
Popularity: 2.77
First Submitted: 2019-01-11 13:55 (UTC)
Last Updated: 2022-08-10 01:07 (UTC)

Pinned Comments

crab2313 commented on 2020-06-09 02:25 (UTC) (edited on 2020-06-09 02:26 (UTC) by crab2313)

NOTE: The version of pcre-static and glib2-static should match their corresponding non-static system libraries since they are just static libraries without C headers.

Latest Comments

Bonnietwin commented on 2022-08-09 21:18 (UTC)

Thanks very much @GnSight, that PKGBUILD with the patch worked for me as well with glibc-2.36

GnSight commented on 2022-08-09 03:58 (UTC)

@Bonnietwin changeing the PKGBUILD to this works for me on glibc 2.36

# Maintainer: crab2313 <crab2313@gmail.com>
# Contributor: Stefan Agner <stefan@agner.ch>

pkgname=qemu-user-static
pkgdesc="Statically linked binaries of Qemu with user emulation. Useful for containers/chroot environment with binfmt."
pkgver=7.0.0
pkgrel=1
arch=(x86_64 aarch64)
license=(GPL2 LGPL2.1)
url="http://wiki.qemu.org/"
depends=()
makedepends=(python meson glib2-static pcre-static)
source=(https://download.qemu.org/qemu-$pkgver.tar.xz{,.sig}
        https://raw.githubusercontent.com/archlinux/svntogit-packages/45d970cbc5ce366f70898d79ec8517d460998b5b/trunk/qemu-7.0.0-glibc-2.36.patch)
sha512sums=('44ecd10c018a3763e1bc87d1d35b98890d0d5636acd69fe9b5cadf5024d5af6a31684d60cbe1c3370e02986434c1fb0ad99224e0e6f6fe7eda169992508157b1'
            'SKIP'
            'SKIP')
validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')

case $CARCH in
  i?86) _corearch=i386 ;;
  x86_64) _corearch=x86_64 ;;
esac

# If non empty, always run the configure script
: "${FORCE_CONFIGURE:=1}"

prepare() {
  mkdir -p build-user-static

  cd qemu-${pkgver}
  #sed -i 's/vte-2\.90/vte-2.91/g' configure
  patch -Np1 -d . -i ../qemu-7.0.0-glibc-2.36.patch
}

_configure() {
    ../qemu-${pkgver}/configure \
            --prefix=/usr \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --libexecdir=/usr/lib/qemu \
            --enable-linux-user \
            --disable-debug-info \
            --disable-bsd-user \
            --disable-werror \
            --disable-system \
            --disable-tools \
            --disable-docs \
            --disable-gtk \
            --disable-gnutls \
            --disable-nettle \
            --disable-gcrypt \
            --disable-glusterfs \
            --disable-libnfs \
            --disable-libiscsi \
            --disable-vnc \
            --disable-kvm \
            --disable-libssh \
            --disable-vde \
            --disable-sdl \
            --disable-opengl \
            --disable-xen \
            --disable-fdt \
            --disable-vhost-net \
            --disable-vhost-crypto \
            --disable-vhost-user \
            --disable-vhost-vsock \
            --disable-vhost-scsi \
            --disable-tpm \
            --disable-qom-cast-debug \
            --disable-capstone \
            --disable-zstd \
            --disable-linux-io-uring \
            --disable-bpf \
            --static
}

build() (
  cd build-user-static
  [[ ! $FORCE_CONFIGURE && -e ../qemu-${pkgver}/config.log ]] || _configure
  make ARFLAGS="rc"
)

package() {
  provides=(qemu-user-static)
  options=(!strip)

  make -C build-user-static DESTDIR="$pkgdir" install "${@:2}"

  # remove conflicting /var/run directory
  cd "$pkgdir"
  rm -rf var

  # Remove BIOS files etc...
  rm -rf usr/share

  # Rename static qemu binaries
  cd "${pkgdir}/usr/bin/"
  tidy_strip
  ls -1 | while read f; do
    mv "$f" "$f-static"
  done
}

# vim:set ts=2 sw=2 et:

stratusfear commented on 2022-08-07 18:53 (UTC) (edited on 2022-08-07 18:56 (UTC) by stratusfear)

On aarch64, in reference to what ayr-ton encountered, I had to recompile glibc with "PIE" in lieu of "pie" in ccflags to get around this error, running the following patch in the PKGBUILD for glibc:

 --- a/sysdeps/aarch64/Makefile
 +++ b/sysdeps/aarch64/Makefile
 @@ -1,5 +1,8 @@
  long-double-fcts = yes

 +pie-ccflag = -fPIE
 +no-pie-ccflag = -fno-PIE
 +
  ifeq (yes,$(aarch64-bti))
  # Mark linker output BTI compatible, it warns on non-BTI inputs.
  sysdep-LDFLAGS += -Wl,-z,force-bti

I additionally had to skip the following tests in check() in the glibc PKGBUILD; I don't know whether this is really appropriate but my aim was to get it compiled and working without spending a lot of time on it, and it appears to work fine:

 skip_test check-localplt          elf/Makefile
 skip_test tst-udp-timeout         sunrpc/Makefile

In reference to what Bonnietwin encountered, this appears to be due to a change in glibc 2.36, the standard qemu-base package in Arch has a patch which should fix it here too. This one doesn't seem to be aarch64 specific.

Bonnietwin commented on 2022-08-06 21:12 (UTC)

I am getting a similar error to ayr-ton, also with aarch64


[990/2887] Compiling C object libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o
FAILED: libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o 
cc -m64 -mcx16 -Ilibqemu-aarch64_be-linux-user.fa.p -I. -I../qemu-7.0.0 -Itarget/arm -I../qemu-7.0.0/target/arm -I../qemu-7.0.0/common-user/host/x86_64 -I../qemu-7.0.0/linux-user/include/host/x86_64 -I../qemu-7.0.0/linux-user/include -Ilinux-user -I../qemu-7.0.0/linux-user -I../qemu-7.0.0/linux-user/aarch64 -Iqapi -Itrace -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -isystem /home/source/AUR/qemu-user-static/src/qemu-7.0.0/linux-headers -isystem linux-headers -iquote . -iquote /home/source/AUR/qemu-user-static/src/qemu-7.0.0 -iquote /home/source/AUR/qemu-user-static/src/qemu-7.0.0/include -iquote /home/source/AUR/qemu-user-static/src/qemu-7.0.0/disas/libvixl -iquote /home/source/AUR/qemu-user-static/src/qemu-7.0.0/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fPIE -isystem../qemu-7.0.0/linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="aarch64_be-linux-user-config-target.h"' '-DCONFIG_DEVICES="aarch64_be-linux-user-config-devices.h"' -MD -MQ libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o -MF libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o.d -o libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o -c ../qemu-7.0.0/linux-user/syscall.c
In file included from /usr/include/linux/fs.h:19,
                 from ../qemu-7.0.0/linux-user/syscall.c:98:
/usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
   95 | enum fsconfig_command {
      |      ^~~~~~~~~~~~~~~~
In file included from ../qemu-7.0.0/linux-user/syscall.c:31:
/usr/include/sys/mount.h:189:6: note: originally defined here
  189 | enum fsconfig_command
      |      ^~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FLAG’
   96 |         FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:191:3: note: previous definition of ‘FSCONFIG_SET_FLAG’ with type ‘enum fsconfig_command’
  191 |   FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:97:9: error: redeclaration of enumerator ‘FSCONFIG_SET_STRING’
   97 |         FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:193:3: note: previous definition of ‘FSCONFIG_SET_STRING’ with type ‘enum fsconfig_command’
  193 |   FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:98:9: error: redeclaration of enumerator ‘FSCONFIG_SET_BINARY’
   98 |         FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:195:3: note: previous definition of ‘FSCONFIG_SET_BINARY’ with type ‘enum fsconfig_command’
  195 |   FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:99:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH’
   99 |         FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:197:3: note: previous definition of ‘FSCONFIG_SET_PATH’ with type ‘enum fsconfig_command’
  197 |   FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:100:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH_EMPTY’
  100 |         FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:199:3: note: previous definition of ‘FSCONFIG_SET_PATH_EMPTY’ with type ‘enum fsconfig_command’
  199 |   FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:101:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FD’
  101 |         FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |         ^~~~~~~~~~~~~~~
/usr/include/sys/mount.h:201:3: note: previous definition of ‘FSCONFIG_SET_FD’ with type ‘enum fsconfig_command’
  201 |   FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |   ^~~~~~~~~~~~~~~
/usr/include/linux/mount.h:102:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_CREATE’
  102 |         FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:203:3: note: previous definition of ‘FSCONFIG_CMD_CREATE’ with type ‘enum fsconfig_command’
  203 |   FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:103:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_RECONFIGURE’
  103 |         FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:205:3: note: previous definition of ‘FSCONFIG_CMD_RECONFIGURE’ with type ‘enum fsconfig_command’
  205 |   FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:129:8: error: redefinition of ‘struct mount_attr’
  129 | struct mount_attr {
      |        ^~~~~~~~~~
/usr/include/sys/mount.h:161:8: note: originally defined here
  161 | struct mount_attr
      |        ^~~~~~~~~~


ninja: build stopped: subcommand failed.
make: *** [Makefile:163: run-ninja] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

ayr-ton commented on 2022-07-29 20:03 (UTC)

Got this error with aarch64:

FAILED: qemu-aarch64_be 
c++  -o qemu-aarch64_be libcommon.fa.p/cpus-common.c.o libcommon.fa.p/page-vary-common.c.o libcommon.fa.p/disas_arm-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_a64_decoder-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_a64_disasm-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_a64_instructions-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_compiler-intrinsics.cc.o libcommon.fa.p/disas_libvixl_vixl_utils.cc.o libcommon.fa.p/disas_arm.c.o libcommon.fa.p/hw_core_cpu-common.c.o libcommon.fa.p/hw_core_machine-smp.c.o libcommon.fa.p/accel_accel-user.c.o libcommon.fa.p/common-user_safe-syscall.S.o libcommon.fa.p/common-user_safe-syscall-error.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_aarch64_signal.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_aarch64_cpu_loop.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_crypto_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_debug_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_gdbstub.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_iwmmxt_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_m_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_mve_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_neon_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_op_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_tlb_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-m-nocp.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-mve.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-neon.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-vfp.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_vec_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_vfp_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu_tcg.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_kvm-stub.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_gdbstub64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_helper-a64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_mte_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_pauth_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_sve_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-a64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-sve.c.o libqemu-aarch64_be-linux-user.fa.p/trace_control-target.c.o libqemu-aarch64_be-linux-user.fa.p/cpu.c.o libqemu-aarch64_be-linux-user.fa.p/disas.c.o libqemu-aarch64_be-linux-user.fa.p/gdbstub.c.o libqemu-aarch64_be-linux-user.fa.p/page-vary.c.o libqemu-aarch64_be-linux-user.fa.p/semihosting_arm-compat-semi.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_optimize.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_region.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-common.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op-gvec.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op-vec.c.o libqemu-aarch64_be-linux-user.fa.p/fpu_softfloat.c.o libqemu-aarch64_be-linux-user.fa.p/accel_accel-common.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_tcg-all.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_cpu-exec-common.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_cpu-exec.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_tcg-runtime-gvec.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_tcg-runtime.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_translate-all.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_translator.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_user-exec.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_user-exec-stub.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_elfload.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_exit.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_fd-trans.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_linuxload.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_main.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_mmap.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_signal.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_strace.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_thunk.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_uaccess.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_uname.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_flatload.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_semihost.c.o libqemu-aarch64_be-linux-user.fa.p/meson-generated_.._aarch64_be-linux-user-gdbstub-xml.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--whole-archive libhwcore.fa libqom.fa -Wl,--no-whole-archive -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static-pie -fstack-protector-strong -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -Wp,-D_GLIBCXX_ASSERTIONS -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,--start-group libqemuutil.a libhwcore.fa libqom.fa /usr/lib/libz.a -lrt -lutil -lm -pthread -lgthread-2.0 -lglib-2.0 -lpcre -lsysprof-capture-4 -lstdc++ -Wl,--end-group
/usr/bin/ld: /usr/lib/gcc/aarch64-unknown-linux-gnu/12.1.0/../../../../lib/libglib-2.0.a(gutils.c.o): in function `g_get_user_database_entry':
gutils.c:(.text+0x324): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: gutils.c:(.text+0xf4): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: gutils.c:(.text+0xe0): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/aarch64-unknown-linux-gnu/12.1.0/../../../../lib/libc.a(init-first.o): in function `__libc_init_first':
(.text+0x10): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-unknown-linux-gnu/12.1.0/../../../../lib/libc.a(environ.o)
/usr/bin/ld: (.text+0x10): warning: too many GOT entries for -fpic, please recompile with -fPIC
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make: *** [Makefile:163: run-ninja] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

crab2313 commented on 2022-05-06 05:30 (UTC) (edited on 2022-05-10 06:45 (UTC) by crab2313)

lto1: internal compiler error: Segmentation fault
0xd24962 internal_error(char const*, ...)
    ???:0
0xe2a874 bp_unpack_string(data_in*, bitpack_d*)
    ???:0
0x12af0f4 cl_optimization_stream_in(data_in*, bitpack_d*, cl_optimization*)
    ???:0
0xe2489e streamer_read_tree_bitfields(lto_input_block*, data_in*, tree_node*)
    ???:0
0xe1fd04 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
    ???:0
0xe220b7 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*, bool)
    ???:0
0xe18351 read_cgraph_and_symbols(unsigned int, char const**)
    ???:0
0x12ac3ea lto_main()
    ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
lto-wrapper: fatal error: c++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Maybe gcc 11.3.0 can fix this.

(edited) Use gcc 12.1.0 from [testing] to build this. Also, glib2-static from AUR is outdated and should be updated as well.

EndlessEden commented on 2022-02-04 16:39 (UTC)

Fails to build; lto1: fatal error: bytecode stream in file ‘/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib/libglib-2.0.a’ generated with LTO version 9.0 instead of the expected 11.0

mattalxndr commented on 2021-11-07 02:09 (UTC)

When I installed this, systemd-binfmt threw some errors:

:: Running post-transaction hooks...
(1/4) Registering binary formats...
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
Failed to add binary format: No such file or directory
error: command failed to execute correctly
(2/4) Arming ConditionNeedsUpdate...
(3/4) Refreshing PackageKit...
(4/4) Removing unnecessary cached files (keeping the latest two)…

The package ended up installing with a zero exit code anyway.

I did notice that the wiki mentions to restasrt systemd-binfmt after you install, but it did not warn about errors during install.

justinkb commented on 2021-10-20 21:14 (UTC)

note that just applying that patch from git doesn't fix the build, since it'll give a linking error also related to some bpf stuff later. so disabling bpf entirely for now is the right fix until that other issue is resolved too

codyps commented on 2021-10-04 16:47 (UTC) (edited on 2021-10-04 16:49 (UTC) by codyps)

Upstream has applied a patch for the eBPF issue: https://patchew.org/QEMU/20210907104512.129103-1-pbonzini@redhat.com/

This package should either apply that patch or disable bpf to fix it's currently broken build (first reported 2021-08-31).

Here's the patch I'm using: https://gist.github.com/bf1387af3668c4fd38d11ca6d6ec04b8

jpkotta commented on 2021-09-06 16:40 (UTC)

Adding --disable-bpf to the configure command (as suggested in the upstream bug report) allows me to build successfully.

mati865 commented on 2021-09-05 10:54 (UTC)

Upstream build error report: https://gitlab.com/qemu-project/qemu/-/issues/566

hcb commented on 2021-09-03 06:18 (UTC)

[270/2905] Compiling C object libcommon.fa.p/ebpf_ebpf_rss.c.o
FAILED: libcommon.fa.p/ebpf_ebpf_rss.c.o 
cc -Ilibcommon.fa.p -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -isystem /srv/arch/auracle/qemu-user-static/src/qemu-6.1.0/linux-headers -isystem linux-headers -iquote . -iquote /srv/arch/auracle/qemu-user-static/src/qemu-6.1.0 -iquote /srv/arch/auracle/qemu-user-static/src/qemu-6.1.0/include -iquote /srv/arch/auracle/qemu-user-static/src/qemu-6.1.0/disas/libvixl -iquote /srv/arch/auracle/qemu-user-static/src/qemu-6.1.0/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIE -MD -MQ libcommon.fa.p/ebpf_ebpf_rss.c.o -MF libcommon.fa.p/ebpf_ebpf_rss.c.o.d -o libcommon.fa.p/ebpf_ebpf_rss.c.o -c ../qemu-6.1.0/ebpf/ebpf_rss.c
In file included from ../qemu-6.1.0/ebpf/ebpf_rss.c:24:
../qemu-6.1.0/ebpf/trace.h:1:10: fatal error: trace/trace-ebpf.h: No such file or directory
    1 | #include "trace/trace-ebpf.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
[271/2905] Compiling C object libcommon.fa.p/accel_accel-user.c.o
[272/2905] Compiling C object libcommon.fa.p/disas_ppc.c.o
[273/2905] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_gdbstub.c.o
[274/2905] Compiling C object libcommon.fa.p/disas_sparc.c.o
[275/2905] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_crypto_helper.c.o
[276/2905] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_cpu.c.o
[277/2905] Compiling C++ object libcommon.fa.p/disas_nanomips.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:156: run-ninja] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

algebro commented on 2021-08-31 22:22 (UTC)

I'm getting the following error trying to build this package:

==> Starting build()...
/usr/bin/strings: 'config-temp/qemu-conf.exe': No such file
/usr/bin/strings: 'config-temp/qemu-conf.exe': No such file
big/little test failed
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'qemu-user-static-6.1.0-1': 
error: packages failed to build: qemu-user-static-6.1.0-1

Any ideas?

crab2313 commented on 2021-08-16 09:31 (UTC)

@Un1Gfn

That's the minimal required kernel version. Try this to other program in your system.

Un1Gfn commented on 2021-08-16 08:02 (UTC) (edited on 2021-08-16 08:02 (UTC) by Un1Gfn)

$ uname -a
Linux 820g3 5.4.138-1-lts54 #1 SMP Thu, 05 Aug 2021 08:02:00 +0000 x86_64 GNU/Linux
$ file /usr/bin/qemu-arm-static
/usr/bin/qemu-arm-static: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), static-pie linked, BuildID[sha1]=f7dc260d1eefa9660ccd97f5836b2d9955323959, for GNU/Linux 4.4.0, stripped

Why is 4.4.0 involved?

crab2313 commented on 2021-01-13 03:27 (UTC)

@l3rc10

Rebuild your glib2-static and pcre-static with gcc 10.

l3rc10 commented on 2021-01-13 03:08 (UTC) (edited on 2021-01-13 03:08 (UTC) by l3rc10)

[533/2818] Linking target qemu-aarch64_be
FAILED: qemu-aarch64_be 
g++  -o qemu-aarch64_be libcommon.fa.p/cpus-common.c.o libcommon.fa.p/disas_i386.c.o libcommon.fa.p/disas_libvixl_vixl_a64_instructions-a64.cc.o libcommon.fa.p/disas_arm.c.o libcommon.fa.p/disas_libvixl_vixl_utils.cc.o libcommon.fa.p/disas_libvixl_vixl_a64_decoder-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_a64_disasm-a64.cc.o libcommon.fa.p/disas_arm-a64.cc.o libcommon.fa.p/disas_libvixl_vixl_compiler-intrinsics.cc.o libcommon.fa.p/hw_core_cpu.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_aarch64_signal.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_aarch64_cpu_loop.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_kvm-stub.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_op_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_debug_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_neon_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_gdbstub.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_arm-semi.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_crypto_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_pauth_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-a64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_tlb_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu_tcg.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_gdbstub64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_cpu.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_sve_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_mte_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_vfp_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_iwmmxt_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_helper-a64.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_translate-sve.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_vec_helper.c.o libqemu-aarch64_be-linux-user.fa.p/target_arm_m_helper.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_mmap.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-common.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_optimize.c.o libqemu-aarch64_be-linux-user.fa.p/fpu_softfloat.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_cpu-exec-common.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_user-exec.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_fd-trans.c.o libqemu-aarch64_be-linux-user.fa.p/accel_stubs_hax-stub.c.o libqemu-aarch64_be-linux-user.fa.p/gdbstub.c.o libqemu-aarch64_be-linux-user.fa.p/trace_control-target.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_safe-syscall.S.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_translator.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op.c.o libqemu-aarch64_be-linux-user.fa.p/exec-vary.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op-vec.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_elfload.c.o libqemu-aarch64_be-linux-user.fa.p/disas.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_linuxload.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_uaccess.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_main.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_tcg-runtime-gvec.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_cpu-exec.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_translate-all.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_exit.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_arm_semihost.c.o libqemu-aarch64_be-linux-user.fa.p/thunk.c.o libqemu-aarch64_be-linux-user.fa.p/cpu.c.o libqemu-aarch64_be-linux-user.fa.p/tcg_tcg-op-gvec.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_flatload.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_uname.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_signal.c.o libqemu-aarch64_be-linux-user.fa.p/accel_stubs_xen-stub.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_tcg-runtime.c.o libqemu-aarch64_be-linux-user.fa.p/accel_stubs_kvm-stub.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_strace.c.o libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o libqemu-aarch64_be-linux-user.fa.p/accel_tcg_user-exec-stub.c.o libqemu-aarch64_be-linux-user.fa.p/meson-generated_.._aarch64_be-linux-user-gdbstub-xml.c.o libqemu-aarch64_be-linux-user.fa.p/meson-generated_.._trace_generated-helpers.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--whole-archive libqom.fa libhwcore.fa -Wl,--no-whole-archive -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static-pie -m64 -fstack-protector-strong -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,--start-group libqemuutil.a libqom.fa libhwcore.fa /usr/lib/libz.a -lrt -pthread -lutil -lm -lgthread-2.0 -lglib-2.0 -lpcre -lstdc++ -Wl,--end-group
lto1: internal compiler error: bytecode stream: expected tag identifier_node instead of LTO_UNKNOWN
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
[534/2818] Compiling C object libqemu-aarch64-linux-user.fa.p/tcg_optimize.c.o
[535/2818] Compiling C object libqemu-aarch64-linux-user.fa.p/tcg_tcg.c.o
[536/2818] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_translate.c.o
[537/2818] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_translate-sve.c.o
[538/2818] Compiling C object libqemu-aarch64-linux-user.fa.p/target_arm_sve_helper.c.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:171: run-ninja] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

dleslie commented on 2021-01-04 16:32 (UTC)

This builds and runs fine on aarch64, please add it as a target.

crab2313 commented on 2021-01-04 01:37 (UTC)

@khvalera

You should import the public key manually when you do not use any AUR helper.

khvalera commented on 2021-01-03 21:13 (UTC)

qemu-5.2.0.tar.xz ... FAILURE (unknown public key 3353C9CEF108B584)

crab2313 commented on 2020-12-10 17:01 (UTC)

@blackhole

You have changed the version of this package. qemu-ppc64abi32-static is deprecated and do not exist in 5.2.0 anymore. Please contact the maintainer of binfmt-qemu-static to remove the entry in qemu-static.conf.

blackhole commented on 2020-12-10 16:50 (UTC)

Yes, but I have changed nothing.

So this is an information more than an error?

So why systemd-binfmt.service is failing?

crab2313 commented on 2020-12-10 16:41 (UTC) (edited on 2020-12-10 16:42 (UTC) by crab2313)

@blackhole

  • ppc64abi32-linux-user is deprecated and only built when explicitly enabled in --target-list

  • tilegx-linux-user is deprecated and only built when explicitly enabled in --target-list

blackhole commented on 2020-12-10 16:15 (UTC)

After updating to 5.2 systemd-binfmt.service fails with errors.

In journal I see this:

Failed to add binary format: No such file or directory

binfmt_misc: register: failed to install interpreter file /usr/bin/qemu-ppc64abi32-static

etc.

Libgxps commented on 2020-12-01 10:10 (UTC) (edited on 2020-12-05 17:56 (UTC) by Libgxps)

Please add the aarch64 architecture. It builds quite nicely e.g. on the PBP. Thank you for your support.

crab2313 commented on 2020-09-13 11:19 (UTC)

@vbextreme The URL you mentioned is obviously not referenced by this package.

vbextreme commented on 2020-09-13 08:53 (UTC)

wrong url

https://deb.debian.org/debian/pool/main/q/qemu/qemu-user-static_5.1+dfsg-3_amd64.deb

error 404

crab2313 commented on 2020-07-22 01:12 (UTC) (edited on 2020-07-22 01:28 (UTC) by crab2313)

@nismbu You mean GPG signature? It is obviously signed by the upstream. Please read the wiki before posting any bug report. https://wiki.archlinux.org/index.php/Makepkg#Signature_checking

nismbu commented on 2020-07-22 00:17 (UTC)

I'm unable to install the packages because there seems to be a problem with your PGP signature.

crab2313 commented on 2020-06-09 02:25 (UTC) (edited on 2020-06-09 02:26 (UTC) by crab2313)

NOTE: The version of pcre-static and glib2-static should match their corresponding non-static system libraries since they are just static libraries without C headers.

titaniumtown commented on 2020-05-24 19:37 (UTC)

Ok, if I manually change it to qemu 5.0.0, I get this error:

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target

This might want to be addressed before updating to 5.0.0

titaniumtown commented on 2020-05-16 23:03 (UTC)

Is this going to be updated?

simonfxr commented on 2019-08-26 12:51 (UTC)

@PedroHLC See https://aur.archlinux.org/packages/qemu-user-static/#comment-698555. Rebuild glib2-static, possibly also pcre-static should fix the linker error. I will try to update the PKGBUILD to check for outdated static lto libs.

PedroHLC commented on 2019-08-26 12:12 (UTC) (edited on 2019-08-26 12:15 (UTC) by PedroHLC)

I'm getting:

lto1: fatal error: bytecode stream in file "/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib/libglib-2.0.a" generated with LTO version 7.1 instead of the expected 8.0

EDIT2: Obviously, the solution is to rebuild glib2-static. Sorry for making this comment...

jamincollins commented on 2019-06-29 23:44 (UTC)

Building in a chroot fails:

==> Extracting sources...
  -> Extracting qemu-4.0.0.tar.xz with bsdtar
==> Starting prepare()...
==> Starting build()...

ERROR: Python not found. Use --python=/path/to/python

==> ERROR: A failure occurred in build().
    Aborting...

The following diff appears to fix it:

diff --git a/PKGBUILD b/PKGBUILD
index 0d10cea..4c500a2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -32,6 +32,7 @@ build() (
   cd build-user-static

   ../qemu-${pkgver}/configure \
+    --python=/bin/python2 \
     --prefix=/usr \
     --sysconfdir=/etc \
     --localstatedir=/var \

atemu commented on 2019-06-28 15:49 (UTC)

@DDoSolitary clean building pcre-static did the trick, thanks!

yaron commented on 2019-06-27 13:03 (UTC)

I got the same one as @atemu only the versions are 7.0 and the expected is 7.1 (LTO)

DDoSolitary commented on 2019-06-27 11:46 (UTC)

@atemu I think rebuilding the dependency glib2-static will fix the problem. You probably also need to rebuild pcre-static if it's built by an older version of gcc too.

DDoSolitary commented on 2019-06-27 07:20 (UTC)

The same error here as what @atemu encountered.

atemu commented on 2019-06-26 18:20 (UTC)

I get the following error when building:

  LINK    qemu-ga
/usr/bin/ld: libqemuutil.a(qemu-sockets.o): in function `inet_connect_saddr':
qemu-sockets.c:(.text+0xba6): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
lto1: fatal error: bytecode stream in file ‘/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib/libglib-2.0.a’ generated with LTO version 7.1 instead of the expected 8.0
compilation terminated.
lto-wrapper: fatal error: c++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [Makefile:570: qemu-ga] Error 1
make: *** Waiting for unfinished jobs....
==> ERROR: A failure occurred in build().

simonfxr commented on 2019-05-21 17:46 (UTC) (edited on 2019-05-21 17:49 (UTC) by simonfxr)

Please update :-) Here is the trivial patch, I successfully use:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@

 pkgname=qemu-user-static
 pkgdesc="Statically linked binaries of Qemu with user emulation. Useful for containers/chroot environment with binfmt."
-pkgver=3.1.0
+pkgver=4.0.0
 pkgrel=1
 arch=(x86_64)
 license=(GPL2 LGPL2.1)
@@ -10,7 +10,7 @@ url="http://wiki.qemu.org/"
 depends=()
 makedepends=(python2 glib2-static pcre-static)
 source=(https://download.qemu.org/qemu-$pkgver.tar.xz{,.sig})
-sha512sums=('7e8dae823937cfac2f0c60406bd3bdcb89df40313dab2a4bed327d5198f7fcc68ac8b31e44692caa09299cc71256ee0b8c17e4f49f78ada8043d424f5daf82fe'
+sha512sums=('952e94194ce9e64c15388c59035cb31fb9f761d30095c2fb9441012b609c18c9976285727b93bf37b95e15675802d73f8e1c4619ebecd23606675bb503646b13'
             'SKIP')
 validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')

PedroHLC commented on 2019-01-22 16:33 (UTC)

I'm also with @DDosSolitary having problem with "python not found"

DDoSolitary commented on 2019-01-18 13:31 (UTC)

@ogarcia For me the key can be downloaded properly. You can try multiple times with different key servers.

DDoSolitary commented on 2019-01-18 13:27 (UTC)

Can't build:

ERROR: Python not found. Use --python=/path/to/python

I think it's because the python2 package installs /usr/bin/python2 while the build script looks for /usr/bin/python. Adding --python=/usr/bin/python2 for the ./configure command should work.

ogarcia commented on 2019-01-17 17:51 (UTC)

==> Verifying source file signatures with gpg...
    qemu-3.1.0.tar.xz ... FAILED (unknown public key 3353C9CEF108B584)

Cannot find key in keyservers:

$ gpg --recv-keys 3353C9CEF108B584
gpg: keyserver receive failed: No data

tmn505 commented on 2019-01-13 00:44 (UTC)

Needs python instead of python2.