[MacPorts] #42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ---------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Keywords: | Port: clhep cmake ---------------------+-------------------------------- CMake is automatically fed with too many (too early) includes of `$prefix/include`: {{{ CPPFLAGS='-I/opt/local/include' CFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' CXXFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' }}} with the following explanation in the `PortGroup`: {{{ # The environment variable CPPFLAGS is not considered by CMake. # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" # <http://www.cmake.org/Bug/view.php?id=12928>). # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the # pre-configure phase. if {${configure.cppflags} ne ""} { configure.cflags-append ${configure.cppflags} configure.cxxflags-append ${configure.cppflags} } }}} As a consequence the CMake-based installations have problems when function definitions change in an upgrade. I don't know if I should blame the developers for that or not. (In case of CLHEP, the `./configure`-based installation puts `-I.` in front of `CPPFLAGS`, so headers from sources are found first, but in CMake-based installation `-I.` comes later.) We should check whether we could use [http://www.cmake.org/Wiki/CMake_Useful_Variables CMAKE_INCLUDE_PATH] (`-DCMAKE_INCLUDE_PATH=${prefix}/include`) instead of `configure.cxxflags- append ${configure.cppflags}` for example. See also: * https://savannah.cern.ch/bugs/index.php?103664 (and ticket #42613) * http://www.cmake.org/Wiki/CMake_Useful_Variables -- Ticket URL: <https://trac.macports.org/ticket/42872> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS --------------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep cmake | --------------------------+-------------------------------- Comment (by ryandesign@…): Replying to [ticket:42872 mojca@…]:
According to that, we could just set `CMAKE_PREFIX_PATH=${prefix}`, to take care of libraries, includes and binaries. You could make that change to the portgroup locally and see whether it solves the problem, and also test some other cmake-portgroup-using ports to make sure they still build ok. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS --------------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep cmake | --------------------------+-------------------------------- Comment (by christian.frisson@…): Hi, This affects Port vxl too, as explained in ticket #41241. Removing the cppflags appends fixes one of the issues, works in this case even without setting the CMAKE_PREFIX_PATH as proposed above. Best regards, Christian -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Changes (by and.damore@…): * port: clhep cmake => clhep Old description:
CMake is automatically fed with too many (too early) includes of `$prefix/include`:
{{{ CPPFLAGS='-I/opt/local/include' CFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' CXXFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' }}} with the following explanation in the `PortGroup`: {{{ # The environment variable CPPFLAGS is not considered by CMake. # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" # <http://www.cmake.org/Bug/view.php?id=12928>). # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the # pre-configure phase. if {${configure.cppflags} ne ""} { configure.cflags-append ${configure.cppflags} configure.cxxflags-append ${configure.cppflags} } }}}
As a consequence the CMake-based installations have problems when function definitions change in an upgrade. I don't know if I should blame the developers for that or not. (In case of CLHEP, the `./configure`-based installation puts `-I.` in front of `CPPFLAGS`, so headers from sources are found first, but in CMake-based installation `-I.` comes later.)
We should check whether we could use [http://www.cmake.org/Wiki/CMake_Useful_Variables CMAKE_INCLUDE_PATH] (`-DCMAKE_INCLUDE_PATH=${prefix}/include`) instead of `configure .cxxflags-append ${configure.cppflags}` for example.
See also: * https://savannah.cern.ch/bugs/index.php?103664 (and ticket #42613) * http://www.cmake.org/Wiki/CMake_Useful_Variables
New description: The configure phase of a port using cmake portgroup is automatically fed with too many (too early) includes of `$prefix/include`: {{{ CPPFLAGS='-I/opt/local/include' CFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' CXXFLAGS='-pipe -Os -I/opt/local/include -arch x86_64' }}} with the following explanation in the `PortGroup`: {{{ # The environment variable CPPFLAGS is not considered by CMake. # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" # <http://www.cmake.org/Bug/view.php?id=12928>). # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the # pre-configure phase. if {${configure.cppflags} ne ""} { configure.cflags-append ${configure.cppflags} configure.cxxflags-append ${configure.cppflags} } }}} As a consequence the CMake-based installations have problems when function definitions change in an upgrade. I don't know if I should blame the developers for that or not. (In case of CLHEP, the `./configure`-based installation puts `-I.` in front of `CPPFLAGS`, so headers from sources are found first, but in CMake-based installation `-I.` comes later.) We should check whether we could use [http://www.cmake.org/Wiki/CMake_Useful_Variables CMAKE_INCLUDE_PATH] (`-DCMAKE_INCLUDE_PATH=${prefix}/include`) instead of `configure.cxxflags- append ${configure.cppflags}` for example. See also: * https://savannah.cern.ch/bugs/index.php?103664 (and ticket #42613) * http://www.cmake.org/Wiki/CMake_Useful_Variables -- -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by and.damore@…): I'm building neovim using mp-provided libraries and I have ''-I$prefix'' before any other includes arg, this lead to error due to what clang interpret as implicit declaration. Is the position of ''-I$prefix'' in the makefile generated by cmake due to the issue described in this ticket? -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by mojca@…): Eeeeem. Why did you change the port from `clhep cmake` to `clhep`. Did you want to change it to `cmake` and removed the wrong one by accident? Or do you want to suggest that this isn't CMake's PortGroup problem at all and that ports should be fixed instead? -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by mojca@…): The position of `-I$prefix` comes so early in the `Makefile` because of `$C(XX)FLAGS`. The author of software has some influence on that order and could in principle make sure that other paths come in front. But on the other hand it's also somewhat true that one could add the include path to other variables instead of `$CXXFLAGS`. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by and.damore@…): Replying to [comment:7 mojca@…]:
Eeeeem. Why did you change the port from `clhep cmake` to `clhep`. Did you want to change it to `cmake` and removed the wrong one by accident? Or do you want to suggest that this isn't CMake's PortGroup problem at all and that ports should be fixed instead?
No what I meant is that this ticket isn't about cmake port, but about cmake portgroup. The cmake port is the one responsible for installing cmake while the cmake portgroup is a collection of functions to be used in other ports to leverage cmake features. The issue you're mentioning happens in the latter ones so it occurs to me that putting cmake in the ticket's "port" field is wrong. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:10> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by mojca@…): Yes, I'm aware of the difference between the port and the PortGroup, but `cmake` is the closest tag / description one can use. Unless we introduce a convention of how to tag the tickets related to PortGroups (say, `cmake-1.0.tcl` or `group_cmake` or maybe even changing the category from "ports" to "groups"), using '`cmake`' in the port field is the most reasonable approach I can think of. After all, the maintainer of the port should to some extent also try to address tickets closely related to the PortGroup, so using the closest relative doesn't seem too problematic to me. If we remove the tag `cmake`, please suggest another tag. Using `clhep` in the port field is just as wrong (or even more wrong). -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:11> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by and.damore@…): Replying to [comment:11 mojca@…]:
but `cmake` is the closest tag / description one can use.
The port field is not mandatory, just think of base-related tickets. I suggest to just leave it blank and remove ''clhep'' as well since the issue is not specific to that. The ticket is already very well discoverable by its summary when searching ''cmake'' in ''ticket port & summary'' that is the most strict kind of query in generic search page.
After all, the maintainer of the port should to some extent also try to address tickets closely related to the PortGroup, so using the closest relative doesn't seem too problematic to me.
That's not necessarily true, the cmake maintainer could be not interested at all in following the ports that use cmake portgroup. The problem with using a wrong port field value just because it's "the best guess" is that the information is misleading, I found this ticket while I was searching for an actual port:cmake issue so I tried to make the ticket more correct. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:12> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by mojca@…): Another victim requiring {{{ configure.cppflags-delete -I${prefix}/include }}} seems to be wxLua. Maybe we can continue passing other `cppflags` to `cxxflags`, but it seems that `-I${prefix}/include` really needs to go. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:13> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: clhep | ----------------------+-------------------------------- Comment (by cal@…): r118762 is another instance of this. Can we please get the offending line removed ASAP? `CMAKE_SYSTEM_PREFIX_PATH` should already be enough to specify the required includes. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:14> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Changes (by mojca@…): * port: clhep => -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:15> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Comment (by mojca@…): Is the following OK? {{{ #!diff --- cmake-1.0.tcl (revision 121111) +++ cmake-1.0.tcl (working copy) @@ -81,12 +81,9 @@ # The environment variable CPPFLAGS is not considered by CMake. # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" # <http://www.cmake.org/Bug/view.php?id=12928>). - # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the - # pre-configure phase. - if {${configure.cppflags} ne ""} { - configure.cflags-append ${configure.cppflags} - configure.cxxflags-append ${configure.cppflags} - } + # + # But adding -I${prefix}/include to CFLAGS/CXXFLAGS is a bad idea. + # If any other flags are needed, we need to add them. # In addition, CMake provides build-type-specific flags for # Release (-O3 -DNDEBUG), Debug (-g), MinSizeRel (-Os -DNDEBUG), and }}} -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:17> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Comment (by mojca@…): I committed the patch in r121112. I'll go ahead and remove workarounds from ports that tried to overcome the problem by removing the flag manually. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:18> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Comment (by mojca@…): List of ports that likely removed `cppflags` because of this problem: * `_resources/port1.0/group/kde4-1.1.tcl` * `graphics/glfw` * `print/libLASi` * `science/bladeRF` * `science/clhep` * `science/gnuradio` * `science/gr-baz` * `science/gr-fcdproplus` * `science/gr-fosphor` * `science/gr-iqbalance` * `science/gr-osmosdr` * `science/gr-rds` * `science/hackrf` * `science/root6` * `science/rtl-sdr` * `science/uhd` -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:19> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Comment (by michaelld@…): I'll remove them from my ports: graphics/glfw and science/{gnuradio, gr-*, hackrf, rtl-sdr, uhd}. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:20> MacPorts <http://www.macports.org/> Ports system for OS X
#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS ----------------------+-------------------------------- Reporter: mojca@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: | ----------------------+-------------------------------- Comment (by michaelld@…): Done: gr-osmosdr in r121143. bladeRF in r121144. gnuradio* in r121146. gr- rds in r121146. gr-fosphor in r121147. gr-fcdproplus in r121148. gr- iqbalance in r121149. gr-baz in r121150. hackrf in r121151. uhd* in r121152. rtl-sdr in r121153. glfw in r121154. I think that's all of my ports. -- Ticket URL: <https://trac.macports.org/ticket/42872#comment:21> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts