tenclass / mvisor

A mini x86 hypervisor
GNU General Public License v3.0
185 stars 45 forks source link

Build error on Arch Linux GCC14 #26

Open ProgrammerIn-wonderland opened 1 month ago

ProgrammerIn-wonderland commented 1 month ago

Hello, I am trying to build this project on arch linux, I have the dependencies installed and the build setup succeeds with the commandline meson setup build -Dsdl=true -Dvgpu=true however the build command fails as follows

alice@Felix ~/git-applications/mvisor/mvisor$ meson compile -C build                 
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /sbin/ninja -C /home/alice/git-applications/mvisor/mvisor/build
ninja: Entering directory `/home/alice/git-applications/mvisor/mvisor/build'
[105/167] Compiling C++ object mvisor.p/devices_display_qxl_qxl_render.cc.o
FAILED: mvisor.p/devices_display_qxl_qxl_render.cc.o 
c++ -Imvisor.p -I. -I.. -I../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/pixman-1 -I/usr/include/virgl -I/usr/include/libdrm -I/usr/include/SDL2 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O2 -g -Wno-address-of-packed-member -Wno-missing-field-initializers -mavx2 -DPROTOBUF_USE_DLLS -DNOMINMAX -D_REENTRANT -pthread -MD -MQ mvisor.p/devices_display_qxl_qxl_render.cc.o -MF mvisor.p/devices_display_qxl_qxl_render.cc.o.d -o mvisor.p/devices_display_qxl_qxl_render.cc.o -c ../devices/display/qxl/qxl_render.cc
In file included from ../devices/display/qxl/canvas/macros.h:22,
                 from ../devices/display/qxl/canvas/log.h:26,
                 from ../devices/display/qxl/canvas/mem.h:22,
                 from ../devices/display/qxl/canvas/draw.h:37,
                 from ../devices/display/qxl/canvas/sw_canvas.h:25,
                 from ../devices/display/qxl/qxl_render.h:30,
                 from ../devices/display/qxl/qxl_render.cc:22:
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ‘)’ token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:57,
                 from /usr/include/google/protobuf/descriptor.h:44,
                 from /usr/include/google/protobuf/message.h:105,
                 from ../include/migration.h:22,
                 from ../include/vcpu.h:29,
                 from ../include/machine.h:34,
                 from ../devices/display/qxl/qxl.h:28,
                 from ../devices/display/qxl/qxl_render.cc:23:
/usr/include/absl/container/internal/btree.h:1578:3: error: two or more data types in declaration of ‘_gl_verify_function14’
 1578 |   void verify() const;
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ‘;’ at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree.h:1578:17: error: declaration does not declare anything [-fpermissive]
 1578 |   void verify() const;
      |                 ^~~~~
../devices/display/qxl/canvas/verify.h:208:5: error: expected unqualified-id before ‘extern’
  208 |     extern int (*_GL_GENSYM (_gl_verify_function) (void))              \
      |     ^~~~~~
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ‘)’ token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:58:
/usr/include/absl/container/internal/btree_container.h:224:3: error: two or more data types in declaration of ‘_gl_verify_function16’
  224 |   void verify() const { tree_.verify(); }
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ‘;’ at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree_container.h:224:23: error: expected unqualified-id before ‘{’ token
  224 |   void verify() const { tree_.verify(); }
      |                       ^
[106/167] Compiling C++ object mvisor.p/devices_display_qxl_qxl_parser.cc.o
FAILED: mvisor.p/devices_display_qxl_qxl_parser.cc.o 
c++ -Imvisor.p -I. -I.. -I../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/pixman-1 -I/usr/include/virgl -I/usr/include/libdrm -I/usr/include/SDL2 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O2 -g -Wno-address-of-packed-member -Wno-missing-field-initializers -mavx2 -DPROTOBUF_USE_DLLS -DNOMINMAX -D_REENTRANT -pthread -MD -MQ mvisor.p/devices_display_qxl_qxl_parser.cc.o -MF mvisor.p/devices_display_qxl_qxl_parser.cc.o.d -o mvisor.p/devices_display_qxl_qxl_parser.cc.o -c ../devices/display/qxl/qxl_parser.cc
In file included from ../devices/display/qxl/canvas/macros.h:22,
                 from ../devices/display/qxl/canvas/log.h:26,
                 from ../devices/display/qxl/canvas/mem.h:22,
                 from ../devices/display/qxl/canvas/draw.h:37,
                 from ../devices/display/qxl/qxl_parser.h:22,
                 from ../devices/display/qxl/qxl_parser.cc:21:
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ‘)’ token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:57,
                 from /usr/include/google/protobuf/descriptor.h:44,
                 from /usr/include/google/protobuf/message.h:105,
                 from ../include/migration.h:22,
                 from ../include/vcpu.h:29,
                 from ../include/machine.h:34,
                 from ../devices/display/qxl/qxl.h:28,
                 from ../devices/display/qxl/qxl_parser.cc:23:
/usr/include/absl/container/internal/btree.h:1578:3: error: two or more data types in declaration of ‘_gl_verify_function14’
 1578 |   void verify() const;
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ‘;’ at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree.h:1578:17: error: declaration does not declare anything [-fpermissive]
 1578 |   void verify() const;
      |                 ^~~~~
../devices/display/qxl/canvas/verify.h:208:5: error: expected unqualified-id before ‘extern’
  208 |     extern int (*_GL_GENSYM (_gl_verify_function) (void))              \
      |     ^~~~~~
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ‘)’ token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:58:
/usr/include/absl/container/internal/btree_container.h:224:3: error: two or more data types in declaration of ‘_gl_verify_function16’
  224 |   void verify() const { tree_.verify(); }
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ‘;’ at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree_container.h:224:23: error: expected unqualified-id before ‘{’ token
  224 |   void verify() const { tree_.verify(); }
      |                       ^
[114/167] Compiling C object mvisor.p/devices_display_qxl_canvas_rop3.c.o
ninja: build stopped: subcommand failed.
alice@Felix ~/git-applications/mvisor/mvisor$ 
ProgrammerIn-wonderland commented 1 month ago

same error on GCC-11 with setup command CC=gcc-11 CXX=g++-11 meson setup build -Dsdl=true -Dvgpu=true

78 commented 1 month ago

Try to use scl enable gcc-toolset-11 or the following commands to setup compiler.

export PATH=/usr/local/gcc-11.4.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/gcc-11.4.1/lib64:$LD_LIBRARY_PATH

It seems the error was occurred in verify.h. You can also try to replace the macro empty to ignore the assertion line.

#define _GL_VERIFY_TYPE(R, DIAGNOSTIC) { }
78 commented 1 month ago

If you're not using virtio-vgpu, which emulates an OpenGL-compatible GPU within the guest operating system, you should remove the flag -Dvgpu=true.

ProgrammerIn-wonderland commented 1 month ago

I get the same error without vgpu and setup command meson setup build -Dsdl=true I managed to circumvent the error by unincluding verify.h and commenting out all SPICE_VERIFY

EDIT: this makes it build however runtime gives me an assertion error

ProgrammerIn-wonderland commented 1 month ago
diff --git a/.gitignore b/.gitignore
index 25b5caf..0c10f7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,3 @@ config/default.yaml
 .clang-format
 .vscode/
 .DS_Store
-.cache/
diff --git a/devices/display/qxl/canvas/lz_common.h b/devices/display/qxl/canvas/lz_common.h
index a99ede0..9b3905f 100644
--- a/devices/display/qxl/canvas/lz_common.h
+++ b/devices/display/qxl/canvas/lz_common.h
@@ -24,7 +24,7 @@
 #define H_SPICE_COMMON_LZ_COMMON

 #include <spice/macros.h>
-// #include "verify.h"
+#include "verify.h"

 SPICE_BEGIN_DECLS

@@ -56,10 +56,10 @@ static const int IS_IMAGE_TYPE_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
 static const int PLT_PIXELS_PER_BYTE[] = {0, 8, 8, 2, 2, 1};
 static const int RGB_BYTES_PER_PIXEL[] = {0, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1};

-// verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_PLT) == (LZ_IMAGE_TYPE_A8 + 1));
-// verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_RGB) == (LZ_IMAGE_TYPE_A8 + 1));
-// verify(SPICE_N_ELEMENTS(PLT_PIXELS_PER_BYTE) == (LZ_IMAGE_TYPE_PLT8 + 1));
-// verify(SPICE_N_ELEMENTS(RGB_BYTES_PER_PIXEL) == (LZ_IMAGE_TYPE_A8 + 1));
+verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_PLT) == (LZ_IMAGE_TYPE_A8 + 1));
+verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_RGB) == (LZ_IMAGE_TYPE_A8 + 1));
+verify(SPICE_N_ELEMENTS(PLT_PIXELS_PER_BYTE) == (LZ_IMAGE_TYPE_PLT8 + 1));
+verify(SPICE_N_ELEMENTS(RGB_BYTES_PER_PIXEL) == (LZ_IMAGE_TYPE_A8 + 1));

 /* ASCII "LZ  " */
 #define LZ_MAGIC 0x20205a4c
diff --git a/devices/display/qxl/canvas/macros.h b/devices/display/qxl/canvas/macros.h
index 7338238..01765ab 100644
--- a/devices/display/qxl/canvas/macros.h
+++ b/devices/display/qxl/canvas/macros.h
@@ -19,7 +19,7 @@
 #ifndef H_SPICE_COMMON_MACROS
 #define H_SPICE_COMMON_MACROS

-// #include "verify.h"
+#include "verify.h"

 #ifdef __GNUC__
 #define SPICE_CONSTRUCTOR_FUNC(func_name) \
@@ -43,7 +43,7 @@
 #error Please implement SPICE_CONSTRUCTOR_FUNC and SPICE_DESTRUCTOR_FUNC for this compiler
 #endif

-// #define SPICE_VERIFY(cond) verify_expr(cond, (void)1)
+#define SPICE_VERIFY(cond) verify_expr(cond, (void)1)

 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define SPICE_UNREACHABLE __builtin_unreachable()
diff --git a/devices/display/qxl/canvas/quic.c b/devices/display/qxl/canvas/quic.c
index 468de70..22c17aa 100644
--- a/devices/display/qxl/canvas/quic.c
+++ b/devices/display/qxl/canvas/quic.c
@@ -214,8 +214,8 @@ static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = {

 static unsigned int stabrand(void)
 {
-    // SPICE_VERIFY( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
-    // SPICE_VERIFY( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
+    SPICE_VERIFY( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
+    SPICE_VERIFY( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );

     return TABRAND_SEEDMASK;
 }
@@ -240,7 +240,7 @@ static void set_wm_trigger(CommonState *state)
         wm = 10;
     }

-    // SPICE_VERIFY(DEFevol < 6);
+    SPICE_VERIFY(DEFevol < 6);

     state->wm_trigger = besttrigtab[DEFevol / 2][wm];

@@ -705,7 +705,7 @@ static void find_model_params(Encoder *encoder,
     /* The only valid values are 1, 3 and 5.
        0, 2 and 4 are obsolete and the rest of the
        values are considered out of the range. */
-    // SPICE_VERIFY(DEFevol == 1 || DEFevol == 3 || DEFevol == 5);
+    SPICE_VERIFY(DEFevol == 1 || DEFevol == 3 || DEFevol == 5);
     spice_assert(bpc <= 8 && bpc > 0);

     *ncounters = 8;
diff --git a/devices/display/qxl/canvas/quic_family_tmpl.c b/devices/display/qxl/canvas/quic_family_tmpl.c
index 0977c0f..6a05fb6 100644
--- a/devices/display/qxl/canvas/quic_family_tmpl.c
+++ b/devices/display/qxl/canvas/quic_family_tmpl.c
@@ -67,7 +67,7 @@ static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned
 static void FNAME(update_model)(CommonState *state, s_bucket * const bucket,
                                 const BYTE curval)
 {
-    // SPICE_VERIFY(BPC >= 1);
+    SPICE_VERIFY(BPC >= 1);
     spice_return_if_fail (bucket != NULL);

     const unsigned int bpp = BPC;

this patch seems to work for archlinux, it just removes all usage of verify.h

78 commented 1 month ago

This header file verify.h comes from the Spice Common project. I'm uncertain about the implications of commenting out these asserts, but they can be replaced with MV_ASSERT, which would require including "logger.h". If an assert fails, it demands special attention.

youfun commented 1 week ago

it seem the same error in void linux when bulid.

 gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-unknown-linux-gnu/13.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /builddir/gcc-13.2.0/configure --build=x86_64-unknown-linux-gnu --enable-gnu-unique-object --enable-vtable-verify --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --libexecdir=/usr/lib64 --libdir=/usr/lib64 --enable-threads=posix --enable-__cxa_atexit --disable-multilib --with-system-zlib --enable-shared --enable-lto --enable-plugins --enable-linker-build-id --disable-werror --disable-nls --enable-default-pie --enable-default-ssp --enable-checking=release --disable-libstdcxx-pch --with-isl --with-linker-hash-style=gnu --disable-sjlj-exceptions --disable-target-libiberty --disable-libssp --enable-languages=c,c++,objc,obj-c++,fortran,lto,go,ada
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)

 meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/box/code/mvisor/build
ninja: Entering directory `/home/box/code/mvisor/build'
[5/52] Compiling C++ object mvisor.p/devices_display_qxl_qxl_parser.cc.o
FAILED: mvisor.p/devices_display_qxl_qxl_parser.cc.o
ccache c++ -Imvisor.p -I. -I.. -I../include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/virgl -I/usr/include/libdrm -I/usr/include/SDL2 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O2 -g -Wno-address-of-packed-member -Wno-missing-field-initializers -mavx2 -DPROTOBUF_USE_DLLS -DNOMINMAX -D_REENTRANT -pthread -MD -MQ mvisor.p/devices_display_qxl_qxl_parser.cc.o -MF mvisor.p/devices_display_qxl_qxl_parser.cc.o.d -o mvisor.p/devices_display_qxl_qxl_parser.cc.o -c ../devices/display/qxl/qxl_parser.cc
In file included from ../devices/display/qxl/canvas/macros.h:22,
                 from ../devices/display/qxl/canvas/log.h:26,
                 from ../devices/display/qxl/canvas/mem.h:22,
                 from ../devices/display/qxl/canvas/draw.h:37,
                 from ../devices/display/qxl/qxl_parser.h:22,
                 from ../devices/display/qxl/qxl_parser.cc:21:
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ')' token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:57,
                 from /usr/include/google/protobuf/descriptor.h:44,
                 from /usr/include/google/protobuf/message.h:105,
                 from ../include/migration.h:22,
                 from ../include/vcpu.h:31,
                 from ../include/machine.h:34,
                 from ../devices/display/qxl/qxl.h:28,
                 from ../devices/display/qxl/qxl_parser.cc:23:
