Opened 10 years ago
Closed 7 years ago
#44395 closed defect (fixed)
glib2, glib2-devel: don't add -I${prefix}/include to glib-2.0.pc
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.3.1 |
Keywords: | Cc: | cooljeanius (Eric Gallager) | |
Port: | glib2 glib2-devel |
Change History (5)
comment:1 Changed 10 years ago by cooljeanius (Eric Gallager)
Cc: | egall@… added |
---|
comment:2 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
The Qt bug report's URL has changed and is now https://bugreports.qt.io/browse/QTBUG-34902
The Qt developer's complaint is that a .pc file should not contain -I${prefix}/include
. But tons of other MacPorts-installed .pc files do, and why shouldn't they? That's exactly what .pc files are for: to provide the flags necessary to compile something.
comment:3 Changed 7 years ago by RJVB (René Bertin)
The exact claim is that .pc files should never contain system paths and there's something to say for that. It may also be an official guideline.
As suggested on #55577, system paths should come last (or be declared via -isystem). You cannot guarantee that this will be possible if any number of dependencies insert their -I options possibly mixed with other compiler options. The build system cannot know which of those -I's point to what it should consider as system paths so even if it could and wanted to rearrange all those options it still lacks the information required to do it properly.
That's exactly what .pc files are for: to provide the flags necessary to compile something.
Evidently, but it's the responsibility of the person packaging that "something" to ascertain that it's installed appropriately and the .pc provide flags that work without causing interference. Many projects install their headers in /usr/include (or /usr/local/include) because that's the easy solution: no need to declare any header search paths and it's still possible to override the system version (= let the compiler include alternative headers). That approach clearly has its limits when the prefix isn't / or /usr/local, and I for one now understand better why more and more projects have been using their own header directory. (= Not just to keep /usr/include tidy and cleaner).
Edit: is this patch still necessary? It was introduced over 10y ago, a lot of code has flowed under and through the north, south etc. bridges ;)
comment:4 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
Status: | new → accepted |
---|
Yes, the problem the patch solves (gi18n.h uses #include <libintl.h>
so the path to libintl.h needs to be provided in the compile flags; see #9937) is still relevant; see comment:ticket:55577:3.
comment:ticket:55577:4 suggests an alternate fix for the problem: instead of adding -I/opt/local/include
to Cflags in glib-2.0.pc, patch the two files that #include <libintl.h>
to so that they #include </opt/local/include/libintl.h>
instead. While disagreeing with the premise that ports should not use -I/opt/local/include
or provide .pc files that do so, I'm willing to make this change because it is a less invasive solution to the problem.
comment:5 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Cc Me!