system76 / edk2

EDK II
http://www.tianocore.org/edk2/
Other
1 stars 3 forks source link

Build Error #42

Closed MilesBHuff closed 1 year ago

MilesBHuff commented 1 year ago

I get the following error when trying to build https://github.com/system76/firmware-open with both the latest code and the code as of hash https://github.com/system76/firmware-open/commit/b337ac66fb3b8d77880e81f35acf3c50072a85c2 (the last safe commit for 10th gen and older):

/home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c: In function ‘UsbIoBulkTransfer’:
/home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c:267:13: error: ‘UsbHcBulkTransfer’ accessing 80 bytes in a region of size 8 [-Werror=stringop-overflow=]
  267 |   Status  = UsbHcBulkTransfer (
      |             ^~~~~~~~~~~~~~~~~~~
  268 |               Dev->Bus,
      |               ~~~~~~~~~
  269 |               Dev->Address,
      |               ~~~~~~~~~~~~~
  270 |               Endpoint,
      |               ~~~~~~~~~
  271 |               Dev->Speed,
      |               ~~~~~~~~~~~
  272 |               EpDesc->Desc.MaxPacketSize,
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 |               BufNum,
      |               ~~~~~~~
  274 |               &Data,
      |               ~~~~~~
  275 |               DataLength,
      |               ~~~~~~~~~~~
  276 |               &Toggle,
      |               ~~~~~~~~
  277 |               Timeout,
      |               ~~~~~~~~
  278 |               &Dev->Translator,
      |               ~~~~~~~~~~~~~~~~~
  279 |               UsbStatus
      |               ~~~~~~~~~
  280 |               );
      |               ~
/home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c:267:13: note: referencing argument 7 of type ‘void *[10]’
In file included from /home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h:40,
                 from /home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c:10:
/home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h:145:1: note: in a call to function ‘UsbHcBulkTransfer’
  145 | UsbHcBulkTransfer (
      | ^~~~~~~~~~~~~~~~~
make: Nothing to be done for 'tbuild'.
Building ... /home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/user/Development/system76/firmware-open/edk2/UefiCpuPkg/CpuDxe/CpuDxe.inf [X64]
cc1: all warnings being treated as errors
make: *** [GNUmakefile:365: /home/user/Development/system76/firmware-open/edk2/Build/UefiPayloadPkgX64/RELEASE_COREBOOT/X64/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe/OUTPUT/UsbBus.obj] Error 1

build.py...
 : error 7000: Failed to execute command
        make tbuild [/home/user/Development/system76/firmware-open/edk2/Build/UefiPayloadPkgX64/RELEASE_COREBOOT/X64/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe]

build.py...
 : error 7000: Failed to execute command
        make tbuild [/home/user/Development/system76/firmware-open/edk2/Build/UefiPayloadPkgX64/RELEASE_COREBOOT/X64/UefiCpuPkg/CpuDxe/CpuDxe]

build.py...
 : error F002: Failed to build module
        /home/user/Development/system76/firmware-open/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf [X64, COREBOOT, RELEASE]

Full log: https://gist.github.com/MilesBHuff/145df4d28f359504d691e2a41da93887#file-build-log


OS: OpenSUSE Tumbleweed I've installed all of the dependencies in scripts/deps.sh, afaict.

crawfxrd commented 1 year ago

Your toolchain setup is broken. The build is using the system provided GCC and not the coreboot provided GCC.

Are crossgcc-i386 and crossgcc-x64 built in coreboot?

MilesBHuff commented 1 year ago

The build is using the system provided GCC and not the coreboot provided GCC.

Ahh gotcha. Yes, that is correct; I symlinked my system's GCC binaries into coreboot, since the build was complaining that they were missing, and buildgcc in system76/firmware-open/coreboot/util/crossgcc didn't provide those binaries when I ran it.

Are crossgcc-i386 and crossgcc-x64 built in coreboot?

I ran buildgcc in system76/firmware-open/coreboot/util/crossgcc; it seems to have only built i386.


Ah, and this is where looking at an issue in the day and not late at night comes in handy: I just needed to notice the existence of, and read, the Makefile. This is what I needed to run: CPUS=$(nproc) make build-x64.

Unfortunately, I'm still seeing the following error:

/home/user/Development/system76/firmware-open/coreboot/util/crossgcc/xgcc/bin/x86_64-elf-gcc-ar: Cannot find binary 'x86_64-elf-ar'
make: *** [GNUmakefile:412: /home/user/Development/system76/firmware-open/edk2/Build/UefiPayloadPkgX64/RELEASE_COREBOOT/X64/UefiCpuPkg/CpuDxe/CpuDxe/OUTPUT/CpuDxe.lib] Error 1

...which is odd, because that file definitely exists at that location, and is not a symlink any longer.

crawfxrd commented 1 year ago

crossgcc-i386 and crossgcc-x64 are the coreboot targets to build.

MilesBHuff commented 1 year ago

Ah! I see now what you meant. I need to build coreboot on its own, with those targets, before I can build the firmware. I thought per the firmware's README that I only needed to build the firmware itself.

Alas, it seems it may no longer be possible to build the older version of coreboot used in b337ac6:

You can now run NASM from /home/user/Development/system76/firmware-open/coreboot/util/crossgcc/xgcc.
Welcome to the coreboot cross toolchain builder v2022-07-30_ae157d38e3 

Building toolchain using 16 thread(s).

Downloading and verifying tarballs ...
 * acpica-unix2-20220331.tar.gz (downloading from https://acpica.org/sites/acpica/files/acpica-unix2-20220331.tar.gz)...   0%... Failed to download acpica-unix2-20220331.tar.gz.
make[1]: *** [Makefile:23: build_iasl] Error 1
make: *** [util/crossgcc/Makefile.inc:30: crossgcc-i386] Error 2

Trying again with the latest code, though, I was indeed able to build coreboot using the targets you provided. (Huzzah!) Unfortunately, I'm still running into the same error as above when I try to built the firmware:

/home/user/Development/system76/firmware-open/coreboot/util/crossgcc/xgcc/bin/x86_64-elf-gcc-ar: Cannot find binary 'x86_64-elf-ar'

Which, again, is weird, because this file exists:

-rwxr-xr-x 1 user user 49280 Jul 27 11:04 /home/user/Development/system76/firmware-open/coreboot/util/crossgcc/xgcc/bin/x86_64-elf-gcc-ar
crawfxrd commented 1 year ago

I cannot reproduce this on a fresh clone.

Try cleaning edk2:

git -C edk2 clean -dffx
crawfxrd commented 9 months ago

New coreboot toolchain uses GCC 13 and hits this issue. The fix been cherry-picked to system76-stable202108.

MilesBHuff commented 9 months ago

Sorry for disappearing earlier -- life got busy and I never got back around to trying to compile this. Given what you just found, it sounds like the issue I was experiencing may have just been me running too new a version of GCC. Thanks for following up.