After an upgrade to the current stable version of sys-devel/gcc-12.2.1_p20230121-r1 I couldn't rebuild current stable version of app-emulation/xen-tools-4.15.4-r1 ebuild with USE="ovmf" flag. Reproducible: Always Steps to Reproduce: 1. Install the latest sys-devel/gcc-12.2.1_p20230121-r1 ebuild and update profile accordingly using "gcc-config 2 && . /etc/profile" commands; 2. Run xen-tools package compilation with "USE="ovmf" emerge =app-emulation/xen-tools-4.15.4-r1"; Actual Results: app-emulation/xen-tools-4.15.4-r1 ebuild compilations fails at compile phase: ... make[9]: Entering directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/GenFfs' gcc -c -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -MD -fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -g -O2 GenFfs.c -o GenFfs.o In function ‘GetAlignmentFromFile’, inlined from ‘main’ at GenFfs.c:816:20: GenFfs.c:545:5: error: pointer ‘InFileHandle’ used after ‘fclose’ [-Werror=use-after-free] 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GenFfs.c:544:5: note: call to ‘fclose’ here 544 | fclose (InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[9]: *** [../Makefiles/footer.makefile:21: GenFfs.o] Error 1 make[9]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/GenFfs' make[8]: *** [GNUmakefile:76: GenFfs] Error 2 make[8]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools/Source/C' make[7]: *** [GNUmakefile:19: Source/C] Error 2 make[7]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools' make[6]: *** [Makefile:20: build] Error 2 make[6]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote' make[5]: *** [/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/../../tools/Rules.mk:161: subdir-all-ovmf-dir] Error 2 make[5]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware' make[4]: *** [/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/../../tools/Rules.mk:156: subdirs-all] Error 2 make[4]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware' make[3]: *** [Makefile:37: all] Error 2 make[3]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware' make[2]: *** [/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/../tools/Rules.mk:161: subdir-all-firmware] Error 2 make[2]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools' make[1]: *** [/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/../tools/Rules.mk:156: subdirs-all] Error 2 make[1]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools' make: *** [Makefile:63: build-tools] Error 2 * ERROR: app-emulation/xen-tools-4.15.4-r1::gentoo failed (compile phase): * emake failed ... Expected Results: "USE="ovmf" emerge =app-emulation/xen-tools-4.15.4-r1" command completes successfully. If I omit "ovmf" USE-flag or rollback to gcc:11 "sys-devel/gcc-11.3.1_p20221209" then compilation succeeds.
Created attachment 849656 [details] emerge --info
Can you include the full build.log too please? Thanks.
Created attachment 849658 [details] environment
Created attachment 849660 [details] duplicate emerge-info file attached
Comment on attachment 849660 [details] duplicate emerge-info file attached build.log exceeded file size limit. This is the wrong file.
Created attachment 849662 [details] app-emulation_xen-tools-4.15.4-r1 build.log file full build log file
(In reply to Sam James from comment #2) > Can you include the full build.log too please? Thanks. Absolutely. Full build.log file was attached. Thank you.
See https://edk2.groups.io/g/devel/message/87983.
I ran into this problem, too. ... make[9]: Entering directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/GenFfs' gcc -c -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -MD -fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -g -O2 GenFfs.c -o GenFfs.o In function ‘GetAlignmentFromFile’, inlined from ‘main’ at GenFfs.c:816:20: GenFfs.c:545:5: error: pointer ‘InFileHandle’ used after ‘fclose’ [-Werror=use-after-free] 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GenFfs.c:544:5: note: call to ‘fclose’ here 544 | fclose (InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[9]: *** [../Makefiles/footer.makefile:21: GenFfs.o] Error 1 make[9]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.15.4-r1/work/xen-4.15.4/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/GenFfs'
I tried to finesse this by trying the currently unstable branch of xen and xen-tools: ACCEPT_KEYWORDS="~amd64" emerge =app-emulation/xen-4.16.3 And the result was the same: xen-tools failed as the same spot. I'll try making a patch based upon the lead of Sam James in his Comment #8 and report.
Created attachment 850408 [details] Build Log for 4.16.3 Same failure as in 4.15.4.
Created attachment 850410 [details] environment for 4.16.3 attempt to build xen-tools
hmmm... should I open a separate bug for 4.16.3 and place my files there? I'm not sure on the protocol when the same bug affects two different versions.
(In reply to John L. Poole from comment #13) > hmmm... should I open a separate bug for 4.16.3 and place my files there? > I'm not sure on the protocol when the same bug affects two different > versions. No, it's ok as-is. tomáš, can you take a look? I can handle it if not, but I'll be doing it blind (just checking the patch applies & looks sensible).
Seems like it compiles with latest ovmf snapshot, can you please test https://github.com/gentoo/gentoo/pull/30642? Thanks!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ac65c3cafe4259c50ec0c05a7ce755af950dc1d commit 3ac65c3cafe4259c50ec0c05a7ce755af950dc1d Author: Tomáš Mózes <hydrapolic@gmail.com> AuthorDate: 2023-04-18 15:07:03 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-04-19 06:06:47 +0000 app-emulation/xen-tools: use latest ovmf snapshot Closes: https://github.com/gentoo/gentoo/pull/30642 Closes: https://bugs.gentoo.org/892872 Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> app-emulation/xen-tools/Manifest | 3 +++ .../xen-tools/xen-tools-4.16.4_pre1.ebuild | 25 +++++++--------------- .../xen-tools/xen-tools-4.17.1_pre1.ebuild | 15 +++---------- 3 files changed, 14 insertions(+), 29 deletions(-)