diff mbox series

[PULL,6/7] meson: fix meson 0.58 warning with libvhost-user subproject

Message ID 20210729124713.208422-7-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,1/7] i386: assert 'cs->kvm_state' is not null | expand

Commit Message

Paolo Bonzini July 29, 2021, 12:47 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Meson now checks that subprojects do not access files from parent
project. While we all agree this is best practice, libvhost-user also
want to share a few headers with QEMU, and libvhost-user isn't really a
standalone project at this point (although this is making the dependency
a bit more explicit).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210505151313.203258-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 subprojects/libvhost-user/include/atomic.h       | 1 +
 subprojects/libvhost-user/libvhost-user.c        | 2 +-
 subprojects/libvhost-user/meson.build            | 6 +-----
 subprojects/libvhost-user/standard-headers/linux | 1 +
 4 files changed, 4 insertions(+), 6 deletions(-)
 create mode 120000 subprojects/libvhost-user/include/atomic.h
 create mode 120000 subprojects/libvhost-user/standard-headers/linux

Comments

Peter Maydell July 29, 2021, 12:58 p.m. UTC | #1
On Thu, 29 Jul 2021 at 13:56, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Meson now checks that subprojects do not access files from parent
> project. While we all agree this is best practice, libvhost-user also
> want to share a few headers with QEMU, and libvhost-user isn't really a
> standalone project at this point (although this is making the dependency
> a bit more explicit).
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-Id: <20210505151313.203258-1-marcandre.lureau@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  subprojects/libvhost-user/include/atomic.h       | 1 +
>  subprojects/libvhost-user/libvhost-user.c        | 2 +-
>  subprojects/libvhost-user/meson.build            | 6 +-----
>  subprojects/libvhost-user/standard-headers/linux | 1 +

> diff --git a/subprojects/libvhost-user/include/atomic.h b/subprojects/libvhost-user/include/atomic.h
> new file mode 120000
> index 0000000000..8c2be64f7b
> --- /dev/null
> +++ b/subprojects/libvhost-user/include/atomic.h
> @@ -0,0 +1 @@
> +../../../include/qemu/atomic.h
> \ No newline at end of file

> diff --git a/subprojects/libvhost-user/standard-headers/linux b/subprojects/libvhost-user/standard-headers/linux
> new file mode 120000
> index 0000000000..15a2378139
> --- /dev/null
> +++ b/subprojects/libvhost-user/standard-headers/linux
> @@ -0,0 +1 @@
> +../../../include/standard-headers/linux
> \ No newline at end of file


Should these really be missing the trailing newline ?

-- PMM
Thomas Huth July 29, 2021, 2:05 p.m. UTC | #2
On 29/07/2021 14.58, Peter Maydell wrote:
> On Thu, 29 Jul 2021 at 13:56, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Meson now checks that subprojects do not access files from parent
>> project. While we all agree this is best practice, libvhost-user also
>> want to share a few headers with QEMU, and libvhost-user isn't really a
>> standalone project at this point (although this is making the dependency
>> a bit more explicit).
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Message-Id: <20210505151313.203258-1-marcandre.lureau@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   subprojects/libvhost-user/include/atomic.h       | 1 +
>>   subprojects/libvhost-user/libvhost-user.c        | 2 +-
>>   subprojects/libvhost-user/meson.build            | 6 +-----
>>   subprojects/libvhost-user/standard-headers/linux | 1 +
> 
>> diff --git a/subprojects/libvhost-user/include/atomic.h b/subprojects/libvhost-user/include/atomic.h
>> new file mode 120000
>> index 0000000000..8c2be64f7b
>> --- /dev/null
>> +++ b/subprojects/libvhost-user/include/atomic.h
>> @@ -0,0 +1 @@
>> +../../../include/qemu/atomic.h
>> \ No newline at end of file
> 
>> diff --git a/subprojects/libvhost-user/standard-headers/linux b/subprojects/libvhost-user/standard-headers/linux
>> new file mode 120000
>> index 0000000000..15a2378139
>> --- /dev/null
>> +++ b/subprojects/libvhost-user/standard-headers/linux
>> @@ -0,0 +1 @@
>> +../../../include/standard-headers/linux
>> \ No newline at end of file
> 
> 
> Should these really be missing the trailing newline ?

