Opened 4 months ago

Last modified 4 months ago

#69067 new defect

libgcc* ports apparently do not need +stdlib_flag variants, it does nothing

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: cjones051073 (Chris Jones), catap (Kirill A. Korinsky)
Port: libgcc10, libgcc11, libgcc12, libgcc13

Description

While gcc* use +stdlib_flag to be able to use libc++ headers, for libgcc* it is apparently redundant and does nothing.

If that is indeed the case, the following chunk is wrong:

if { ${subport} ne ${libcxxname} } {

    variant stdlib_flag description {Enable stdlib command line flag to select c++ runtime} {
        # Enables support for specifying the c++ runtime via `-stdlib=` in a similar
        # way to clang. For more details see the later comments in
        #   https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg257385.html
        # Note : This 'bakes' the libc++ include directory into gcc,
        # which is then used as the default search location when `-stdlib=libc++`
        # is given. Therefore to have consistency across various OS versions, and to enable
        # modern c++ standards, use a recent macports clang port to provide this.
        if {${subport} eq ${name}} {
            depends_run-append port:${libcxxname}
        }
        configure.args-append --with-gxx-libcxx-include-dir="${libcxx_incpath}"
    }

    # libcxx may not be fully functional on PowerPC yet.
    if {${build_arch} ni [list ppc ppc64]} {
        default_variants-append +stdlib_flag
    }

}

And the condition for it should rather be if { ${subport} eq ${name} }, not if { ${subport} ne ${libcxxname} }.

Change History (1)

comment:1 Changed 4 months ago by cjones051073 (Chris Jones)

I do not see what the problem is here.

  1. The if statement is correct. The configure option needs to be applied to both the main gccX port but also the libgccX sub-port, and the current check does this.
  1. I do not understand what you mean by the above doing nothing ? The variant correctly ensures the -with-gxx-libcxx-include-dir option is applied. e.g. from sudo port -d configure gcc13
DEBUG: system:  cd "/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_lang_gcc13/gcc13/work/build" && /opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_lang_gcc13/gcc13/work/gcc-13.2.0/configure --prefix=/opt/local --build=arm64-apple-darwin23 --enable-languages=c,c++,objc,obj-c++,lto,fortran,jit --libdir=/opt/local/lib/gcc13 --includedir=/opt/local/include/gcc13 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-13 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-13 --with-gxx-include-dir=/opt/local/include/gcc13/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --with-zstd=/opt/local --enable-checking=release --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld-classic --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --with-darwin-extra-rpath=/opt/local/lib/libgcc --with-libiconv-prefix=/opt/local --disable-tls --with-gxx-libcxx-include-dir="/opt/local/libexec/gcc13/libc++/include/c++/v1" --with-pkgversion="MacPorts gcc13 13.2.0_4+stdlib_flag" --with-sysroot="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" 

So, in short, I don't see anything wrong here.

Note: See TracTickets for help on using tickets.