Opened 9 years ago

Closed 5 years ago

#49709 closed defect (fixed)

cmake, gnuradio, gr-foo, gr-ieee802-11, gr-ieee802-15-4, volk: just use cxx11 1.0 portgroup

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch Cc: cssdev, mojca (Mojca Miklavec), chrstphrchvz (Christopher Chavez)
Port: cmake gnuradio gr-foo gr-ieee802-11 gr-ieee802-15-4 volk

Description

The cmake, gnuradio, gr-foo, gr-ieee802-11, gr-ieee802-15-4, and volk ports include a block of code designed to select the correct compilers for code that requires C++11.

Large amounts of common code should not be copy/pasted; instead a portgroup should be created.

The cxx11 1.0 portgroup already exists to provide this functionality. The gnuradio port was not using it, but the others were, conditionally, if libc++ is used. The portgroup is designed to be included unconditionally, without regard for which C++ library is used, and to provide the user the correct advice or behavior in either case. If this portgroup is not meeting your needs, please enhance the portgroup or discuss the situation on the macports-dev mailing list. Otherwise, just include the portgroup and let it do what it's designed to do; see attached patch.

Attachments (1)

cxx11.diff (8.8 KB) - added by ryandesign (Ryan Carsten Schmidt) 9 years ago.
proposed patch

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: cxx11.diff added

proposed patch

comment:1 Changed 9 years ago by michaelld (Michael Dickens)

The cxx11 1.0 port group only handles C++11 for libc++. It does not handle C++11 for libstdc++. From the comment in that PortGroup:

# Compilers supporting C++11 are GCC >= 4.6 and clang >= 3.3.
# As we only support libc++, clang is implicitly required.
# Blacklist all GCC compilers to not accidentally pull in libstdc++.
# We do not know what "cc" is, so blacklist it as well.

There have been past discussions on the MP-dev list about this topic, and the conclusion is that there is no generic way to handle libstdc++ and C++11 within the current MP framework. That said, my way here works for the GR ports & is used by some users / customers (per email feedback). Until MP comes up with a good way of handling libstdc++ and C++11, I'm going to leave these in place; maybe update them to use gcc5.

There is a lot of redundancy in the GR-related ports, quite true. I will look into creating a GR PortGroup file sooner or later, which incorporates the common parts of the GR Portfiles as well as some optional function to handle C++11 (such that there's just 1 place to make any C++11 changes, assuming MP ever gets to that point).

comment:2 Changed 9 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:3 Changed 9 years ago by mojca (Mojca Miklavec)

A tiny note about CMake.

This change might conflict with

platform darwin {
    # TODO: Figure out why using libc++ fails on Lion and fix the bootstrap
    #       script to honor CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET.
    #       Since nothing links against cmake and cmake is just using the STL,
    #       we're safe to force libstdc++
    #
    #       https://www.cmake.org/Bug/view.php?id=15039&nbn=16
    if {${os.major} < 12} {
        configure.cxx_stdlib libstdc++
    }
}

Note that libstdc++ is not really needed, but due to a bug in clang shipped with Lion one cannot use the system clang++ with libc++. Just make sure that if libc++ is used, clang 425 gets blacklisted and replaced by macports-clang-3.4 or later.

comment:4 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

cmake, gnuradio, gr-foo, gr-ieee802-11, gr-ieee802-15-4, and volk all now use the cxx11 1.1 portgroup. I think this ticket can be closed.

comment:5 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:6 Changed 5 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.