It's a symlink, so yes, there does not need to be a newline in here.

  Thomas
Peter Maydell July 29, 2021, 3:07 p.m. UTC | #3
On Thu, 29 Jul 2021 at 15:05, Thomas Huth <thuth@redhat.com> wrote:
>
> On 29/07/2021 14.58, Peter Maydell wrote:
> > On Thu, 29 Jul 2021 at 13:56, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >>
> >> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >>
> >> Meson now checks that subprojects do not access files from parent
> >> project. While we all agree this is best practice, libvhost-user also
> >> want to share a few headers with QEMU, and libvhost-user isn't really a
> >> standalone project at this point (although this is making the dependency
> >> a bit more explicit).
> >>
> >> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> >> Message-Id: <20210505151313.203258-1-marcandre.lureau@redhat.com>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >>   subprojects/libvhost-user/include/atomic.h       | 1 +
> >>   subprojects/libvhost-user/libvhost-user.c        | 2 +-
> >>   subprojects/libvhost-user/meson.build            | 6 +-----
> >>   subprojects/libvhost-user/standard-headers/linux | 1 +
> >
> >> diff --git a/subprojects/libvhost-user/include/atomic.h b/subprojects/libvhost-user/include/atomic.h
> >> new file mode 120000
> >> index 0000000000..8c2be64f7b
> >> --- /dev/null
> >> +++ b/subprojects/libvhost-user/include/atomic.h
> >> @@ -0,0 +1 @@
> >> +../../../include/qemu/atomic.h
> >> \ No newline at end of file
> >
> >> diff --git a/subprojects/libvhost-user/standard-headers/linux b/subprojects/libvhost-user/standard-headers/linux
> >> new file mode 120000
> >> index 0000000000..15a2378139
> >> --- /dev/null
> >> +++ b/subprojects/libvhost-user/standard-headers/linux
> >> @@ -0,0 +1 @@
> >> +../../../include/standard-headers/linux
> >> \ No newline at end of file
> >
> >
> > Should these really be missing the trailing newline ?
>
> It's a symlink, so yes, there does not need to be a newline in here.

Interesting. How does it work on Windows hosts ?

-- PMM
Yonggang Luo July 29, 2021, 4:50 p.m. UTC | #4
Relative symlink should work on Windows.
Only symlink that points to non-exist file would file.

On Thu, Jul 29, 2021 at 11:09 PM Peter Maydell <peter.maydell@linaro.org>
wrote:
>
> On Thu, 29 Jul 2021 at 15:05, Thomas Huth <thuth@redhat.com> wrote:
> >
> > On 29/07/2021 14.58, Peter Maydell wrote:
> > > On Thu, 29 Jul 2021 at 13:56, Paolo Bonzini <pbonzini@redhat.com>
wrote:
> > >>
> > >> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > >>
> > >> Meson now checks that subprojects do not access files from parent
> > >> project. While we all agree this is best practice, libvhost-user also
> > >> want to share a few headers with QEMU, and libvhost-user isn't
really a
> > >> standalone project at this point (although this is making the
dependency
> > >> a bit more explicit).
> > >>
> > >> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > >> Message-Id: <20210505151313.203258-1-marcandre.lureau@redhat.com>
> > >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > >> ---
> > >>   subprojects/libvhost-user/include/atomic.h       | 1 +
> > >>   subprojects/libvhost-user/libvhost-user.c        | 2 +-
> > >>   subprojects/libvhost-user/meson.build            | 6 +-----
> > >>   subprojects/libvhost-user/standard-headers/linux | 1 +
> > >
> > >> diff --git a/subprojects/libvhost-user/include/atomic.h
b/subprojects/libvhost-user/include/atomic.h
> > >> new file mode 120000
> > >> index 0000000000..8c2be64f7b
> > >> --- /dev/null
> > >> +++ b/subprojects/libvhost-user/include/atomic.h
> > >> @@ -0,0 +1 @@
> > >> +../../../include/qemu/atomic.h
> > >> \ No newline at end of file
> > >
> > >> diff --git a/subprojects/libvhost-user/standard-headers/linux
b/subprojects/libvhost-user/standard-headers/linux
> > >> new file mode 120000
> > >> index 0000000000..15a2378139
> > >> --- /dev/null
> > >> +++ b/subprojects/libvhost-user/standard-headers/linux
> > >> @@ -0,0 +1 @@
> > >> +../../../include/standard-headers/linux
> > >> \ No newline at end of file
> > >
> > >
> > > Should these really be missing the trailing newline ?
> >
> > It's a symlink, so yes, there does not need to be a newline in here.
>
> Interesting. How does it work on Windows hosts ?
>
> -- PMM
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
Christian Borntraeger Aug. 19, 2021, 8:43 a.m. UTC | #5
Interestingly enough this breaks my rpmbuild (both rpmbuild and mock).
(mostly with a modified f35 spec file):