/usr/include/absl/container/internal/btree.h:1578:3: error: two or more data types in declaration of '_gl_verify_function14'
 1578 |   void verify() const;
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ';' at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree.h:1578:17: error: declaration does not declare anything [-fpermissive]
 1578 |   void verify() const;
      |                 ^~~~~
../devices/display/qxl/canvas/verify.h:208:5: error: expected unqualified-id before 'extern'
  208 |     extern int (*_GL_GENSYM (_gl_verify_function) (void))              \
      |     ^~~~~~
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ')' token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:58:
/usr/include/absl/container/internal/btree_container.h:224:3: error: two or more data types in declaration of '_gl_verify_function16'
  224 |   void verify() const { tree_.verify(); }
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ';' at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree_container.h:224:23: error: expected unqualified-id before '{' token
  224 |   void verify() const { tree_.verify(); }
      |                       ^
[8/52] Compiling C++ object mvisor.p/devices_display_qxl_qxl_render.cc.o
FAILED: mvisor.p/devices_display_qxl_qxl_render.cc.o
ccache c++ -Imvisor.p -I. -I.. -I../include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/virgl -I/usr/include/libdrm -I/usr/include/SDL2 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O2 -g -Wno-address-of-packed-member -Wno-missing-field-initializers -mavx2 -DPROTOBUF_USE_DLLS -DNOMINMAX -D_REENTRANT -pthread -MD -MQ mvisor.p/devices_display_qxl_qxl_render.cc.o -MF mvisor.p/devices_display_qxl_qxl_render.cc.o.d -o mvisor.p/devices_display_qxl_qxl_render.cc.o -c ../devices/display/qxl/qxl_render.cc
In file included from ../devices/display/qxl/canvas/macros.h:22,
                 from ../devices/display/qxl/canvas/log.h:26,
                 from ../devices/display/qxl/canvas/mem.h:22,
                 from ../devices/display/qxl/canvas/draw.h:37,
                 from ../devices/display/qxl/canvas/sw_canvas.h:25,
                 from ../devices/display/qxl/qxl_render.h:30,
                 from ../devices/display/qxl/qxl_render.cc:22:
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ')' token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:57,
                 from /usr/include/google/protobuf/descriptor.h:44,
                 from /usr/include/google/protobuf/message.h:105,
                 from ../include/migration.h:22,
                 from ../include/vcpu.h:31,
                 from ../include/machine.h:34,
                 from ../devices/display/qxl/qxl.h:28,
                 from ../devices/display/qxl/qxl_render.cc:23:
/usr/include/absl/container/internal/btree.h:1578:3: error: two or more data types in declaration of '_gl_verify_function14'
 1578 |   void verify() const;
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ';' at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree.h:1578:17: error: declaration does not declare anything [-fpermissive]
 1578 |   void verify() const;
      |                 ^~~~~
../devices/display/qxl/canvas/verify.h:208:5: error: expected unqualified-id before 'extern'
  208 |     extern int (*_GL_GENSYM (_gl_verify_function) (void))              \
      |     ^~~~~~
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |                                 ^
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:33: error: template argument 1 is invalid
../devices/display/qxl/canvas/verify.h:185:5: error: invalid template-id
  185 |     _gl_verify_type<(R) ? 1 : -1>
      |     ^~~~~~~~~~~~~~~
../devices/display/qxl/canvas/verify.h:174:46: error: missing template arguments before ')' token
  174 |    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
      |                                              ^
In file included from /usr/include/absl/container/btree_map.h:58:
/usr/include/absl/container/internal/btree_container.h:224:3: error: two or more data types in declaration of '_gl_verify_function16'
  224 |   void verify() const { tree_.verify(); }
      |   ^~~~
../devices/display/qxl/canvas/verify.h:209:39: error: expected ';' at end of member declaration
  209 |       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
      |                                       ^
