Opened 3 years ago

Closed 2 years ago

#65132 closed defect (fixed)

pg debug: eliminate use of mtune=native for non-debug builds; both unnecessary, and not supported by at least some versions of gcc

Reported by: barracuda156 Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: portgroup Cc:
Port: spatialite

Description

The error confirmed on Tiger and Snow Leopard.

checking for gcc... /opt/local/bin/gcc-apple-4.2
checking whether the C compiler works... no
configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_spatialite/spatialite/work/libspatialite-5.0.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_spatialite/spatialite/work/libspatialite-5.0.1" && ./configure --prefix=/opt/local --enable-rttopo --enable-libxml2 --disable-freexl 
Exit code: 77

Attachments (2)

config.log (10.0 KB) - added by barracuda156 3 years ago.
main.log (10.0 KB) - added by barracuda156 3 years ago.

Download all attachments as: .zip

Change History (23)

Changed 3 years ago by barracuda156

Attachment: config.log added

Changed 3 years ago by barracuda156

Attachment: main.log added

comment:1 Changed 3 years ago by barracuda156

comment:2 Changed 3 years ago by kencu (Ken)

error: bad value (native) for -mtune= switch

comment:3 in reply to:  2 Changed 3 years ago by barracuda156

Replying to kencu:

error: bad value (native) for -mtune= switch

You mean you are getting this now? It has built with gcc11 on 10.6 and with gcc7 on 10.4.11 for me. I did not check Leopard, but in principle simply blacklisting a compiler is not supposed to create havoc. Or do I miss something? (Sorry if I did, I will fix it then.)

Last edited 3 years ago by barracuda156 (previous) (diff)

comment:4 Changed 3 years ago by kencu (Ken)

that was the error in your gcc-4.2 build.

I guess gcc-4.2 doesn’t like that option.

we rarely have that as a default as the buildbots make a generic version for people to download.

comment:5 in reply to:  4 Changed 3 years ago by barracuda156

Replying to kencu:

that was the error in your gcc-4.2 build.

I guess gcc-4.2 doesn’t like that option.

we rarely have that as a default as the buildbots make a generic version for people to download.

Ah, got it. Would you prefer patching out the flag rather than blacklisting old gcc?

comment:6 Changed 3 years ago by kencu (Ken)

If that is possible and if it works, I know that is what MacPorts prefers.

comment:7 in reply to:  6 Changed 3 years ago by barracuda156

Replying to kencu:

If that is possible and if it works, I know that is what MacPorts prefers.

Okay, I will try that when I back to PPC machine.

comment:8 in reply to:  4 Changed 2 years ago by barracuda156

Replying to kencu:

that was the error in your gcc-4.2 build.

I guess gcc-4.2 doesn’t like that option.

we rarely have that as a default as the buildbots make a generic version for people to download.

Hmm, where does this come from?

:notice:configure --->  Configuring spatialite
:debug:configure Preferred compilers: gcc-4.2 llvm-gcc-4.2 gcc-4.0 macports-gcc-11 macports-gcc-10 macports-gcc-7 macports-gcc-6 macports-gcc-5
:debug:configure Using compiler 'Xcode GCC 4.2'
:debug:configure Executing org.macports.configure (spatialite)
:debug:configure Environment: 
:debug:configure CC='/usr/bin/gcc-4.2'
:debug:configure CC_PRINT_OPTIONS='YES'
:debug:configure CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_spatialite/spatialite/work/.CC_PRINT_OPTIONS'
:debug:configure CFLAGS='-pipe -Os -mtune=native -arch ppc'
:debug:configure CPATH='/opt/local/include'
:debug:configure CPPFLAGS='-mtune=native -I/opt/local/lib/proj8/include'
:debug:configure CXX='/usr/bin/g++-4.2'
:debug:configure CXXFLAGS='-pipe -Os -mtune=native -arch ppc'
:debug:configure DEVELOPER_DIR='/Developer'
:debug:configure F90FLAGS='-pipe -Os -mtune=native -m32'
:debug:configure FCFLAGS='-pipe -Os -mtune=native -m32'
:debug:configure FFLAGS='-pipe -Os -mtune=native -m32'
:debug:configure INSTALL='/usr/bin/install -c'
:debug:configure LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/proj8/lib -arch ppc'
:debug:configure LIBRARY_PATH='/opt/local/lib'
:debug:configure MACOSX_DEPLOYMENT_TARGET='10.6'
:debug:configure OBJC='/usr/bin/gcc-4.2'
:debug:configure OBJCFLAGS='-pipe -Os -arch ppc'
:debug:configure OBJCXX='/usr/bin/g++-4.2'
:debug:configure OBJCXXFLAGS='-pipe -Os -mtune=native -arch ppc'

I don't find anything about -mtune in the source (unless BBEdit fails to).

comment:9 Changed 2 years ago by kencu (Ken)

Hard to know, isn't is? You have to figure out where this -mtune=native is coming from, as you can see it in all your flags there.

comment:10 in reply to:  9 Changed 2 years ago by barracuda156

Replying to kencu:

Hard to know, isn't is? You have to figure out where this -mtune=native is coming from, as you can see it in all your flags there.

It does show up in .CC_PRINT_OPTIONS file in a work directory, but I have no idea what creates that file.

comment:11 Changed 2 years ago by kencu (Ken)

MacPorts is adding it, it appears, not the build itself:

--->  Configuring spatialite
DEBUG: Preferred compilers: clang macports-clang-14 macports-clang-13 macports-clang-12 macports-clang-11 macports-clang-10 macports-clang-9.0
DEBUG: Using compiler 'Xcode Clang'
DEBUG: Executing org.macports.configure (spatialite)
DEBUG: Environment: 
CC='/usr/bin/clang'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_spatialite/spatialite/work/.CC_PRINT_OPTIONS'
CFLAGS='-pipe -Os -mtune=native -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'
CPATH='/opt/local/include'
CPPFLAGS='-mtune=native -I/opt/local/lib/proj8/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'
CXX='/usr/bin/clang++'
CXXFLAGS='-pipe -Os -mtune=native -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'
DEVELOPER_DIR='/Library/Developer/CommandLineTools'
F90FLAGS='-pipe -Os -mtune=native -m64'
FCFLAGS='-pipe -Os -mtune=native -m64'
FFLAGS='-pipe -Os -mtune=native -m64'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/proj8/lib -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='12.0'
OBJC='/usr/bin/clang'
OBJCFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'
OBJCXX='/usr/bin/clang++'
OBJCXXFLAGS='-pipe -Os -mtune=native -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'
SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_spatialite/spatialite/work/libspatialite-5.0.1" && ./configure --prefix=/opt/local --enable-rttopo --enable-libxml2 --disable-freexl 
DEBUG: system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_spatialite/spatialite/work/libspatialite-5.0.1" && ./configure --prefix=/opt/local --enable-rttopo --enable-libxml2 --disable-freexl 

And I think maybe something called the debug-1.0 PortGroup is adding it:

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
#
# This PortGroup sets up default variants for projects that want m
#
# Usage:
#
#   PortGroup               debug 1.0

configure.cflags-append    -mtune=native
configure.cxxflags-append  -mtune=native
configure.fflags-append    -mtune=native
configure.f90flags-append  -mtune=native
configure.fcflags-append   -mtune=native
configure.cppflags-append  -mtune=native

ui_debug "adding the default debug variant"
variant debug description {Enable debug flags and symbols} {
    configure.cflags-delete     -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1
    configure.cxxflags-delete   -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1
    configure.cppflags-delete   -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1
    configure.fflags-delete     -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1
    configure.f90flags-delete   -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1
    configure.fcflags-delete    -O1 -O2 -O3 -Os -mtune=native -DNDEBUG -DNDEBUG=1

    # certain options break the way cmake configures, so test for cmake variable
    if {[info exists cmake_share_module_dir]} {
        configure.args-delete   -DCMAKE_BUILD_TYPE=Release
        configure.args-append   -DCMAKE_BUILD_TYPE=debugFull
    } else {
        configure.args-delete   --disable-debug
        configure.args-append   --enable-debug
    }

    configure.cflags-append     -g -O0
    configure.cxxflags-append   -g -O0
    configure.fflags-append     -g -O0
    configure.f90flags-append   -g -O0
    configure.fcflags-append    -g -O0
}

post-destroot {
  if {[variant_isset debug]} {
      ui_debug "Generating the .dSYM bundles because of +debug: find ${destroot}${prefix} -type f '(' -name '*.dylib' -or -name '*.so' ')' -exec dsymutil {} +"
      system -W ${destroot}${prefix} "find . -type f '(' -name '*.dylib' -or -name '*.so' ')' -exec dsymutil {} +"
  }
}

although why that portgroup exists, what it is for, and how to stop it from doing that is presently a mystery.

comment:12 in reply to:  11 Changed 2 years ago by barracuda156

Replying to kencu:

MacPorts is adding it, it appears, not the build itself:

Removing this PortGroup fixes the build with gcc-4.2. So what should we prefer as a fix?

comment:13 Changed 2 years ago by kencu (Ken)

don’t use it, or don’t have it add mtune if gcc is the compiler.

probably the second thing is more generally acceptable

comment:14 Changed 2 years ago by kencu (Ken)

this portgroup needs revisiting. It is setting mtune for no good reason I can see, and is setting optflags everywhere except configure.optflags, where they should be set. there must be some history to how it came to be like this, but it still is not right

comment:15 in reply to:  13 Changed 2 years ago by barracuda156

Replying to kencu:

don’t have it add mtune if gcc is the compiler. probably the second thing is more generally acceptable

I don’t really know how to do it this way.

It is not particularly clear even why debug variant should be silently forced through.

comment:16 Changed 2 years ago by kencu (Ken)

the last time this PG was touched in a meaningful way was 2014

comment:17 Changed 2 years ago by kencu (Ken)

Keywords: powerpc tiger snowleopard removed
Summary: spatialite: gcc-4.x has to be blacklisted on PPC: configure: error: C compiler cannot create executablesspatialite: build fails due to debug-1.0 PortGroup setting mtune=native which is not supported by default compiler

comment:18 Changed 2 years ago by kencu (Ken)

Summary: spatialite: build fails due to debug-1.0 PortGroup setting mtune=native which is not supported by default compilerspatialite: build fails due to debug-1.0 PortGroup setting mtune=native which is not supported by at least some versions of gcc

comment:19 Changed 2 years ago by mascguy (Christopher Nielsen)

Keywords: portgroup added
Owner: set to mascguy
Status: newassigned
Summary: spatialite: build fails due to debug-1.0 PortGroup setting mtune=native which is not supported by at least some versions of gccpg debug: spatialite build fails, due to mtune=native; not supported by at least some versions of gcc

I'll take this, as I'm working on modernizing pg debug. And that includes elimination of mtune=native for non-debug builds.

comment:20 Changed 2 years ago by mascguy (Christopher Nielsen)

Summary: pg debug: spatialite build fails, due to mtune=native; not supported by at least some versions of gccpg debug: eliminate use of mtune=native for non-debug builds; both unnecessary, and not supported by at least some versions of gcc

comment:21 Changed 2 years ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In 99e1ff5d9dfe31857e559eb60eb360f4504b8e66/macports-ports (master):

pg debug: drop mtune=native for non-debug builds

  • More generally, ensure non-debug builds not affected, period
  • Also ensure flags are set for ObjC/Cxx

Fixes: #65132
See: #65630

Note: See TracTickets for help on using tickets.