configure | 5 +++++ 1 file changed, 5 insertions(+)
The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad
"inline" prototype definitions which GCC refuses to compile in its
gnu99 mode:
In file included from block/iscsi.c:52:0:
/usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function
‘scsi_set_uint16’ declared but never defined [-Werror]
inline void scsi_set_uint16(unsigned char *c, uint16_t val);
^
/usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function
‘scsi_set_uint32’ declared but never defined [-Werror]
inline void scsi_set_uint32(unsigned char *c, uint32_t val);
^
This has been fixed by upstream libiscsi in version 1.10.0 (see
https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but
since we still want to support 1.9.0 for CentOS 7 / RHEL7, we
have to work-around the issue by compiling with "-fgnu89-inline"
in this case instead.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
configure | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure b/configure
index 2b9ba7d..aa80c17 100755
--- a/configure
+++ b/configure
@@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
libiscsi="yes"
libiscsi_cflags=$($pkg_config --cflags libiscsi)
libiscsi_libs=$($pkg_config --libs libiscsi)
+ if $pkg_config --exact-version==1.9.0 libiscsi; then
+ # There are some bad inline declarations in scsi-lowlevel.h of
+ # libiscsi 1.9.0 which don't work in gnu99 mode without this:
+ libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
+ fi
else
if test "$libiscsi" = "yes" ; then
feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
--
1.8.3.1
On 1/14/19 2:46 PM, Thomas Huth wrote:
> The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad
> "inline" prototype definitions which GCC refuses to compile in its
> gnu99 mode:
>
> In file included from block/iscsi.c:52:0:
> /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function
> ‘scsi_set_uint16’ declared but never defined [-Werror]
> inline void scsi_set_uint16(unsigned char *c, uint16_t val);
> ^
> /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function
> ‘scsi_set_uint32’ declared but never defined [-Werror]
> inline void scsi_set_uint32(unsigned char *c, uint32_t val);
> ^
>
> This has been fixed by upstream libiscsi in version 1.10.0 (see
> https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but
> since we still want to support 1.9.0 for CentOS 7 / RHEL7, we
> have to work-around the issue by compiling with "-fgnu89-inline"
> in this case instead.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> configure | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 2b9ba7d..aa80c17 100755
> --- a/configure
> +++ b/configure
> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
> libiscsi="yes"
> libiscsi_cflags=$($pkg_config --cflags libiscsi)
> libiscsi_libs=$($pkg_config --libs libiscsi)
> + if $pkg_config --exact-version==1.9.0 libiscsi; then
The first offending commit is d327ab09c which got included in 1.8.0, so
using "exact" is not correct. Maybe:
if ! $pkg_config --atleast-version=1.10 libiscsi; then
> + # There are some bad inline declarations in scsi-lowlevel.h of
> + # libiscsi 1.9.0 which don't work in gnu99 mode without this:
> + libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
> + fi
> else
> if test "$libiscsi" = "yes" ; then
> feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
>
On 2019-01-14 15:31, Philippe Mathieu-Daudé wrote: > On 1/14/19 2:46 PM, Thomas Huth wrote: >> The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad >> "inline" prototype definitions which GCC refuses to compile in its >> gnu99 mode: >> >> In file included from block/iscsi.c:52:0: >> /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function >> ‘scsi_set_uint16’ declared but never defined [-Werror] >> inline void scsi_set_uint16(unsigned char *c, uint16_t val); >> ^ >> /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function >> ‘scsi_set_uint32’ declared but never defined [-Werror] >> inline void scsi_set_uint32(unsigned char *c, uint32_t val); >> ^ >> >> This has been fixed by upstream libiscsi in version 1.10.0 (see >> https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but >> since we still want to support 1.9.0 for CentOS 7 / RHEL7, we >> have to work-around the issue by compiling with "-fgnu89-inline" >> in this case instead. >> >> Suggested-by: Daniel P. Berrangé <berrange@redhat.com> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> configure | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/configure b/configure >> index 2b9ba7d..aa80c17 100755 >> --- a/configure >> +++ b/configure >> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then >> libiscsi="yes" >> libiscsi_cflags=$($pkg_config --cflags libiscsi) >> libiscsi_libs=$($pkg_config --libs libiscsi) >> + if $pkg_config --exact-version==1.9.0 libiscsi; then > > The first offending commit is d327ab09c which got included in 1.8.0, so > using "exact" is not correct. We require at least version 1.9.0, so the only version which can have this problem when compiling QEMU is 1.9.0. Thomas
On 1/14/19 3:36 PM, Thomas Huth wrote: > On 2019-01-14 15:31, Philippe Mathieu-Daudé wrote: >> On 1/14/19 2:46 PM, Thomas Huth wrote: >>> The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad >>> "inline" prototype definitions which GCC refuses to compile in its >>> gnu99 mode: >>> >>> In file included from block/iscsi.c:52:0: >>> /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function >>> ‘scsi_set_uint16’ declared but never defined [-Werror] >>> inline void scsi_set_uint16(unsigned char *c, uint16_t val); >>> ^ >>> /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function >>> ‘scsi_set_uint32’ declared but never defined [-Werror] >>> inline void scsi_set_uint32(unsigned char *c, uint32_t val); >>> ^ >>> >>> This has been fixed by upstream libiscsi in version 1.10.0 (see >>> https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but >>> since we still want to support 1.9.0 for CentOS 7 / RHEL7, we >>> have to work-around the issue by compiling with "-fgnu89-inline" >>> in this case instead. >>> >>> Suggested-by: Daniel P. Berrangé <berrange@redhat.com> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> configure | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/configure b/configure >>> index 2b9ba7d..aa80c17 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then >>> libiscsi="yes" >>> libiscsi_cflags=$($pkg_config --cflags libiscsi) >>> libiscsi_libs=$($pkg_config --libs libiscsi) >>> + if $pkg_config --exact-version==1.9.0 libiscsi; then >> >> The first offending commit is d327ab09c which got included in 1.8.0, so >> using "exact" is not correct. > We require at least version 1.9.0, so the only version which can have > this problem when compiling QEMU is 1.9.0. Oh you are right, then: Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> wrote: > > The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad > "inline" prototype definitions which GCC refuses to compile in its > gnu99 mode: > > In file included from block/iscsi.c:52:0: > /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function > ‘scsi_set_uint16’ declared but never defined [-Werror] > inline void scsi_set_uint16(unsigned char *c, uint16_t val); > ^ > /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function > ‘scsi_set_uint32’ declared but never defined [-Werror] > inline void scsi_set_uint32(unsigned char *c, uint32_t val); > ^ > > This has been fixed by upstream libiscsi in version 1.10.0 (see > https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but > since we still want to support 1.9.0 for CentOS 7 / RHEL7, we > have to work-around the issue by compiling with "-fgnu89-inline" > in this case instead. > > Suggested-by: Daniel P. Berrangé <berrange@redhat.com> > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > configure | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/configure b/configure > index 2b9ba7d..aa80c17 100755 > --- a/configure > +++ b/configure > @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then > libiscsi="yes" > libiscsi_cflags=$($pkg_config --cflags libiscsi) > libiscsi_libs=$($pkg_config --libs libiscsi) > + if $pkg_config --exact-version==1.9.0 libiscsi; then > + # There are some bad inline declarations in scsi-lowlevel.h of > + # libiscsi 1.9.0 which don't work in gnu99 mode without this: > + libiscsi_cflags="-fgnu89-inline $libiscsi_cflags" > + fi Can we suppress the warnings with #pragma instead ? That would avoid compiling the .o file with different C semantics. thanks -- PMM
On Mon, Jan 14, 2019 at 01:52:01PM +0000, Peter Maydell wrote: > On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> wrote: > > > > The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad > > "inline" prototype definitions which GCC refuses to compile in its > > gnu99 mode: > > > > In file included from block/iscsi.c:52:0: > > /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function > > ‘scsi_set_uint16’ declared but never defined [-Werror] > > inline void scsi_set_uint16(unsigned char *c, uint16_t val); > > ^ > > /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function > > ‘scsi_set_uint32’ declared but never defined [-Werror] > > inline void scsi_set_uint32(unsigned char *c, uint32_t val); > > ^ > > > > This has been fixed by upstream libiscsi in version 1.10.0 (see > > https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but > > since we still want to support 1.9.0 for CentOS 7 / RHEL7, we > > have to work-around the issue by compiling with "-fgnu89-inline" > > in this case instead. > > > > Suggested-by: Daniel P. Berrangé <berrange@redhat.com> > > Signed-off-by: Thomas Huth <thuth@redhat.com> > > --- > > configure | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/configure b/configure > > index 2b9ba7d..aa80c17 100755 > > --- a/configure > > +++ b/configure > > @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then > > libiscsi="yes" > > libiscsi_cflags=$($pkg_config --cflags libiscsi) > > libiscsi_libs=$($pkg_config --libs libiscsi) > > + if $pkg_config --exact-version==1.9.0 libiscsi; then > > + # There are some bad inline declarations in scsi-lowlevel.h of > > + # libiscsi 1.9.0 which don't work in gnu99 mode without this: > > + libiscsi_cflags="-fgnu89-inline $libiscsi_cflags" > > + fi > > Can we suppress the warnings with #pragma instead ? > That would avoid compiling the .o file with different > C semantics. IIUC this is a built-in warning you can't disable, except by changing the compilation mode to have gnu89 inline semantics :-( I'd rather we just added -Wno-error to libiscsi_cflags instead of changing compilation mode. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
On 2019-01-14 15:31, Daniel P. Berrangé wrote: > On Mon, Jan 14, 2019 at 01:52:01PM +0000, Peter Maydell wrote: >> On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> wrote: >>> >>> The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad >>> "inline" prototype definitions which GCC refuses to compile in its >>> gnu99 mode: >>> >>> In file included from block/iscsi.c:52:0: >>> /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function >>> ‘scsi_set_uint16’ declared but never defined [-Werror] >>> inline void scsi_set_uint16(unsigned char *c, uint16_t val); >>> ^ >>> /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function >>> ‘scsi_set_uint32’ declared but never defined [-Werror] >>> inline void scsi_set_uint32(unsigned char *c, uint32_t val); >>> ^ >>> >>> This has been fixed by upstream libiscsi in version 1.10.0 (see >>> https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but >>> since we still want to support 1.9.0 for CentOS 7 / RHEL7, we >>> have to work-around the issue by compiling with "-fgnu89-inline" >>> in this case instead. >>> >>> Suggested-by: Daniel P. Berrangé <berrange@redhat.com> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> configure | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/configure b/configure >>> index 2b9ba7d..aa80c17 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then >>> libiscsi="yes" >>> libiscsi_cflags=$($pkg_config --cflags libiscsi) >>> libiscsi_libs=$($pkg_config --libs libiscsi) >>> + if $pkg_config --exact-version==1.9.0 libiscsi; then >>> + # There are some bad inline declarations in scsi-lowlevel.h of >>> + # libiscsi 1.9.0 which don't work in gnu99 mode without this: >>> + libiscsi_cflags="-fgnu89-inline $libiscsi_cflags" >>> + fi >> >> Can we suppress the warnings with #pragma instead ? >> That would avoid compiling the .o file with different >> C semantics. > > IIUC this is a built-in warning you can't disable, except by changing > the compilation mode to have gnu89 inline semantics :-( Right, I just tried things like: #pragma GCC diagnostic ignored "-Wunused-function" but nothing seems to help here. Looks like this can not be disabled seperately. > I'd rather we just added -Wno-error to libiscsi_cflags instead of > changing compilation mode. Fine for me, too. Thomas
On 1/14/19 8:31 AM, Daniel P. Berrangé wrote: >> >> Can we suppress the warnings with #pragma instead ? >> That would avoid compiling the .o file with different >> C semantics. > > IIUC this is a built-in warning you can't disable, except by changing > the compilation mode to have gnu89 inline semantics :-( Could we instead fix the warning by one of: Using pragma to declare the header as a system header (used to silence warnings from misbehaving external headers), and/or adding #defines around the inclusion of the header to neutralize the poor warnings, but without changing the compilation mode of the entire project -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
On 2019-01-14 15:50, Eric Blake wrote: > On 1/14/19 8:31 AM, Daniel P. Berrangé wrote: > >>> >>> Can we suppress the warnings with #pragma instead ? >>> That would avoid compiling the .o file with different >>> C semantics. >> >> IIUC this is a built-in warning you can't disable, except by changing >> the compilation mode to have gnu89 inline semantics :-( > > Could we instead fix the warning by one of: > > Using pragma to declare the header as a system header (used to silence > warnings from misbehaving external headers), How do you do that? > and/or adding #defines around the inclusion of the header to neutralize > the poor warnings, You mean something like: #define inline /* nothing */ ? ... sounds quite ugly to me, too. > but without changing the compilation mode of the > entire project The patch is only changing libiscsi_cflags, so it's not affecting the entire project, but just the files that use libiscsi. Thomas
On 1/14/19 8:53 AM, Thomas Huth wrote: > On 2019-01-14 15:50, Eric Blake wrote: >> On 1/14/19 8:31 AM, Daniel P. Berrangé wrote: >> >>>> >>>> Can we suppress the warnings with #pragma instead ? >>>> That would avoid compiling the .o file with different >>>> C semantics. >>> >>> IIUC this is a built-in warning you can't disable, except by changing >>> the compilation mode to have gnu89 inline semantics :-( >> >> Could we instead fix the warning by one of: >> >> Using pragma to declare the header as a system header (used to silence >> warnings from misbehaving external headers), > > How do you do that? Using -isystem instead of -I - but that means rewriting the output of pkg-config. > >> and/or adding #defines around the inclusion of the header to neutralize >> the poor warnings, > > You mean something like: > > #define inline /* nothing */ or https://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers mentions: // save diagnostic state #pragma GCC diagnostic push // turn off the specific warning. Can also use "-Wall" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_generators.hpp> #include <boost/uuid/uuid_io.hpp> #include <boost/lexical_cast.hpp> // turn the warnings back on #pragma GCC diagnostic pop > > ? > > ... sounds quite ugly to me, too. > >> but without changing the compilation mode of the >> entire project > > The patch is only changing libiscsi_cflags, so it's not affecting the > entire project, but just the files that use libiscsi. Even so, limiting the damage to just the wrapper file that includes the problematic header rather than changing the command line for the entire compilation of those files that use libiscsi is even more precise. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
On 2019-01-14 16:02, Eric Blake wrote: > On 1/14/19 8:53 AM, Thomas Huth wrote: >> On 2019-01-14 15:50, Eric Blake wrote: >>> On 1/14/19 8:31 AM, Daniel P. Berrangé wrote: >>> >>>>> >>>>> Can we suppress the warnings with #pragma instead ? >>>>> That would avoid compiling the .o file with different >>>>> C semantics. >>>> >>>> IIUC this is a built-in warning you can't disable, except by changing >>>> the compilation mode to have gnu89 inline semantics :-( >>> >>> Could we instead fix the warning by one of: >>> >>> Using pragma to declare the header as a system header (used to silence >>> warnings from misbehaving external headers), >> >> How do you do that? > > Using -isystem instead of -I - but that means rewriting the output of > pkg-config. That does not work for me on RHEL7: The output of "pkg-config --cflags libiscsi" is empty since the headers are in a standard location. And even if I add "-isystem /usr/include" or "-isystem /usr/include/iscsi" manually, the warning does not go away. >>> and/or adding #defines around the inclusion of the header to neutralize >>> the poor warnings, >> >> You mean something like: >> >> #define inline /* nothing */ > > or > https://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers > mentions: > > // save diagnostic state > #pragma GCC diagnostic push > > // turn off the specific warning. Can also use "-Wall" > #pragma GCC diagnostic ignored "-Wunused-but-set-variable" That does not work in this case here, too, since there is no dedicated option to switch this warning on or off. >> The patch is only changing libiscsi_cflags, so it's not affecting the >> entire project, but just the files that use libiscsi. > > Even so, limiting the damage to just the wrapper file that includes the > problematic header rather than changing the command line for the entire > compilation of those files that use libiscsi is even more precise. Then our only option is "#define inline /* nothing */", as far as I can see... Thomas
On 2019-01-14 16:23, Thomas Huth wrote: > On 2019-01-14 16:02, Eric Blake wrote: >> On 1/14/19 8:53 AM, Thomas Huth wrote: [...] >>> The patch is only changing libiscsi_cflags, so it's not affecting the >>> entire project, but just the files that use libiscsi. >> >> Even so, limiting the damage to just the wrapper file that includes the >> problematic header rather than changing the command line for the entire >> compilation of those files that use libiscsi is even more precise. > > Then our only option is "#define inline /* nothing */", as far as I can > see... Or this one, which seems to be a better idea to me: #define inline __attribute__((gnu_inline)) gnu_inline should give the same behavior like the "inline" keywords in gnu89 mode. Thomas
On Mon, Jan 14, 2019 at 03:53:48PM +0100, Thomas Huth wrote: > On 2019-01-14 15:50, Eric Blake wrote: > > On 1/14/19 8:31 AM, Daniel P. Berrangé wrote: > > > >>> > >>> Can we suppress the warnings with #pragma instead ? > >>> That would avoid compiling the .o file with different > >>> C semantics. > >> > >> IIUC this is a built-in warning you can't disable, except by changing > >> the compilation mode to have gnu89 inline semantics :-( > > > > Could we instead fix the warning by one of: > > > > Using pragma to declare the header as a system header (used to silence > > warnings from misbehaving external headers), > > How do you do that? > > > and/or adding #defines around the inclusion of the header to neutralize > > the poor warnings, > > You mean something like: > > #define inline /* nothing */ > > ? > > ... sounds quite ugly to me, too. That actually works very nicely, as long as any system headers used by iscsi.h are already included by QEMU. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
© 2016 - 2025 Red Hat, Inc.