I'm building qemu on ubuntu 20.04.
Building on ubuntu 16.04 worked fine.
The edk2 build gives the following build error :
gcc -c -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -O2 EfiUtilityMsgs.c -o EfiUtilityMsgs.o
In file included from /usr/include/string.h:495,
from EfiUtilityMsgs.c:16:
In function ‘strncat’,
inlined from ‘PrintMessage’ at EfiUtilityMsgs.c:484:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 511 bytes from a string of length 511 [-Werror=stringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncat’,
inlined from ‘PrintMessage’ at EfiUtilityMsgs.c:469:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 511 bytes from a string of length 511 [-Werror=stringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncat’,
inlined from ‘PrintMessage’ at EfiUtilityMsgs.c:511:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 511 bytes from a string of length 511 [-Werror=stringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
I added -Wno-stringop-truncation and -Wno-stringop-overflow to the header.makefile in the edk2.
But even so, after the build process finished I got the following error:
make[1]: Entering directory '/home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables'
"gcc" -c -o /home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Facp.obj -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=PlatformAcpiTablesStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -x c -m64 -fno-lto -I/home/linuxboot/edk2/OvmfPkg/AcpiTables -I/home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/DEBUG -I/home/linuxboot/edk2/MdePkg -I/home/linuxboot/edk2/MdePkg/Include -I/home/linuxboot/edk2/MdePkg/Include/X64 -I/home/linuxboot/edk2/OvmfPkg -I/home/linuxboot/edk2/OvmfPkg/Include /home/linuxboot/edk2/OvmfPkg/AcpiTables/Facp.aslc
"gcc" -o /home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Facp.dll -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable -Wl,-m,elf_x86_64 /home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Facp.obj
/usr/bin/ld: /home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/./Facp.dll: error: PHDR segment not covered by LOAD segment
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables'
make[1]: *** [GNUmakefile:360: /home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/Facp.acpi] Error 1
build.py...
: error 7000: Failed to execute command
make tbuild [/home/linuxboot/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AcpiTables/AcpiTables]
build.py...
: error F002: Failed to build module
/home/linuxboot/edk2/OvmfPkg/AcpiTables/AcpiTables.inf [X64, GCC5, DEBUG]