Opened 5 months ago

Last modified 11 days ago

#65404 assigned defect

gate @8.2_2+geant4105: error: "ROOT requires support for C++14 or higher."

Reported by: lv0021 Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc:
Port: gate

Description (last modified by ryandesign (Ryan Schmidt))

Following the command port install gate I receive a build error.

--->  Building gate
Error: Failed to build gate: command execution failed

The main.log file is attached. I'm using osx monterey 12.4.

There is a previous entry for gate (from 2 years ago) but no solution is proposed. I'm new to macports so the solution may be simple

Attachments (1)

main.log (672.8 KB) - added by lv0021 5 months ago.

Download all attachments as: .zip

Change History (5)

Changed 5 months ago by lv0021

Attachment: main.log added

comment:1 Changed 5 months ago by ryandesign (Ryan Schmidt)

Cc: mojca removed
Owner: set to mojca
Status: newassigned
Summary: gate-8.2_2+geant4105- Failed to build gate: command execution failedgate @8.2_2+geant4105: error: "ROOT requires support for C++14 or higher."

The error in your log looks fairly straightforward to fix:

/opt/local/libexec/root6/include/root/ROOT/RConfig.hxx:48:4: error: "ROOT requires support for C++14 or higher."
#  error "ROOT requires support for C++14 or higher."
   ^
/opt/local/libexec/root6/include/root/ROOT/RConfig.hxx:50:5: error: "Pass `-std=c++14` as compiler argument."
#   error "Pass `-std=c++14` as compiler argument."
    ^

comment:2 Changed 5 months ago by ryandesign (Ryan Schmidt)

Description: modified (diff)

Has duplicate #65486.

The simple solution I was envisioning was

  • using compiler.cxx_standard 2014 to get MacPorts to pick a C++14-capable compiler, and
  • using configure.cxxflags-append -std=c++14 to tell the compiler to use C++14 mode.

But I envisioned that before looking at the Portfile, and I now see that it

  • uses compiler.blacklist and compiler.whitelist to, according to a comment, force the same compiler as root6, yet this code does not match what is currently in the root6 portfile, and
  • uses a patch and reinplace to replace the -std=c++11 flag hardcoded in the CMakeLists.txt with -std=c++17.

Usually the use of compiler.whitelist is not desired because it overrides anything in compiler.blacklist, and compiler.blacklist should usually be avoided in favor of compiler.cxx_standard if all you're doing is requesting a compiler supporting a particular C++ standard.

It's unclear to me why the -std=c++17 flag isn't actually being used then since the CMakeLists.txt says to use it. In fact it is being used, but two -std=c++11 flags are also being used, one before and one after -std=c++17, and the last one wins. I'm not sure where those -std=c++11 flags are coming from. Possibly from geant4.10.5.

The root6 portfile currently contains code that uses C++17 on macOS 10.14 and later and C++14 otherwise. If that distinction is necessary, then maybe the gate port should do the same, but it's not ideal for the gate port (and any other ports that use root6) to have to duplicate this compiler-selection-and-flag-setting code and keep it in sync with the root6 portfile.

comment:3 in reply to:  2 Changed 11 days ago by Stabbass

Hi I am facing the exact same issue. I am wondering is there is any solution to resolve this issue or any workaround ?

Replying to ryandesign:

Has duplicate #65486.

The simple solution I was envisioning was

  • using compiler.cxx_standard 2014 to get MacPorts to pick a C++14-capable compiler, and
  • using configure.cxxflags-append -std=c++14 to tell the compiler to use C++14 mode.

But I envisioned that before looking at the Portfile, and I now see that it

  • uses compiler.blacklist and compiler.whitelist to, according to a comment, force the same compiler as root6, yet this code does not match what is currently in the root6 portfile, and
  • uses a patch and reinplace to replace the -std=c++11 flag hardcoded in the CMakeLists.txt with -std=c++17.

Usually the use of compiler.whitelist is not desired because it overrides anything in compiler.blacklist, and compiler.blacklist should usually be avoided in favor of compiler.cxx_standard if all you're doing is requesting a compiler supporting a particular C++ standard.

It's unclear to me why the -std=c++17 flag isn't actually being used then since the CMakeLists.txt says to use it. In fact it is being used, but two -std=c++11 flags are also being used, one before and one after -std=c++17, and the last one wins. I'm not sure where those -std=c++11 flags are coming from. Possibly from geant4.10.5.

The root6 portfile currently contains code that uses C++17 on macOS 10.14 and later and C++14 otherwise. If that distinction is necessary, then maybe the gate port should do the same, but it's not ideal for the gate port (and any other ports that use root6) to have to duplicate this compiler-selection-and-flag-setting code and keep it in sync with the root6 portfile.

comment:4 Changed 11 days ago by kencu (Ken)

The -std=c++11 flags are being picked up from the Geant4Config.cmake in the geant port.

geant can be rebuilt to use c++17 by adding this configure flag in the right location in the geant4 Portfile:

configure.args-append -DGEANT4_BUILD_CXXSTD=17

and that solves the c++14 issue.

However, the (current) gate port uses std:mem_fun() and that has been removed from c++17, https://en.cppreference.com/w/cpp/utility/functional/mem_fun, so presumably there is some update to gate, or that will have to be patched out. Or perhaps everything reconfigured to use c++14 (yuk).

Last edited 11 days ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.