Opened 3 years ago

Closed 3 years ago

#63530 closed defect (fixed)

libhandy @1.2.0_0: Compiler mismatch invoking g-ir-scanner

Reported by: evanmiller (Evan Miller) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc:
Port: libhandy gobject-introspection

Description

I'm working through some issues compiling libhandy. When I enforce C11 with compiler.c_standard=2011, MacPorts selects gcc-mp-7 for the main compilation, but then g-ir-scanner apparently selects gcc-apple-4.2 during the build, so I error out with some unrecognized flag warnings.

:info:build cc1: error: unrecognized command line option "-Wdate-time"
:info:build cc1: error: -Werror=incompatible-pointer-types: No option -Wincompatible-pointer-types
:info:build cc1: error: -Werror=shift-count-overflow: No option -Wshift-count-overflow
:info:build cc1: error: -Werror=shift-overflow=2: No option -Wshift-overflow=2
:info:build cc1: error: -Werror=implicit-fallthrough=3: No option -Wimplicit-fallthrough=3
:info:build cc1: error: unrecognized command line option "-Wmaybe-uninitialized"
:info:build cc1: error: unrecognized command line option "-Wtype-limits"
:info:build Traceback (most recent call last):
:info:build   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/unixccompiler.py", line 107, in preprocess
:info:build     self.spawn(pp_args)
:info:build   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/ccompiler.py", line 910, in spawn
:info:build     spawn(cmd, dry_run=self.dry_run)
:info:build   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/spawn.py", line 91, in spawn
:info:build     raise DistutilsExecError(
:info:build distutils.errors.DistutilsExecError: command '/opt/local/bin/gcc-apple-4.2' failed with exit code 1
:info:build During handling of the above exception, another exception occurred:
:info:build Traceback (most recent call last):
:info:build   File "/opt/local/bin/g-ir-scanner", line 99, in <module>
:info:build     sys.exit(scanner_main(sys.argv))
:info:build   File "/opt/local/lib/gobject-introspection/giscanner/scannermain.py", line 570, in scanner_main
:info:build     ss, filenames = create_source_scanner(options, args)
:info:build   File "/opt/local/lib/gobject-introspection/giscanner/scannermain.py", line 443, in create_source_scanner
:info:build     ss.parse_files(filenames)
:info:build   File "/opt/local/lib/gobject-introspection/giscanner/sourcescanner.py", line 257, in parse_files
:info:build     self._parse(headers)
:info:build   File "/opt/local/lib/gobject-introspection/giscanner/sourcescanner.py", line 303, in _parse
:info:build     cc.preprocess(tmp_name_cpp,
:info:build   File "/opt/local/lib/gobject-introspection/giscanner/ccompiler.py", line 275, in preprocess
:info:build     self.compiler.preprocess(source=source,
:info:build   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/unixccompiler.py", line 109, in preprocess
:info:build     raise CompileError(msg)
:info:build distutils.errors.CompileError: command '/opt/local/bin/gcc-apple-4.2' failed with exit code 1

I'm not sure where the bug lies exactly, but g-ir-scanner should be invoking the same compiler as the main build. The unrecognized flags appear to originate with libhandy.

Full log to follow.

Attachments (1)

libhandy-main.log (141.9 KB) - added by evanmiller (Evan Miller) 3 years ago.

Download all attachments as: .zip

Change History (4)

Changed 3 years ago by evanmiller (Evan Miller)

Attachment: libhandy-main.log added

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

a lot of Portfiles that use g-ir-scanner have this block added to them:

# uses g-ir-scanner, which uses $CC from env
if {${universal_possible} && [variant_isset universal]} {
    foreach arch ${configure.universal_archs} {
        lappend merger_build_env(${arch})  "CC=${configure.cc} -arch ${arch}"
        lappend merger_destroot_env(${arch})  "CC=${configure.cc} -arch ${arch}"
    }
} else {
    build.env-append       "CC=${configure.cc} ${configure.cc_archflags}"
    destroot.env-append    "CC=${configure.cc} ${configure.cc_archflags}"
}

comment:2 Changed 3 years ago by evanmiller (Evan Miller)

Thank you! I'll cook up a PR.

comment:3 Changed 3 years ago by evanmiller (Evan Miller)

Resolution: fixed
Status: assignedclosed

In f1c4cc1776ed07987fe88e4889a123375c29557c/macports-ports (master):

libhandy: Fix build with older compilers present

Closes: #63530

Note: See TracTickets for help on using tickets.