[PATCH] remove -I/usr/include in pkg-config

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Martin Kelly mkelly at xevo.com
Fri Apr 21 23:39:32 UTC 2017


On 04/21/2017 03:42 PM, Sylvain Munaut wrote:
>> In both cases, the maintainers state that the right solution is to not do -I
>> /usr/include. AFAICT, this means there are two options:
>
> Not really no ...
>
> They say to not use the -isystem /usr/include
>
> My opinion there is that qmake is broken doing the translation from
> -Ixxx to -isystem xxx blindly when both don't have _exactly_ the same
> semantic. QMake should check the system include list when doing the
> translation and omit the system ones to compensate for the difference
> of behavior of -I vs -isystem.
>

I see your point and agree that QMake's behavior is undesirable. I also 
agree that removing includedir will break compiling with --prefix 
without --sysroot; from a quick survey of a bunch of .pc files, they all 
include either -I${includedir} or -I${includedir}/project. The second 
category will not hit these issues while the first will.

Bugs have been filed on QMake regarding this in the past:

https://bugreports.qt.io/browse/QTBUG-53375
https://bugreports.qt.io/browse/QTBUG-53367

A patch was even drafted to fix it:

https://codereview.qt-project.org/#/c/159215

The patch was abandoned with this reasoning:

"The idea is that -isystem also suppresses warnings from files found in 
those paths. We'd like to keep that functionality.

The problem is that -isystem /usr/include, specifically, reorders that 
path."

The workaround in qtBittorrent was to explicitly remove the include/libs 
that QMake had added:

https://github.com/qbittorrent/qBittorrent/commit/d9d49b6d0bb71ccc086968f2626b98a662fb6f3a

Certainly not ideal, but it may be the only solution.

>
>> (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.
>
> Well (a) is fine ... but you can only remove /usr/include ... not ${includedir}
>
> So you need to test is includedir is indeed /usr/include and then you
> can omit it but if not, then you need to leave it.
>

This could work, but it still would break some machine that uses 
somewhere else for system compiler path. Perhaps doing what qtbittorrent 
did and just removing what QMake adds is the best solution, absent QMake 
fixing it.



More information about the osmocom-sdr mailing list