[MacPorts] #55577: getting rid of unforeseen -I${prefix}/include option adding and its potential side-effects

MacPorts noreply at macports.org
Sat Dec 23 13:03:37 UTC 2017


#55577: getting rid of unforeseen -I${prefix}/include option adding and its
potential side-effects
--------------------------+-----------------
  Reporter:  RJVB         |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  pcre, glib2  |
--------------------------+-----------------

Comment (by ryandesign):

 Replying to [ticket:55577 RJVB]:
 > I ran into header file conflicts the other day building code that
 depends indirectly on glib-2. This was on Linux using my MacPorts-for-
 Linux adaptation but the same thing could easily happen on Mac too because
 the same rules and guidelines apply for header search path priorities.
 >
 > The culprit was an unhappy -I/opt/local/include compiler option which
 caused a build to find headers from $prefix that were incompatible with
 the ones included and needed by the project.

 Sounds like a bug in that project. It should place the appropriate `-I`
 flags for including its own headers ''before'' the `-I` flags from pkg-
 config and elsewhere that include the system headers.

 Switching MacPorts base to using `-isystem` instead of `-I` would be
 another possible solution to this problem which is proposed in #40656.

 > I traced that option first to  glib-2.0.pc which is patched by
 port:glib2 to add the include path, and then to port:pcre which installs
 its headers into ${prefix}/include and thus actually needs it.
 >
 > The proper fix here is:
 >
 > 1. Install the pcre (and pcre2) headers in a subdirectory with the
 official mechanism, i.e. add this to `configure.args` in `port file pcre`:
 > {{{
 >                     --includedir=${prefix}/include/${subport} \
 > }}}
 > This change will be reflected in the pcre/pcre2 pkg-config files.

 This has the potential to break ports that use pcre/pcre2. Probably not
 all of them use pkg-config.

 > 2. update port:glib2 . This should be automatic but I didn't want to
 second-guess the reason NOT to use pkgconfig in `port configure glib2`
 which means a few changes are required. No hacks though, if anything the
 modified version is less of a hack than the original. `PCRE_CFLAGS` and
 `PCRE_LIBS` are now set by querying pkg-config instead of with hardcoded
 values (idem for the ZLIB variables, as a bonus). Assuming the change to
 glib-2.0.pc is still required, this can actually be done in such a way
 that the build system inserts the proper option(s) by adding
 `@PCRE_CFLAGS@` instead of the hardcoded `-I` option.

 I'm tentatively ok with changing glib2/glib2-devel back to using pkg-
 config. It was changed to not use pkg-config back when pkg-config was
 changed to require glib2, since that would have been a circular dependency
 which is not allowed in MacPorts. Since then, pkg-config has changed to
 using a bundled copy of glib. I agree that the current glib2/glib2-devel
 portfiles and the configure script patches are quite hacky due to the
 effort taken to avoid pkg-config.

--
Ticket URL: <https://trac.macports.org/ticket/55577#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list