On 04/21/2017 01:33 PM, Sylvain Munaut wrote:
On Fri, Apr 21, 2017 at 7:44 PM, Martin Kelly <[email protected]> wrote:
This shouldn't be necessary as it's part of the default compiler include
paths anyway.

Huh ... no.

It's only part of the default compiler include if you installed in
/usr ... but if you installed in a custom prefix, this will be
required and that's the whole point of the .pc file.


Let me provide a bit more context. I created this patch because a package in Openembedded (qtmultimedia-rtlfm-radio-plugin) relies on the .pc file for rtl-sdr, which injects -I /usr/include. That package uses QMake, when then translates the include into -isystem /usr/include. This breaks GCC 6's #include_next directive, as documented by GCC and Qt:

GCC bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129

Qt bug report:
https://bugreports.qt.io/browse/QTBUG-53367

In both cases, the maintainers state that the right solution is to not do -I /usr/include. AFAICT, this means there are two options:

(a) Don't export -I /usr/include in the .pc file.

(b) Manually remove -I /usr/include for anyone who compiles with GCC 6 and needs to use rtl-sdr.

Solution (a) seems cleaner to me. If you have another way that avoids breaking packages that include rtl-sdr and use GCC 6, I'm happy to hear it.

In my case, when I ask GCC for the default include path, I'm seeing /usr/include listed. In the case of Openembedded, the cross-compile toolchain already takes care of prefix issues by using --sysroot.

GCC default include paths:

martin@columbia:~$ echo | gcc -E -Wp,-v -
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"

Reply via email to