cc -Isubprojects/libvhost-user/libvhost-user.a.p -Isubprojects/libvhost-user -I../subprojects/libvhost-user -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -std=gnu11 -O2 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -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 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -DSTAP_SDT_V2 -fPIE -pthread -D_GNU_SOURCE -MD -MQ subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -MF subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o.d -o subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -c ../subprojects/libvhost-user/libvhost-user.c
../subprojects/libvhost-user/libvhost-user.c:43:10: fatal error: include/atomic.h: No such file or directory
   43 | #include "include/atomic.h"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.

and

DEBUG: FAILED: subprojects/libvhost-user/libvhost-user-glib.a.p/libvhost-user-glib.c.o
DEBUG: cc -Isubprojects/libvhost-user/libvhost-user-glib.a.p -Isubprojects/libvhost-user -I../subprojects/libvhost-user -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -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 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -DSTAP_SDT_V2 -fPIE -pthread -MD -MQ subprojects/libvhost-user/libvhost-user-glib.a.p/libvhost-user-glib.c.o -MF subprojects/libvhost-user/libvhost-user-glib.a.p/libvhost-user-glib.c.o.d -o subprojects/libvhost-user/libvhost-user-glib.a.p/libvhost-user-glib.c.o -c ../subprojects/libvhost-user/libvhost-user-glib.c
DEBUG: In file included from ../subprojects/libvhost-user/libvhost-user-glib.h:19,
DEBUG:                  from ../subprojects/libvhost-user/libvhost-user-glib.c:15:
DEBUG: ../subprojects/libvhost-user/libvhost-user.h:23:10: fatal error: standard-headers/linux/virtio_ring.h: No such file or directory
DEBUG:    23 | #include "standard-headers/linux/virtio_ring.h"
DEBUG:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEBUG: compilation terminated.
DEBUG: [12/10271] /usr/bin/meson --internal exe --capture qemu-version.h -- /builddir/build/BUILD/qemu-6.0.94/scripts/qemu-version.sh /builddir/build/BUILD/qemu-6.0.94 qemu-6.0.94-20210819.0.2e47441a94ba.fc34 6.0.94
DEBUG: [13/10271] /usr/bin/meson --internal exe --capture qemu-img-cmds.h -- /builddir/build/BUILD/qemu-6.0.94/scripts/hxtool -h ../qemu-img-cmds.hx
DEBUG: [14/10271] /usr/bin/meson --internal exe --capture hmp-commands-info.h -- /builddir/build/BUILD/qemu-6.0.94/scripts/hxtool -h ../hmp-commands-info.hx
DEBUG: [15/10271] /usr/bin/meson --internal exe --capture hmp-commands.h -- /builddir/build/BUILD/qemu-6.0.94/scripts/hxtool -h ../hmp-commands.hx
DEBUG: [16/10271] /usr/bin/meson --internal exe --capture qemu-options.def -- /builddir/build/BUILD/qemu-6.0.94/scripts/hxtool -h ../qemu-options.hx
DEBUG: ninja: build stopped: subcommand failed.
DEBUG: make: *** [Makefile:156: run-ninja] Error 1
DEBUG: error: Bad exit status from /var/tmp/rpm-tmp.fgqi3Y (%build)
DEBUG: RPM build errors:
DEBUG:     Bad exit status from /var/tmp/rpm-tmp.fgqi3Y (%build)
DEBUG: Child return code was: 1
Christian Borntraeger Aug. 19, 2021, 2:51 p.m. UTC | #6
On 19.08.21 10:43, Christian Borntraeger wrote:
> Interestingly enough this breaks my rpmbuild (both rpmbuild and mock).
> (mostly with a modified f35 spec file):
> 
> cc -Isubprojects/libvhost-user/libvhost-user.a.p -Isubprojects/libvhost-user -I../subprojects/libvhost-user -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -std=gnu11 -O2 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -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 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -DSTAP_SDT_V2 -fPIE -pthread -D_GNU_SOURCE -MD -MQ subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -MF subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o.d -o subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -c ../subprojects/libvhost-user/libvhost-user.c
> ../subprojects/libvhost-user/libvhost-user.c:43:10: fatal error: include/atomic.h: No such file or directory
>     43 | #include "include/atomic.h"
>        |          ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> 

Looks like the link in the tar.xz file is broken. We do use scripts/archive-source.sh.
Will look further.
Christian Borntraeger Aug. 19, 2021, 3:11 p.m. UTC | #7
On 19.08.21 16:51, Christian Borntraeger wrote:
> 
> 
> On 19.08.21 10:43, Christian Borntraeger wrote:
>> Interestingly enough this breaks my rpmbuild (both rpmbuild and mock).
>> (mostly with a modified f35 spec file):
>>
>> cc -Isubprojects/libvhost-user/libvhost-user.a.p -Isubprojects/libvhost-user -I../subprojects/libvhost-user -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -std=gnu11 -O2 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -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 -Wno-missing-include-dirs -Wno-shift-negative-value 
>> -Wno-psabi -fstack-protector-strong -DSTAP_SDT_V2 -fPIE -pthread -D_GNU_SOURCE -MD -MQ subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -MF subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o.d -o subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -c ../subprojects/libvhost-user/libvhost-user.c
>> ../subprojects/libvhost-user/libvhost-user.c:43:10: fatal error: include/atomic.h: No such file or directory
>>     43 | #include "include/atomic.h"
>>        |          ^~~~~~~~~~~~~~~~~~
>> compilation terminated.
>>
> 
> Looks like the link in the tar.xz file is broken. We do use scripts/archive-source.sh.
> Will look further.

OK,  the build pipeline used tar -xform to prepend a folder name for rpmbuild. adding flags=r solved my issue.
diff mbox series

Patch

diff --git a/subprojects/libvhost-user/include/atomic.h b/subprojects/libvhost-user/include/atomic.h
new file mode 120000
index 0000000000..8c2be64f7b
--- /dev/null
+++ b/subprojects/libvhost-user/include/atomic.h
@@ -0,0 +1 @@ 
+../../../include/qemu/atomic.h
\ No newline at end of file
diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index fab7ca17ee..2971ba0112 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -40,7 +40,7 @@ 
 
 #endif
 
-#include "qemu/atomic.h"
+#include "include/atomic.h"
 
 #include "libvhost-user.h"
 
diff --git a/subprojects/libvhost-user/meson.build b/subprojects/libvhost-user/meson.build
index b03446e7cd..39825d9404 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -4,21 +4,17 @@  project('libvhost-user', 'c',
 
 threads = dependency('threads')
 glib = dependency('glib-2.0')
-inc = include_directories('../../include', '../../linux-headers')
 
 vhost_user = static_library('vhost-user',
                             files('libvhost-user.c'),
-                            include_directories: inc,
                             dependencies: threads,
                             c_args: '-D_GNU_SOURCE')
 
 executable('link-test', files('link-test.c'),
-           link_whole: vhost_user,
-           include_directories: inc)
+           link_whole: vhost_user)
 
 vhost_user_glib = static_library('vhost-user-glib',
                                  files('libvhost-user-glib.c'),
-                                 include_directories: inc,
                                  link_with: vhost_user,
                                  dependencies: glib)
 
diff --git a/subprojects/libvhost-user/standard-headers/linux b/subprojects/libvhost-user/standard-headers/linux
new file mode 120000
index 0000000000..15a2378139
--- /dev/null
+++ b/subprojects/libvhost-user/standard-headers/linux
@@ -0,0 +1 @@ 
+../../../include/standard-headers/linux
\ No newline at end of file