Opened 2 years ago

Closed 2 years ago

#28691 closed defect (fixed)

Xcode 11 breaks gfortran build

Reported by: vbraun Owned by:
Priority: blocker Milestone: sage-9.0
Component: build Keywords:
Cc: Merged in:
Authors: Volker Braun Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: 5098dd1 (Commits, GitHub, GitLab) Commit: 5098dd1dbf8f5aa50dc287c75f64c1b115b5f9be
Dependencies: Stopgaps:

Status badges

Description

The bootstrap of any version of gcc or gfortran fails on Xcode 11 with

 libtool: compile:  /Users/vbraun/Sage/local/var/tmp/sage/build/gfortran-9.2.0/gcc-build/./gcc/xgcc -B/Users/vbraun/Sage/local/var/tmp/sage/build/gfortran-9.2.0/gcc-build/./gcc/ -B/Users/vbraun/Sage/local/x86_64-apple-darwin19.0.0/bin/ -B/Users/vbraun/Sage/local/x86_64-apple-darwin19.0.0/lib/ -isystem /Users/vbraun/Sage/local/x86_64-apple-darwin19.0.0/include -isystem /Users/vbraun/Sage/local/x86_64-apple-darwin19.0.0/sys-include -DHAVE_CONFIG_H -I. -I../../../src/libssp -Wall -g -O2 -MT gets-chk.lo -MD -MP -MF .deps/gets-chk.Tpo -c ../../../src/libssp/gets-chk.c  -fno-common -DPIC -o .libs/gets-chk.o
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/wait.h:110,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:66,
                 from ../../../src/libssp/gets-chk.c:39:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h: In function 'getiopolicy_np':
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:34: error: expected declaration specifiers before '__OSX_AVAILABLE_STARTING'
  443 | int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:449:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__OSX_AVAILABLE_STARTING'
  449 | int     setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~

and a few others. More details at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90835

Change History (17)

comment:1 Changed 2 years ago by jhpalmieri

What do the homebrew people do to get gcc and gfortran to build?

comment:3 Changed 2 years ago by vbraun

  • Branch set to u/vbraun/xcode_11_breaks_gfortran_build

comment:4 Changed 2 years ago by vbraun

  • Authors set to Volker Braun
  • Commit set to 5098dd1dbf8f5aa50dc287c75f64c1b115b5f9be
  • Status changed from new to needs_review

New commits:

5098dd1Update to gcc 9.2.0

comment:5 Changed 2 years ago by jhpalmieri

make gcc fails for me:

In file included from ./bconfig.h:3,
                 from ../../src/gcc/sort.cc:33:
./auto-host.h:2379:16: error: declaration does not declare anything [-fpermissive]
 2379 | #define rlim_t long
      |                ^~~~
In file included from ./bconfig.h:3,
                 from ../../src/gcc/genchecksum.c:20:
./auto-host.h:2379:16: error: declaration does not declare anything [-fpermissive]
 2379 | #define rlim_t long
      |                ^~~~
In file included from ./bconfig.h:3,
                 from ../../src/gcc/genhooks.c:20:
./auto-host.h:2379:16: error: declaration does not declare anything [-fpermissive]
 2379 | #define rlim_t long
      |                ^~~~
In file included from ../../src/gcc/sort.cc:38:
../../src/gcc/system.h:540:20: error: conflicting declaration of C function 'const char* strsignal(int)'
  540 | extern const char *strsignal (int);
      |                    ^~~~~~~~~
In file included from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-9.0.beta3/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/prev-x86_64-apple-darwin19.0.0/libstdc++-v3/include/cstring:42,
                 from ../../src/gcc/system.h:235,
                 from ../../src/gcc/sort.cc:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:134:7: note: previous declaration 'char* strsignal(int)'
  134 | char *strsignal(int __sig);
      |       ^~~~~~~~~
In file included from ../../src/gcc/genhooks.c:21:
../../src/gcc/system.h:540:20: error: conflicting declaration of C function 'const char* strsignal(int)'
  540 | extern const char *strsignal (int);
      |                    ^~~~~~~~~
In file included from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-9.0.beta3/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/prev-x86_64-apple-darwin19.0.0/libstdc++-v3/include/cstring:42,
                 from ../../src/gcc/system.h:235,
                 from ../../src/gcc/genhooks.c:21:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:134:7: note: previous declaration 'char* strsignal(int)'
  134 | char *strsignal(int __sig);
      |       ^~~~~~~~~
In file included from ../../src/gcc/genchecksum.c:21:
../../src/gcc/system.h:540:20: error: conflicting declaration of C function 'const char* strsignal(int)'
  540 | extern const char *strsignal (int);
      |                    ^~~~~~~~~
