coconut-svsm / svsm

COCONUT-SVSM
MIT License
108 stars 40 forks source link

QEMU building error in Compiling C object libcommon.fa.p/backends_igvm.c.o #352

Open rnldourado opened 4 months ago

rnldourado commented 4 months ago

When building QEMU, I encounter an error during the ninja -C build/ step and I can't resolve it.

Compiling C object libcommon.fa.p/backends_igvm.c.o                                                                                                                                                  [9/1969]
FAILED: libcommon.fa.p/backends_igvm.c.o                                                                                                                                                                           
cc -m64 -mcx16 -Ilibcommon.fa.p -Isubprojects/dtc/libfdt -I../subprojects/dtc/libfdt -Iui -I../ui -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-li
nux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -fstack-protector-strong -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototyp
es -Wredundant-decls -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defin
ed -Wimplicit-fallthrough=2 -Wmissing-format-attribute -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -Wshadow=local -isystem /home/raniel/qemu/linux-headers -isystem linux-headers -iquote . -iqu
ote /home/raniel/qemu -iquote /home/raniel/qemu/include -iquote /home/raniel/qemu/host/include/x86_64 -iquote /home/raniel/qemu/host/include/generic -iquote /home/raniel/qemu/tcg/i386 -pthread -D_GNU_SOURCE -D_F
ILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -fPIE -MD -MQ libcommon.fa.p/backends_igvm.c.o -MF libcommon.fa.p/backends_igvm.c.o.d -o libcommon.fa.p/backends_igvm.c.o -c ../bac
kends/igvm.c                                                                                                                                                                                                       
../backends/igvm.c:127:27: error: ‘HEADER_SECTION_DIRECTIVE’ undeclared here (not in a function); did you mean ‘IGVM_HEADER_SECTION_DIRECTIVE’?                                                                    
  127 |     { IGVM_VHT_PAGE_DATA, HEADER_SECTION_DIRECTIVE, directive_page_data },
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~
      |                           IGVM_HEADER_SECTION_DIRECTIVE
../backends/igvm.c:136:30: error: ‘HEADER_SECTION_INITIALIZATION’ undeclared here (not in a function); did you mean ‘IGVM_HEADER_SECTION_INITIALIZATION’?
  136 |     { IGVM_VHT_GUEST_POLICY, HEADER_SECTION_INITIALIZATION, initialization_guest_policy },
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              IGVM_HEADER_SECTION_INITIALIZATION
../backends/igvm.c: In function ‘igvm_type_to_cgs_type’:
../backends/igvm.c:226:10: error: ‘NORMAL’ undeclared (first use in this function)
  226 |     case NORMAL: {
      |          ^~~~~~
../backends/igvm.c:226:10: note: each undeclared identifier is reported only once for each function it appears in
../backends/igvm.c:233:10: error: ‘SECRETS’ undeclared (first use in this function)
  233 |     case SECRETS:
      |          ^~~~~~~
../backends/igvm.c:235:10: error: ‘CPUID_DATA’ undeclared (first use in this function)
  235 |     case CPUID_DATA:
      |          ^~~~~~~~~~
../backends/igvm.c:237:10: error: ‘CPUID_XF’ undeclared (first use in this function)
  237 |     case CPUID_XF:
      |          ^~~~~~~~
../backends/igvm.c: In function ‘directive_memory_map’:
../backends/igvm.c:541:50: error: ‘MEMORY’ undeclared (first use in this function); did you mean ‘MEMORY_H’?
  541 |                     mm_entry[entry].entry_type = MEMORY;
      |                                                  ^~~~~~
      |                                                  MEMORY_H
../backends/igvm.c:544:50: error: ‘PLATFORM_RESERVED’ undeclared (first use in this function); did you mean ‘IPPORT_RESERVED’?
  544 |                     mm_entry[entry].entry_type = PLATFORM_RESERVED;
      |                                                  ^~~~~~~~~~~~~~~~~
      |                                                  IPPORT_RESERVED
../backends/igvm.c:550:50: error: ‘PERSISTENT’ undeclared (first use in this function)
  550 |                     mm_entry[entry].entry_type = PERSISTENT;
      |                                                  ^~~~~~~~~~
../backends/igvm.c: In function ‘supported_platform_compat_mask’:
../backends/igvm.c:713:48: error: ‘HEADER_SECTION_PLATFORM’ undeclared (first use in this function); did you mean ‘IGVM_HEADER_SECTION_PLATFORM’?
  713 |     result = igvm_header_count(ctx->cgs->igvm, HEADER_SECTION_PLATFORM);
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~
      |                                                IGVM_HEADER_SECTION_PLATFORM
roy-hopkins commented 4 months ago

The main branch of the IGVM library now contains breaking changes. I will be updating the SVSM QEMU soon, but in the meantime if you build and install this version of the IGVM library then you should be able to get QEMU to build:

https://github.com/microsoft/igvm/tree/igvm-v0.1.6

rnldourado commented 4 months ago

Thank you!! I switch to this version, but the error persists:

FAILED: ui/libdbus-display1.a.p/meson-generated_.._dbus-display1.c.o                                                                                                                                               
cc -m64 -mcx16 -Iui/libdbus-display1.a.p -Iui -I../ui -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -fdiagnostics-c
olor=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -fstack-protector-strong -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -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 -Wmissing-format-attribute -Wno-missing-
include-dirs -Wno-shift-negative-value -Wno-psabi -Wshadow=local -isystem /home/raniel/qemu/linux-headers -isystem linux-headers -iquote . -iquote /home/raniel/qemu -iquote /home/raniel/qemu/include -iquote /hom
e/raniel/qemu/host/include/x86_64 -iquote /home/raniel/qemu/host/include/generic -iquote /home/raniel/qemu/tcg/i386 -pthread -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-com
mon -fwrapv -fPIE -MD -MQ ui/libdbus-display1.a.p/meson-generated_.._dbus-display1.c.o -MF ui/libdbus-display1.a.p/meson-generated_.._dbus-display1.c.o.d -o ui/libdbus-display1.a.p/meson-generated_.._dbus-displa
y1.c.o -c ui/dbus-display1.c         

An important observation is that I'm using Ubuntu.

cclaudio commented 3 months ago

The igvm-v0.1.6 worked for me, thanks @roy-hopkins

We could freeze a specific igvm version for the SVSM development, e.g. we could update the SVSM INSTALL.md to build the igvm-v0.1.6

ramagali24 commented 3 months ago

I had similar issue and this i show i resolved. add below to igcm_c/igvm.h file

define HEADER_SECTION_DIRECTIVE 10

define HEADER_SECTION_INITIALIZATION 11

define NORMAL 1

define SECRETS 2

define CPUID_DATA 3

define CPUID_XF 4

define MEMORY 5

define PLATFORM_RESERVED 6

define PERSISTENT 7

define SEV_SNP 9

define HEADER_SECTION_DIRECTIVE 10

define HEADER_SECTION_INITIALIZATION 11

define HEADER_SECTION_PLATFORM 12

jianlinjiang commented 1 month ago

I also met the same issue same as igvm-v0.1.6