This is an auto-filed bug because app-emulation/qemu fails to compile. The issue was originally discovered on amd64, but it may be reproducible on other arches as well. If you think that a different summary clarifies the issue better, feel free to change it. Attached build log and emerge --info. NOTE: If you need further logs, feel free to ask.
Created attachment 642960 [details] build.log.bz2 build log and emerge --info
Probably related to -fno-common failure on one of configurations: """ /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../libqemuutil.a(machine-init-done.o): in function `qemu_add _machine_init_done_notifier': machine-init-done.c:(.text+0x0): multiple definition of `qemu_add_machine_init_done_notifier'; softmmu/vl.o:vl.c:(.text+0x24a0): first defin ed here /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../libqemuutil.a(machine-init-done.o): warning: definition o f `machine_init_done' overriding common from softmmu/vl.o collect2: error: ld returned 1 exit status make[1]: *** [Makefile:208: qemu-system-x86_64] Error 1 """
Note that I'm using -fcommon to overwrite gcc10 behavior.
Oh, i completely missed that! That's unusual and might explain why I don't see it locally. I'll try with -fcommon.
Tried it with gcc10 and -fcommon in CFLAGS, I have the same error.
I have this issue with qemu-5.2.0 and gcc-9.3.0: -------- /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libqemuutil.a(stubs_machine-init-done.c.o): in function `qemu_add_machine_init_done_notifier': /data/portage/portage/app-emulation/qemu-5.2.0-r1/work/qemu-5.2.0/softmmu-build/../stubs/machine-init-done.c:8: multiple definition of `qemu_add_machine_init_done_notifier'; libqemu-x86_64-softmmu.fa.p/softmmu_vl.c.o:/data/portage/portage/app-emulation/qemu-5.2.0-r1/work/qemu-5.2.0/softmmu-build/../softmmu/vl.c:2381: first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libqemuutil.a(stubs_machine-init-done.c.o): warning: definition of `machine_init_done' overriding common from libqemu-x86_64-softmmu.fa.p/softmmu_vl.c.o collect2: error: ld returned 1 exit status -------- Linker is /usr/x86_64-pc-linux-gnu/binutils-bin/2.35.1/ld
It looks like -fcommon in CFLAGS breaks the build. I am able to compile qemu-5.2.0 without -fcommon in CFLAGS, but it fails with reported error if I have -fcommon in CFLAGS. Tried with gcc-10.2.0-r5.
(In reply to gordon from comment #7) > It looks like -fcommon in CFLAGS breaks the build. > I am able to compile qemu-5.2.0 without -fcommon in CFLAGS, but it fails > with reported error if I have -fcommon in CFLAGS. > Tried with gcc-10.2.0-r5. Can you attach your build.log? Last time I tried I did not see -fcommon failures.
Created attachment 695739 [details] fcommon.log
Created attachment 695742 [details] no-fcommon.log Same everything except no -fcommon in CFLAGS
Created attachment 695745 [details] emerge-info
Comment on attachment 695739 [details] fcommon.log With CFLAGS+=-fcommon
Reproduced locally as well. Thank you! Looking at it now.
`machine_init_done` has a slight mismatch in section types defined: .common vs .data. $ nm libqemuutil.a.p/stubs_machine-init-done.c.o | fgrep machine_init 0000000000000000 D machine_init_done 0000000000000000 T qemu_add_machine_init_done_notifier $ nm libqemu-x86_64-softmmu.fa.p/softmmu_vl.c.o | fgrep machine_init 0000000000000001 C machine_init_done 0000000000000230 b machine_init_done_notifiers U qdev_machine_init 00000000000024d0 T qemu_add_machine_init_done_notifier 0000000000002510 T qemu_remove_machine_init_done_notifier They either should both be common definitions or one of them should be declaraion.
Conflisting definitions are: $ git grep -P '[^a-z_]machine_init_done[^a-z_]' | cat chardev/char-mux.c: if (!machine_init_done) { chardev/char-mux.c: *be_opened = machine_init_done; include/sysemu/sysemu.h:extern bool machine_init_done; softmmu/vl.c:bool machine_init_done; softmmu/vl.c: if (machine_init_done) { softmmu/vl.c: machine_init_done = true; stubs/machine-init-done.c:bool machine_init_done = true;
`machine_init_dome` conflicts were solved upstream: https://github.com/qemu/qemu/commit/6b21670cfda76e47a827810eea5eb3b518cb6521 Unfortunately I can't easily backport fixes as is as they move too much code dependent on other commits. As a very crude workaround I suggest do a 'filter-flags -fcommon' in the ebuild itself (and drop it for next qemu release.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0837524b145743820a05177f77a6d7c05f677df4 commit 0837524b145743820a05177f77a6d7c05f677df4 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-03-29 22:55:01 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-03-29 22:55:13 +0000 app-emulation/qemu: filter out -fcommon Next qemu release should have a proper fix for symbol collision: $ git grep -P '[^a-z_]machine_init_done[^a-z_]' | cat softmmu/vl.c:bool machine_init_done; stubs/machine-init-done.c:bool machine_init_done = true; I'm not comfortable backporting the change and only filtering out -fcommon as a workaround. We'll remove a workaround in next release. Reported-by: Agostino Sarubbo Reported-by: gordon@niflheim.info Closes: https://bugs.gentoo.org/726560 Package-Manager: Portage-3.0.17, Repoman-3.0.2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> app-emulation/qemu/qemu-5.2.0-r3.ebuild | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)