/usr/include/absl/container/internal/btree_container.h:224:23: error: expected unqualified-id before '{' token
  224 |   void verify() const { tree_.verify(); }
      |                       ^
[14/52] Compiling C++ object mvisor.p/devices_usb_uhci_host.cc.o
ninja: build stopped: subcommand failed.
78 commented 5 days ago

@youfun The verify.h file has been deleted, and the code has been merged into the master branch. You can try again.

youfun commented 4 days ago

@youfun The verify.h file has been deleted, and the code has been merged into the master branch. You can try again.

 meson setup build -Dsdl=true
Directory already configured.

Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
Run "meson setup --reconfigure to force Meson to regenerate.

If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.

box  …/mvisor    master ?    13:08  meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/box/code/mvisor/build
ninja: Entering directory `/home/box/code/mvisor/build'
[1/2] Compiling C++ object mvisor.p/devices_virtio_virtio_vgpu.cc.o
FAILED: mvisor.p/devices_virtio_virtio_vgpu.cc.o
ccache c++ -Imvisor.p -I. -I.. -I../include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/virgl -I/usr/include/libdrm -I/usr/include/SDL2 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O2 -g -Wno-address-of-packed-member -Wno-missing-field-initializers -mavx2 -DPROTOBUF_USE_DLLS -DNOMINMAX -D_REENTRANT -pthread -MD -MQ mvisor.p/devices_virtio_virtio_vgpu.cc.o -MF mvisor.p/devices_virtio_virtio_vgpu.cc.o.d -o mvisor.p/devices_virtio_virtio_vgpu.cc.o -c ../devices/virtio/virtio_vgpu.cc
../devices/virtio/virtio_vgpu.cc: In member function 'void VirtioVgpu::DestroyVirglContext(VirtElement*)':
../devices/virtio/virtio_vgpu.cc:774:54: error: invalid conversion from 'const MemoryRegion**' to 'MemoryRegion**' [-fpermissive]
  774 |         manager_->machine()->memory_manager()->Unmap(&(iter1->second));
      |                                                      ^~~~~~~~~~~~~~~~
      |                                                      |
      |                                                      const MemoryRegion**
In file included from ../include/machine.h:36,
                 from ../devices/virtio/virtio_vgpu.cc:27:
../include/memory_manager.h:64:29: note:   initializing argument 1 of 'void MemoryManager::Unmap(MemoryRegion**)'
   64 |   void Unmap(MemoryRegion** region);
      |              ~~~~~~~~~~~~~~~^~~~~~
../devices/virtio/virtio_vgpu.cc: In member function 'void VirtioVgpu::UnmapBlobResource(VirtElement*)':
../devices/virtio/virtio_vgpu.cc:944:52: error: invalid conversion from 'const MemoryRegion**' to 'MemoryRegion**' [-fpermissive]
  944 |       manager_->machine()->memory_manager()->Unmap(&(iter->second));
      |                                                    ^~~~~~~~~~~~~~~
      |                                                    |
      |                                                    const MemoryRegion**
../include/memory_manager.h:64:29: note:   initializing argument 1 of 'void MemoryManager::Unmap(MemoryRegion**)'
   64 |   void Unmap(MemoryRegion** region);
      |              ~~~~~~~~~~~~~~~^~~~~~
ninja: build stopped: subcommand failed.
78 commented 3 days ago

It seems you have configured virtio-vgpu before. Remove the build directory and run meson setup build -Dsdl=true again.