In file included from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-9.0.beta3/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/prev-x86_64-apple-darwin19.0.0/libstdc++-v3/include/cstring:42,
                 from ../../src/gcc/system.h:235,
                 from ../../src/gcc/genchecksum.c:21:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:134:7: note: previous declaration 'char* strsignal(int)'
  134 | char *strsignal(int __sig);
      |       ^~~~~~~~~
make[5]: *** [build/genchecksum.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [build/sort.o] Error 1
make[5]: *** [build/genhooks.o] Error 1
In file included from ./bconfig.h:3,
                 from ../../src/gcc/genmodes.c:20:
./auto-host.h:2379:16: error: declaration does not declare anything [-fpermissive]
 2379 | #define rlim_t long
      |                ^~~~
In file included from ../../src/gcc/genmodes.c:21:
../../src/gcc/system.h:540:20: error: conflicting declaration of C function 'const char* strsignal(int)'
  540 | extern const char *strsignal (int);
      |                    ^~~~~~~~~
In file included from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-9.0.beta3/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/prev-x86_64-apple-darwin19.0.0/libstdc++-v3/include/cstring:42,
                 from ../../src/gcc/system.h:235,
                 from ../../src/gcc/genmodes.c:21:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:134:7: note: previous declaration 'char* strsignal(int)'
  134 | char *strsignal(int __sig);
      |       ^~~~~~~~~
make[5]: *** [build/genmodes.o] Error 1
/bin/sh ../../src/gcc/../move-if-change tmp-optionlist optionlist
echo timestamp > s-options
rm gfortran.pod gcc.pod
make[4]: *** [all-stage2-gcc] Error 2
make[3]: *** [stage2-bubble] Error 2
make[2]: *** [all] Error 2
********************************************************************************
Error building gcc-9.2.0
********************************************************************************

comment:6 Changed 2 years ago by vbraun

Which xcode and commandline tools version?

comment:7 Changed 2 years ago by jhpalmieri

Xcode 11.2, OS 10.15.1. For command-line tools, not sure how to get the version.

$ xcode-select -v
xcode-select version 2370.

comment:8 Changed 2 years ago by vbraun

Building gcc works for me with

vbraun@osx Sage % gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

comment:9 Changed 2 years ago by jhpalmieri

Failed on another machine, this one using OS X 10.14.6:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

comment:10 Changed 2 years ago by jhpalmieri

Succeeded on a third machine, this one using OS X 10.15.1:

$ gcc --version                                                              
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Version 0, edited 2 years ago by jhpalmieri (next)

comment:11 Changed 2 years ago by jhpalmieri

I updated Xcode and the build still succeeds. On one of the machines where building was failing, I deleted and reinstalled a bunch of homebrew stuff, and it made no difference. So now I have two machines failing, one succeeding. What can I do to help track this down?

comment:12 Changed 2 years ago by vbraun

IMHO its a giant pita that homebrew installs stuff in /usr/local, that is where you put stuff that is supposed to be picked up when you compile third-party stuff. Essentially turning each homebrew system into a distinct snowflake. I don't see how we can support that.

Does it build if you rename /usr/local?

Also, are we always talking about gcc? We don't build gcc by default on OSX anyways. The only really pressing issue is building gfortran, since Xcode doesn't come with a fortran compiler.

comment:13 Changed 2 years ago by jhpalmieri

Good point about gfortran. It builds on the two machines that I can access right now, although gcc fails on one of them. I don't really want to move /usr/local or do similar manipulations, because I don't want to break too many things.

comment:14 Changed 2 years ago by jhpalmieri

For what it's worth:

  • machine 1, imac pro: old gfortran (= without this branch) builds, new gfortran builds, new gcc fails. Running OS X 10.14.6, newest Xcode
  • machine 2, macbook air: old gfortran fails, new gfortran builds, new gcc builds. Running OS X 10.15.1, newest Xcode

comment:15 Changed 2 years ago by jhpalmieri

  • machine 3, imac: old gfortran fails, new gfortran builds, new gcc fails. Running OS X 10.15.1, newest Xcode

Since the gfortran from this branch builds on all of these machines, let's merge this. I don't know if it's worth putting a warning message in the gcc package if used on OS X, but that can go on another ticket.

comment:16 Changed 2 years ago by jhpalmieri

  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

comment:17 Changed 2 years ago by vbraun

  • Branch changed from u/vbraun/xcode_11_breaks_gfortran_build to 5098dd1dbf8f5aa50dc287c75f64c1b115b5f9be
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.