Skip to contentSkip to conversation

configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode

PATCH Superseded Thomas Huth 5 participants 13 messages Jan 14, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +5 -0
index 2b9ba7d..aa80c17 100755
@@ -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"
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 32 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +0 -0
index 2b9ba7d..aa80c17 100755

configure if test "$libiscsi" != "no" ; then · line 4569

Quoted 8 lines
configure +5 -0
@@ -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

#2 lore raw
Quoted 37 lines · Peter Maydell
Quoted 36 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +1 -0
index 2b9ba7d..aa80c17 100755
@@ -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
Quoted 8 lines

configure if test "$libiscsi" != "no" ; then · line 4569

Quoted 4 lines
configure +4 -0
+      # 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

Signature · 3 lines
|: 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 :|
#3 lore raw
Quoted 47 lines · Daniel P. Berrangé
Quoted 37 lines · Peter Maydell
Quoted 36 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +1 -0
index 2b9ba7d..aa80c17 100755
@@ -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
Quoted 8 lines

configure if test "$libiscsi" != "no" ; then · line 4569

Quoted 4 lines
configure +4 -0
+      # 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.

Quoted 2 lines

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.

Quoted 2 lines

I'd rather we just added -Wno-error to libiscsi_cflags instead of changing compilation mode.

Fine for me, too.

Thomas

#4 lore raw
In reply to Daniel P. Berrangé
Quoted 7 lines · Daniel P. Berrangé
Quoted 4 lines

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

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#5 lore raw
Quoted 7 lines · Eric Blake
Quoted 5 lines · Daniel P. Berrangé
Quoted 4 lines

Can we suppress the warnings with #pragma instead ? That would avoid compiling the .o file with different C semantics.

Quoted 7 lines
Quoted 2 lines

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?

Quoted 2 lines

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.

Quoted 2 lines

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

#6 lore raw
Quoted 11 lines · Thomas Huth
Quoted 10 lines · Eric Blake
Quoted 7 lines · Daniel P. Berrangé
Quoted 4 lines

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 :-(

Quoted 6 lines
Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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

Quoted 10 lines

?

... sounds quite ugly to me, too.

Quoted 2 lines

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.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#7 lore raw
Quoted 14 lines · Eric Blake
Quoted 13 lines · Thomas Huth
Quoted 12 lines · Eric Blake
Quoted 7 lines · Daniel P. Berrangé
Quoted 4 lines

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:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

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:

Quoted 5 lines

// 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.

Quoted 6 lines
Quoted 2 lines

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

#8 lore raw
Quoted 2 lines · Thomas Huth
Quoted 1 line · Eric Blake

On 1/14/19 8:53 AM, Thomas Huth wrote:

[...]

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

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

#9 lore raw
In reply to Thomas Huth
Quoted 21 lines · Thomas Huth
Quoted 7 lines · Eric Blake
Quoted 5 lines · Daniel P. Berrangé
Quoted 4 lines

Can we suppress the warnings with #pragma instead ? That would avoid compiling the .o file with different C semantics.

Quoted 7 lines
Quoted 2 lines

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?

Quoted 2 lines

and/or adding #defines around the inclusion of the header to neutralize the poor warnings,

Quoted 7 lines

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

Signature · 3 lines
|: 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 :|
#10 lore raw
In reply to Thomas Huth
Quoted 31 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +0 -0
index 2b9ba7d..aa80c17 100755

configure if test "$libiscsi" != "no" ; then · line 4565

Quoted 4 lines
configure +1 -0
@@ -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
Quoted 8 lines
configure +4 -0
+      # 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"
#11 lore raw
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 26 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 12 lines

configure if test "$libiscsi" != "no" ; then · line 4565

Quoted 9 lines
configure +1 -0
index 2b9ba7d..aa80c17 100755
@@ -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

#12 lore raw
Quoted 40 lines · Thomas Huth
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 26 lines · Thomas Huth

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.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 12 lines

configure if test "$libiscsi" != "no" ; then · line 4565

Quoted 9 lines
configure +1 -0
index 2b9ba7d..aa80c17 100755
@@ -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.

Quoted 2 lines

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: