Opened 7 months ago

Last modified 4 days ago

#56511 new defect

gcc49 @4.9.4_2: build fails with Xcode 9 on macOS 10.12

Reported by: mopihopi Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: larryv (Lawrence Velázquez), scrallen, Schamschula (Marius Schamschula), rekeeley (Ryan Keeley)
Port: gcc49

Description

The recent mpfr update causes the gcc49 binary to break (libmpfr.4.dylib → libmpfr.6.dylib), so rev-upgrade attempts to rebuild it. However the rebuild fails, on macOS 10.12.6 with XCode 9.2:

--->  Scanning binaries for linking errors
--->  Found 7 broken files, matching files to ports      
--->  Found 1 broken port, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt: gcc49 @4.9.4
Continue? [Y/n]: y
--->  Computing dependencies for gcc49
--->  Cleaning gcc49
--->  Scanning binaries for linking errors
--->  Found 7 broken files, matching files to ports      
--->  Found 1 broken port, determining rebuild order
--->  Rebuilding in order
     gcc49 @4.9.4 
--->  Computing dependencies for gcc49
--->  Fetching distfiles for gcc49
--->  Attempting to fetch gcc-4.9.4.tar.bz2 from https://distfiles.macports.org/gcc49
--->  Verifying checksums for gcc49                                                  
--->  Extracting gcc49
--->  Applying patches to gcc49
--->  Configuring gcc49
--->  Building gcc49
Error: Failed to build gcc49: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc49/gcc49/main.log for details.
Error: rev-upgrade failed: Error rebuilding gcc49
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

main.log contains the following compiler error:

...
:info:build In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:89:
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:173:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
...
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G1314
$ xcodebuild -version
Xcode 9.2
Build version 9C40b
$ 

Attachments (1)

gcc49-main.log (663.9 KB) - added by mopihopi 7 months ago.

Download all attachments as: .zip

Change History (19)

Changed 7 months ago by mopihopi

Attachment: gcc49-main.log added

comment:1 Changed 7 months ago by kencu (Ken)

The following bug report looks relevant.

<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81037>

The patches do not appear to have been backported before gcc5.

Try gcc5, gcc6, or gcc7 instead? Otherwise if gcc49 is mandatory, you might need to try to backport the fixes into the gcc49 codebase.

comment:2 Changed 7 months ago by kencu (Ken)

I suppose the following test in the gcc <5 Portfiles should be an Xcode test rather than an os.major test:

if {${os.platform} eq "darwin" && ${os.major} > 16} {
    depends_lib
    depends_run
    archive_sites
    pre-fetch {
        ui_error "${name} is not supported on macOS High Sierra and newer"
        return -code error {unsupported platform}
    }
}

comment:3 Changed 7 months ago by scrallen

Cc: scrallen added

comment:4 Changed 6 months ago by jmroot (Joshua Root)

Cc: larryv Schamschula added; larryv@… removed

Still, this should have been rev bumped after mpfr was updated. Seems like [1f683a75f9aa2423dfb6485f44062b2a97483264/macports-ports] missed quite a few dependents because they are not compatible with High Sierra and clear their deps.

comment:6 Changed 6 months ago by jmroot (Joshua Root)

Interestingly, this seems to affect gcc49 only, i.e. gcc48 and older built OK (and of course gcc5 and later are also fine).

comment:7 Changed 6 months ago by jmroot (Joshua Root)

Summary: gcc49 @4.9.4_2: rev-upgrade rebuild fails on macOS 10.12.6 XCode 9.2gcc49 @4.9.4_2: build fails with Xcode 9 on macOS 10.12

comment:8 Changed 4 months ago by aberezin (Alan Berezin)

Is there a fix for this? I had to uninstall gcc49 for now.

comment:9 in reply to:  8 Changed 4 months ago by ryandesign (Ryan Schmidt)

Replying to aberezin:

Is there a fix for this? I had to uninstall gcc49 for now.

gcc49 is very old; I would recommend using a newer gcc anyway.

comment:10 Changed 4 months ago by kencu (Ken)

I tried to see if I might build gcc49 using a different compiler, like gcc6, but in the end it failed as well on darwin 17. It still pulls in some of the current macOS SDK even with these other compilers, which is the basis of the build issue.

