On Fri, Sep 25, 2020 at 10:03 AM Wei Wang <weiwangcloud2020@gmail.com> wrote:
On Thu, Sep 24, 2020 at 2:58 PM Ján Tomko <jtomko@redhat.com> wrote:
On a Thursday in 2020, Wei Wang wrote:
>Seems it didn't appear on the mailing list, resent it.
>
> Hi folks,
>
>I'm trying to build libvirt using meson with the latest upstream libvirt,
>but the compilation fails:
>(followed on https://libvirt.org/compiling.html, not sure if any
>dependencies are missed. I checked, src/util/libvirt_util.a.p does not
>exist.)
>
>FAILED: src/util/libvirt_util.a.p/glibcompat.c.o
>....
>In file included from ../src/util/glibcompat.c:19:
>./config.h:1026:10: fatal error: config-post.h: No such file or directory
>FAILED: src/util/libvirt_util.a.p/virfirmware.c.o
>In file included from ../src/util/virarch.c:22:
>./config.h:1026:10: fatal error: config-post.h: No such file or directory
>FAILED: src/util/libvirt_util.a.p/viraudit.c.o
>In file included from ../src/util/viraudit.c:22:
>./config.h:1026:10: fatal error: config-post.h: No such file or directory
>

config-post.h was moved to config.h when we converted to Meson.

There are probably some leftovers from a previous build in your build
directory. Can you try it with an empty build directory?


Thanks, just done cloning a new one from the official repo, but meson build reports an error:
src/util/meson.build:138:0: ERROR: Program '/opt/projects/libvirt/src/keycodemapdb/tools/keymap-gen' not found

Is there anything I should do before "meson build"?

OK, solved this one with network proxy (seems that meson needs to download it).
 ninja -C build fails with 

ninja: Entering directory `build'
[6/908] Compiling C object src/util/libvirt_util.a.p/virfile.c.o
FAILED: src/util/libvirt_util.a.p/virfile.c.o
cc -Isrc/util/libvirt_util.a.p -Isrc/util -I../src/util -Iinclude -I../include -Isrc -I../src -I. -I.. -I/usr/include/p11-kit-1 -I/usr/include/libnl3 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/libxml2 -I/usr/include/yajl -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O2 -g -Werror -fno-common -W -Wabsolute-value -Waddress -Waddress-of-packed-member -Waggressive-loop-optimizations -Wall -Wattribute-warning -Wattributes -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcannot-profile -Wcast-align -Wcast-align=strict -Wcast-function-type -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeclaration-after-statement -Wdeprecated-declarations -Wdesignated-init -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wif-not-aligned -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-profile -Wmissing-prototypes -Wmultichar -Wmultistatement-macros -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverride-init -Wpacked-bitfield-compat -Wpacked-not-aligned -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wstringop-truncation -Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wattribute-alias=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wnormalized=nfc -Wshift-overflow=2 -Wstringop-overflow=2 -Wunused-const-variable=2 -Wno-sign-compare -Wno-cast-function-type -Wjump-misses-init -Wswitch-enum -Wno-format-nonliteral -Wno-format-truncation -Wframe-larger-than=4096 -fexceptions -fasynchronous-unwind-tables -fipa-pure-const -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -fstack-protector-strong -Wdouble-promotion -fPIC -pthread -DIN_LIBVIRT '-Dabs_top_builddir="/opt/projects/libvirt/build"' '-Dabs_top_srcdir="/opt/projects/libvirt"' -MD -MQ src/util/libvirt_util.a.p/virfile.c.o -MF src/util/libvirt_util.a.p/virfile.c.o.d -o src/util/libvirt_util.a.p/virfile.c.o -c ../src/util/virfile.c
In file included from ../src/util/virfile.c:42:
/usr/include/libutil.h:43:10: fatal error: sys/_types.h: No such file or directory
   43 | #include <sys/_types.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
[51/908] Compiling C object src/qemu/libvirt_driver_qemu_impl.a.p/qemu_driver.c.o
ninja: build stopped: subcommand failed
 
I have  /usr/include/sys/types.h, but no "_types.h"

Thanks,
Wei