[MacPorts] #62426: libc++: using a newer libc++ to build software on older macos systems

MacPorts noreply at macports.org
Wed Apr 21 16:05:40 UTC 2021


#62426: libc++: using a newer libc++ to build software on older macos systems
-------------------------------------+----------------------
  Reporter:  kencu                   |      Owner:  kencu
      Type:  enhancement             |     Status:  assigned
  Priority:  Normal                  |  Milestone:
 Component:  ports                   |    Version:
Resolution:                          |   Keywords:
      Port:  libcxx macports-libcxx  |
-------------------------------------+----------------------

Comment (by kencu):

 Oh, it's ready to use now. It's so simple I was not planning on making a
 PortGroup... people need to specifically test it anyway.

 See the following two examples for how to make it work:

 <https://github.com/macports/macports-ports/pull/10238>

 and

 <https://github.com/macports/macports-ports/pull/10382>

 Basically, for a standard c++ port, you do this:

 {{{
 if {${os.platform} eq "darwin" && ${os.major} < 19} {
     PortGroup compiler_blacklist_versions 1.0

     # compiler floor currently set at clang-9.0 and Xcode 11 from Mojave,
 as those are tested and work
     compiler.blacklist-append {clang < 1100} {macports-clang-3.[3-9]}
 {macports-clang-[5-8].0}

     # requires a newer libc++ than the system can provide
     depends_lib-append        port:macports-libcxx
     configure.cxxflags-append -nostdinc++ -I${prefix}/include/libcxx/v1
     configure.ldflags-append  -L${prefix}/lib/libcxx
 }
 }}}

 I have come across a more elegant flag to set the C++ standard include
 path {{{-stdlib++-isystem}}} that is accepted on newer clangs (macports-
 clang-10 and probably clang-1200+), so it could be used instead, but in
 reality it's not much simpler so probably not worth the extra hassle.

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


More information about the macports-tickets mailing list