comment:11 Changed 4 months ago by jmroot (Joshua Root)

For reference, the error in the log, which matched one of those mentioned in the upstream report, is:

:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc49/gcc49/work/gcc-4.9.4/gcc/c/c-objc-common.c:33:
:info:build In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:89:
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:173:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
:info:build     _VSTD::abort();
:info:build     ^~~~~~~
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:392:15: note: expanded from macro '_VSTD'
:info:build #define _VSTD std::_LIBCPP_NAMESPACE
:info:build               ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc49/gcc49/work/gcc-4.9.4/gcc/system.h:685:13: note: 'fancy_abort' declared here
:info:build extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
:info:build             ^

comment:12 Changed 3 months ago by kencu (Ken)

can we agree that the fail test in gcc43-gcc49 should be:

if {${os.platform} eq "darwin" && ([vercmp $xcodeversion 9.0] > 0)} {
    depends_lib
    depends_run
    archive_sites
    pre-fetch {
        ui_error "building ${name} is not supported with Xcode 9 or greater"
        return -code error {unsupported platform}
    }
}

If so, I have a commit ready to do that.

comment:13 Changed 3 months ago by cjones051073 (Chris Jones)

LGTM. I see no reason to keep these ancient gcc versions going on the newer macOS versions.

comment:14 Changed 6 weeks ago by mf2k (Frank Schima)

Cc: rekeeley added

Has duplicate #57476.

comment:15 Changed 6 days ago by lancon

I am *NOT* a guru, so please be patient and kindly provide answers "for dummies". And let me know if I should use another means of communication than this.

I have a similar problem to this one (maybe the same, maybe not). gcc49 will not build (on OS 10.12.16). I did a "port clean gcc49" and tried again (twice). Same failure. I then tried port install gcc5, and also port install gcc7... both fail because "The following ports will be rebuilt: gcc49 @4.9.4". Apparently, more recent versions need gcc49 ? The disturbing thing is I have been able to build gcc49 in the past (more specifically, a "port install atlas +gcc49" worked on Nov. 11, 2017 - I must have broken something with other installs or cleans after that but have no idea what. NB: I have installed only the command line tools of Xcode, but that has not been a problem for anything until now (I don't know if that is relevant now); in particular it has not stopped the atlas install with gcc49 last year.

The log of the "port install gcc49" is a very long file. Should I really paste it here? I imagine one can attach files, but I don't know how.

comment:16 Changed 6 days ago by lancon

Typo. I'm on 10.12.6 (not 10.12.16)

comment:17 Changed 6 days ago by kencu (Ken)

I backported fixes to build gcc49 and gcc48 with Xcode 9, but there were a significantly increased number of errors particularly in the c++ test suite that would have possibly been an issue. Some of that work is in this ticket 56996.

As there really seems to be no reason to use any gcc before gcc5 any more, especially on these newer OS versions, nobody had any enthusiasm for digging in on these test suite build failures, and I don't think anyone ever will.

Don't paste up your huge log -- we've seen it before.

I think you should try to get gcc49 out of your system. The issue seems to be your atlas installation, that was configured with a gcc49 variant at some point in the past. I have mine built against clang37, but by default it builds against gcc5. gcc5 builds OK on newer systems:

$ port -v installed atlas
The following ports are currently installed:
  atlas @3.10.2_2+mpclang37-gcc5 (active) platform='darwin 10' archs='x86_64' date='2016-09-29T06:14:45-0700'

So... you would do something like

sudo port uninstall gcc49
sudo port uninstall atlas

and when it tells you things will break, just say OK. Then once that is done, you should just be able to install the default atlas to get the gcc5 version:

$ port variants atlas
atlas has the variants:
   gcc49: build using macports-gcc-4.9
     * conflicts with gcc5 mpclang37 perf
[+]gcc5: build using macports-gcc-5
     * conflicts with gcc49 mpclang37 perf
   mpclang37: use mp-clang-3.7 and gfortran
     * conflicts with gcc49 gcc5 perf
   nofortran: Forgo use of fortran compiler
   universal: Build for multiple architectures
sudo port -v install atlas

please let me know if that doesn't work out for you.

comment:18 Changed 4 days ago by lancon

Thank you. I will look into this as soon as I can (travelling for work the coming week).

Note: See TracTickets for help on using tickets.