Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc 12 to 14 updates with libsanitizer and Distribution=13.0, 14.0, 15.0 variants #1080

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dhomeier
Copy link
Contributor

Counterpart of #1033 for gcc versions 12.3 and 13.2, with patches from the gcc arm64 team copied from Homebrew.
Adding the same experimental build of AddressSanitizer and ThreadSanitizer tools as for gcc11 – however libasan in particular is untested with gcc13.

Tested on 13.4 and 12.7 arm64 and x86_64/Rosetta, and on 10.14.6 x86_64; still needs testing on latest 13.x arm64 with Xcode 15.

@dhomeier dhomeier added new package Packages that do not yet exist in Fink. arm64 Build issues and fixes for Apple Silicon labels Oct 11, 2023
dhomeier referenced this pull request Oct 11, 2023
Version: 12.3.0
Revision: 1
Type: gccver (12)
Distribution: 13.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also add 14.0 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fink's naming scheme only allows for a single Distribution in a %v-Dist.info named file afaict, so this needs additional info files (added in next commit) – but a less prolific solution would be much preferred!

Source: mirror:gnu:gcc/gcc-%v/gcc-%v.tar.xz
Source-Checksum: SHA256(949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b)
PatchFile: %n.patch
PatchFile-MD5: 7d533489637df18650d997f3139c5772
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect MD5 for patch - should be e245cee9fa6aa2fd5298d7712358e8e1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PatchFile-MD5's still don't seem to match in gcc12-13.0.info, and between gcc13.info, gcc13-13.0.info, and gcc13-14.0.info

@PovlAbrahamsen
Copy link
Contributor

I have now tried the following combinations:

  • GCC 12 on MacOS 13.6 on x86_64 with Xcode 15.
  • GCC 12 on MacOS 14.0 on arm64 with Xcode 15.

Both compile and appear to work as intended (at least to the point where fftw3 and cfitsio build).

There is still a mistake in the PatchFile-MD5 field in gcc12-13.0.info, and mismatches in this field between the different gcc13 variants (I'm not sure which is correct - I haven't got around to building GCC13 yet, and probably won't for a few days).

Thank you for submitting this PR!

@dhomeier
Copy link
Contributor Author

git add does not like me – the old patch versions were accidentally enabling libsanitizer on darwin22 as well (should only include *-darwin2[01]*)...
Thanks for testing!

@dhomeier dhomeier mentioned this pull request Oct 15, 2023
71 tasks
@cooljeanius
Copy link

I tried testing this PR on Big Sur with Xcode 13, but got these results:

$ fink -m install gcc12
Scanning package description files..........
Information about 15259 packages read in 3 seconds.
Running in Maintainer Mode
Validating package file /opt/sw/fink/dists/stable/main/finkinfo/languages/gcc12.info...
Warning: Field "infodocs" is deprecated. (gcc12.info)
Package looks good!
The package 'gcc12' will be built and installed.
Reading build dependency for gcc12-12.3.0-1...
Can't resolve dependency "xcode (>= 14.2.0)" for package "gcc12-12.3.0-1" (no matching packages/versions found)
Exiting with failure.
$ fink -m install gcc13
Information about 15259 packages read in 3 seconds.
Running in Maintainer Mode
Validating package file /opt/sw/fink/dists/stable/main/finkinfo/languages/gcc13.info...
Warning: Field "infodocs" is deprecated. (gcc13.info)
Package looks good!
The package 'gcc13' will be built and installed.
Reading build dependency for gcc13-13.2.0-1...
Can't resolve dependency "xcode (>= 14.2.0)" for package "gcc13-13.2.0-1" (no matching packages/versions found)
Exiting with failure.

@cooljeanius
Copy link

ok now that @dhomeier has done 26b61ad, I can confirm that gcc12 builds and installs successfully for me with this PR on x86_64 Big Sur with Xcode 13; will test gcc13 next...

@cooljeanius
Copy link

ok now that @dhomeier has done 26b61ad, I can confirm that gcc12 builds and installs successfully for me with this PR on x86_64 Big Sur with Xcode 13; will test gcc13 next...

...ok, I can confirm a similar success with gcc13.

@dmacks
Copy link
Member

dmacks commented Oct 18, 2023

Does this PR make PR #928 obsolete?

@dhomeier
Copy link
Contributor Author

Yes, I think everything relevant especially for the first gcc11 and gcc12 ports has already been cherry-picked, and the rest must be outdated by now.

@dhomeier
Copy link
Contributor Author

dhomeier commented Dec 18, 2023

On Sonoma with Xcode 15.1 the gcc12 build fails with various, generally random internal compiler errors after Stage 3; status with Xcode 15 on Ventura is unclear – might be best to pull the Distribution 12.0/13.0 versions.
gcc13 reported to build without problems on all platforms tested so far.

Update: on High Sierra gcc 13.2 fails to build on a missing header in stage 3:

libtool: compile:  /opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/./gcc/xgcc -shared-libgcc -/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/./gcc -nostdinc++ -L/opt/sw/src/fink.build/gcc13-13.2.0-/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/src -L/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/src/.libs -L/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/libsupc++/.libs -B/opt/sw/lib/gcc13/x86_64-apple-darwin17.7.0/bin/ -B/opt/sw/lib/gcc13/x86_64-apple-darwin17.7.0/lib/ -isystem /opt/sw/lib/gcc13/x86_64-apple-darwin17.7.0/include -isystem /opt/sw/lib/gcc13/x86_64-apple-darwin17.7.0/sys-include -fchecking=1 -I/opt/sw/src/fink.build/gcc13-13.2.0-1/gcc-13.2.0/libstdc++-v3/../libgcc -l/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/include/x86_64-apple-darwin17.7.0 -I/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/include -I/opt/sw/src/fink.build/gcc13-13.2.0-1/gcc-13.2.0/libstdc++-v3/libsupc++ -I/opt/sw/include -I/opt/sw/include -D_GLIBCXX_SHARED -std=gnu++17 -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=dir.lo -g -O2 -c ../../../../../gcc-13.2.0/libstdc++-v3/src/filesystem/dir.cc  -fno-common -DPIC -D_GLIBCXX_SHARED -o dir.o
In file included from ../../../../../gcc-13.2.0/libstdc++-v3/src/filesystem/dir.cc:34:
/opt/sw/src/fink.build/gcc13-13.2.0-1/darwin_objdir/x86_64-apple-darwin17.7.0/libstdc++-v3/include/experimental/filesystem:39:10: fatal error: experimental/bits/fs_fwd.h: No such file or directory
   39 | #include <experimental/bits/fs_fwd.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [dir.lo] Error 1
make[6]: *** Waiting for unfinished jobs....
In file included from ../../../../../gcc-13.2.0/libstdc++-v3/src/filesystem/ops.cc:65:
../../../../../gcc-13.2.0/libstdc++-v3/src/filesystem/ops-common.h: In function 'bool std::experimental::filesystem::do_copy_file(const std::filesystem::__gnu_p
osix::char_type*, const std::filesystem::__gnu_posix::char_type*, std::filesystem::copy_options_existing_file, std::filesystem::__gnu_posix::stat_type*, std::fi
lesystem::__gnu_posix::stat_type*, std::error_code&)':
../../../../../gcc-13.2.0/libstdc++-v3/src/filesystem/ops-common.h:502:12: warning: unused variable 'count' [-Wunused-variable]
  502 |     size_t count = from_st->st_size;
      |            ^~~~~
make[5]: *** [all-recursive] Error 1

Package manager version: 0.45.99.git
Distribution version: selfupdate-point (bootstrap), 10.13, x86_64
Trees: local/main stable/main
Xcode.app: 10.1
Xcode command-line tools: 10.1.0.0.1.1539992718
Max. Fink build jobs:  2

So this might be a blocker for updating past gcc11 on older systems.

@sth0
Copy link
Contributor

sth0 commented Jan 4, 2024

I just compiled gcc11, and gcc12 with these package definitions on the following systems
MacOS / Xcode
13.6.3 / 15.1 (arm64 and x86)
12.7.1 / 14.2
10.14.7 / 11.3.1

@dhomeier
Copy link
Contributor Author

dhomeier commented Jan 5, 2024

Thanks for confirming the build on Ventura!
After several more attempts I have been able to build 12.3 on Sonoma with 2 threads for x86_64 (M1 with Rosetta) and with UseMaxBuildJobs: False for arm64, but some further tests (building openblas) still result in frequent internal compiler errors/segfaults, especially when combing CC=clang with FC=gfortran-fsf-12.
Maybe there will be a 12.4 release improving on this...

@sth0
Copy link
Contributor

sth0 commented Jan 6, 2024

I have issues with blas on arm64. It crashes when executing tests. Haven't examined if that is a blas or with gcc.

@dhomeier
Copy link
Contributor Author

dhomeier commented Jan 6, 2024

Anything related to #908 (comment)?
OpenBLAS is now at 0.3.26, but I haven't got to test that much on older systems.

@cooljeanius
Copy link

Anything related to #908 (comment)?

Do you mean related to it being merged, or related to the problem that it was meant to address?

@dhomeier
Copy link
Contributor Author

dhomeier commented Oct 9, 2024

I've updated gcc12 and gcc13 to their latest releases, but with Xcode 16 (now also on macOS 14.7) a new aarch64 assembly failure for lse.S popped up:

/opt/sw2/src/fink.build/gcc13-13.3.0-1/darwin_objdir/./gcc/xgcc -B/opt/sw2/src/fink.build/gcc13-13.3.0-1/darwin_objdir/./gcc/ -B/opt/sw2/lib/gcc13/aarch64-apple
-darwin24.1.0/bin/ -B/opt/sw2/lib/gcc13/aarch64-apple-darwin24.1.0/lib/ -isystem /opt/sw2/lib/gcc13/aarch64-apple-darwin24.1.0/include -isystem /opt/sw2/lib/gcc
13/aarch64-apple-darwin24.1.0/sys-include   -fno-checking -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict
-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=11 -mmacosx-version-min=11.0 -fno-common -g -DIN_LIBGCC2 -fbu
ilding-libgcc -fno-stack-protector   -mmacosx-version-min=11 -mmacosx-version-min=11.0 -fno-common -I. -I. -I../.././gcc -I../../../gcc-13.3.0/libgcc -I../../..
/gcc-13.3.0/libgcc/. -I../../../gcc-13.3.0/libgcc/../gcc -I../../../gcc-13.3.0/libgcc/../include -I../../../gcc-13.3.0/libgcc/config/libbid -DENABLE_DECIMAL_BID
_FORMAT -DHAVE_CC_TLS -DUSE_EMUTLS  -o cas_4_1.o -MT cas_4_1.o -MD -MP -MF cas_4_1.dep -DL_cas -DSIZE=4 -DMODEL=1 -c ../../../gcc-13.3.0/libgcc/config/aarch64/l
se.S
../../../gcc-13.3.0/libgcc/emutls.c:61:7: warning: conflicting types for built-in function '__emutls_get_address'; expected 'void *(void *)' [-Wbuiltin-declarat
ion-mismatch]
   61 | void *__emutls_get_address (struct __emutls_object *);
      |       ^~~~~~~~~~~~~~~~~~~~
../../../gcc-13.3.0/libgcc/emutls.c:63:6: warning: conflicting types for built-in function '__emutls_register_common'; expected 'void(void *, long unsigned int,
  long unsigned int,  void *)' [-Wbuiltin-declaration-mismatch]
   63 | void __emutls_register_common (struct __emutls_object *, word, word, void *);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
../../../gcc-13.3.0/libgcc/emutls.c:140:1: warning: conflicting types for built-in function '__emutls_get_address'; expected 'void *(void *)' [-Wbuiltin-declara
tion-mismatch]
  140 | __emutls_get_address (struct __emutls_object *obj)
      | ^~~~~~~~~~~~~~~~~~~~
../../../gcc-13.3.0/libgcc/emutls.c:204:1: warning: conflicting types for built-in function '__emutls_register_common'; expected 'void(void *, long unsigned int
,  long unsigned int,  void *)' [-Wbuiltin-declaration-mismatch]
  204 | __emutls_register_common (struct __emutls_object *obj,
      | ^~~~~~~~~~~~~~~~~~~~~~~~
<instantiation>:5:1: error: non-private labels cannot appear between .cfi_startproc / .cfi_endproc pairs
___aarch64_cas2_relax:
^
../../../gcc-13.3.0/libgcc/config/aarch64/lse.S:220:1: note: while in macro instantiation
STARTFN __aarch64_cas2_relax
^
<instantiation>:4:2: error: previous .cfi_startproc was here
 .cfi_startproc

which I only found fixed in gcc14. My assembly skills did not allow me to isolate the exact fix, so I backported the entire file and its associated aarch64-asm.h from 14.2 (after applying the arm64 patches from Homebrew).

Tested so far on Sonoma 14.7 with Xcode 16.0 and Monterey 12.7 with Xcode 14.2 (arm64) and on 10.13 - 10.14.7, Xcode 10.1 - 11.3 for x86_64

Tried to fix 12.4 with the same patch, which fixes the assembly error, but then fails on

libtool: compile:  /opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/./gcc/xgcc -shared-libgcc -B/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/./gcc -
nostdinc++ -L/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/src -L/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_ob
jdir/aarch64-apple-darwin23.6.0/libstdc++-v3/src/.libs -L/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/libsupc++/
.libs -B/opt/sw3/lib/gcc12/aarch64-apple-darwin23.6.0/bin/ -B/opt/sw3/lib/gcc12/aarch64-apple-darwin23.6.0/lib/ -isystem /opt/sw3/lib/gcc12/aarch64-apple-darwin
23.6.0/include -isystem /opt/sw3/lib/gcc12/aarch64-apple-darwin23.6.0/sys-include -fno-checking -I/opt/sw3/src/fink.build/gcc12-12.4.0-1/gcc-12.4.0/libstdc++-v3
/../libgcc -I/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/include/aarch64-apple-darwin23.6.0 -I/opt/sw3/src/fink
.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/include -I/opt/sw3/src/fink.build/gcc12-12.4.0-1/gcc-12.4.0/libstdc++-v3/libsupc++ -
I/opt/sw3/include -I/opt/sw3/include -std=gnu++98 -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show
-location=once -ffunction-sections -fdata-sections -frandom-seed=complex_io.lo -g -O2 -c ../../../../../gcc-12.4.0/libstdc++-v3/src/c++98/complex_io.cc  -fno-co
mmon -DPIC -D_GLIBCXX_SHARED -o complex_io.o
In file included from /opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/include/cmath:45,
                 from /opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/aarch64-apple-darwin23.6.0/libstdc++-v3/include/complex:44,
                 from ../../../../../gcc-12.4.0/libstdc++-v3/src/c++98/complex_io.cc:25:
/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/gcc/include-fixed/math.h:629:8: error: '_Float16' does not name a type
  629 | extern _Float16 __fabsf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
      |        ^~~~~~~~
/opt/sw3/src/fink.build/gcc12-12.4.0-1/darwin_objdir/gcc/include-fixed/math.h:630:8: error: '_Float16' does not name a type
  630 | extern _Float16 __hypotf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
[11 more down to 641 | extern _Float16 __fmaf16()]

so I am removing the 14.0 and 15.0 dists for now.

Adding the gcc14 packages as well, 14.2 however fails to build on HighSierra 10.13 with Xcode 10.1.0.0.1.1539992718 on

if [ x"" != x ]; then \
          gcc -c -DHAVE_CONFIG_H -g -O2  -I. -I../../../gcc-14.2.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=loca
l -pedantic  -D_GNU_SOURCE    ../../../gcc-14.2.0/libiberty/sha1.c -o noasan/sha1.o; \
        else true; fi
gcc -c -DHAVE_CONFIG_H -g -O2  -I. -I../../../gcc-14.2.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedanti
c  -D_GNU_SOURCE  ../../../gcc-14.2.0/libiberty/sha1.c -o sha1.o
warning: unknown warning option '-Wshadow=local' [-Wunknown-warning-option]
fatal error: error in backend: Cannot select: intrinsic %llvm.x86.sha1rnds4
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.

(did not submit a bug report to Apple since I don't expect they have any further work on Xcode 10 scheduled ;-)

Tested to build, and generally also to compile OpenBLAS, on macOS 10.14.7 - 15.1; I assume < 10.13 will fail as well, can't tell for sure for earlier versions of 10.14.

@dhomeier dhomeier changed the title gcc 12 and 13 updates with libsanitizer and Distribution=13.0 variants gcc 12 to 14 updates with libsanitizer and Distribution=13.0, 14.0, 15.0 variants Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm64 Build issues and fixes for Apple Silicon new package Packages that do not yet exist in Fink.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants