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

Make gcc14 the primary version on Tiger+ #26655

Merged
merged 5 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions _resources/port1.0/compilers/gcc_compilers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
# https://trac.macports.org/ticket/57135
# https://trac.macports.org/ticket/61636

# GCC 10 and above on OSX10.6+
# GCC 14 on all systems
lappend compilers macports-gcc-14

# GCC 11 to GCC 13 on OSX10.6+
if {${os.major} >= 10 || [option os.platform] ne "darwin"} {
lappend compilers macports-gcc-14 macports-gcc-13 macports-gcc-12 macports-gcc-11 macports-gcc-10
lappend compilers macports-gcc-13 macports-gcc-12 macports-gcc-11
}

# GCC 9 and older only on OSX10.10 and older
# GCC 10 on all systems
lappend compilers macports-gcc-10

# GCC 8 and 9 and older on OSX 10.6 to 10.10
# GCC 7 or older on OSX 10.6 or older
# https://trac.macports.org/ticket/65472
if {${os.major} < 15} {
if {${os.major} >= 10} {
Expand Down
6 changes: 1 addition & 5 deletions _resources/port1.0/compilers/gcc_dependencies.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

# GCC version providing the primary runtime
# Note settings here *must* match those in the lang/libgcc port and compilers PG
if {[option os.platform] eq "darwin" && [option os.major] < 10} {
set gcc_main_version 7
} else {
set gcc_main_version 14
}
set gcc_main_version 14

# compiler links against libraries in libgcc\d* and/or libgcc-devel
if {[vercmp ${gcc_version} 4.6] < 0} {
Expand Down
15 changes: 5 additions & 10 deletions _resources/port1.0/group/R-1.0.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,19 @@ if { ${os.major} > 23 } {
# Similarly, for gcc select the gcc13 variant of the compilers PG.
# This setting should also be kept in sync with that in the R Port.
# Updates should be coordinated with the R maintainers.
if { ${os.major} > 23 } {
if { ${os.major} < 10 || ${os.major} > 23 } {
# https://trac.macports.org/ticket/70799
compiler.blacklist-append {macports-gcc-1[5-9]}
} else {
compiler.blacklist-append {macports-gcc-1[4-9]}
}
# NOTE: upon the update to gcc14, please update the blacklist accordingly,
# like it is done for clangs. We would prefer using the same version of gcc and gfortran.
if {${os.platform} eq "darwin" && ${os.major} < 10} {
# Until old platforms are switched to the new libgcc.
default_variants-append +gcc7
if { ${os.major} < 10 || ${os.major} > 23 } {
# https://trac.macports.org/ticket/70799
default_variants-append +gcc14
} else {
if { ${os.major} > 23 } {
# https://trac.macports.org/ticket/70799
default_variants-append +gcc14
} else {
default_variants-append +gcc13
}
default_variants-append +gcc13
}

# R bakes in the compiler, so if it is built with ccache,
Expand Down
17 changes: 5 additions & 12 deletions _resources/port1.0/group/compilers-1.0.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ options compilers.add_gcc_rpath_support
default compilers.add_gcc_rpath_support yes

# Set a default gcc version
if {${os.major} < 10 && ${os.platform} eq "darwin" } {
# see https://trac.macports.org/ticket/57135
set compilers.gcc_default gcc7
} else {
set compilers.gcc_default gcc14
}
set compilers.gcc_default gcc14

set compilers.list {cc cxx cpp objc fc f77 f90}

Expand All @@ -107,16 +102,14 @@ if { ${os.arch} eq "arm" || ${os.platform} ne "darwin" } {
if { [vercmp ${xcodeversion} < 16.0] && [vercmp ${xcodecltversion} < 16.0] } {
lappend gcc_versions 10 11 12 13
}
lappend gcc_versions 14 devel
}
lappend gcc_versions 14 devel
}

# GCC version providing the primary runtime
# Note settings here *must* match those in the lang/libgcc port.
if { ${os.major} < 10 && ${os.platform} eq "darwin" } {
set gcc_main_version 7
} else {
set gcc_main_version 14
}
set gcc_main_version 14

ui_debug "GCC versions for Darwin ${os.major} ${os.arch} - ${gcc_versions}"
foreach ver ${gcc_versions} {
# Remove dot from version if present
Expand Down
6 changes: 1 addition & 5 deletions lang/gcc-devel/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,7 @@ proc dylib_list {location} {
if {${subport} eq ${libgccname}} {

# Set conflict against port providing primary runtime
if { ${os.major} < 10 } {
conflicts libgcc libgcc7
} else {
conflicts libgcc libgcc12
}
conflicts libgcc libgcc14

# http://trac.macports.org/ticket/35770
# http://trac.macports.org/ticket/38814
Expand Down
2 changes: 1 addition & 1 deletion lang/gcc10/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name gcc10
version 10.4.0
revision 5

platforms {darwin >= 10 < 22}
platforms {darwin < 22}
categories lang
maintainers nomaintainer
# an exception in the license allows dependents to not be GPL
Expand Down
38 changes: 35 additions & 3 deletions lang/gcc14/Portfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-14

port lint libgcc14: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-14

port lint gcc14: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-13

port lint libgcc14: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-13

port lint gcc14: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-15

port lint libgcc14: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/gcc14/Portfile

View workflow job for this annotation

GitHub Actions / macos-15

port lint gcc14: Warning: Unnecessary platforms line as darwin is the default

PortSystem 1.0
PortGroup select 1.0
Expand All @@ -12,7 +12,6 @@

homepage https://gcc.gnu.org/

platforms {darwin >= 10}
categories lang
maintainers nomaintainer
# an exception in the license allows dependents to not be GPL
Expand Down Expand Up @@ -69,6 +68,17 @@
depends_run-append port:gcc_select \
path:share/doc/libgcc/README:libgcc

platform darwin {
glebm marked this conversation as resolved.
Show resolved Hide resolved
if {(${configure.build_arch} in [list ppc ppc64]) || ${os.major} < 10} {
configure.compiler.add_deps \
no
depends_build-append \
port:gcc10-bootstrap
configure.cc ${prefix}/libexec/gcc10-bootstrap/bin/gcc
configure.cxx ${prefix}/libexec/gcc10-bootstrap/bin/g++
}
}

depends_skip_archcheck-append gcc_select ld64 cctools
license_noconflict gmp mpfr ppl libmpc zlib

Expand All @@ -89,9 +99,14 @@
}

set gcc_configure_langs {c c++ objc obj-c++ lto fortran}
if {${subport} eq ${name} && ${build_arch} ne "i386"} {
if {${subport} eq ${name} && ${build_arch} ne "i386" && ${os.major} > 8} {
# jit compiler is not building on i386 systems
# https://trac.macports.org/ticket/61130

# On ppc Tiger, the build fails when linking libgccjit.0.dylib:
# Undefined symbols:
# "__Unwind_GetIPInfo", referenced from:
# _unwind in libbacktrace.a(backtrace.o)
lappend gcc_configure_langs jit
}

Expand Down Expand Up @@ -198,6 +213,14 @@
# This patch has been merged upstream in https://github.com/gcc-mirror/gcc/commit/1cfe4a4d0d4447b364815d5e5c889deb2e533669
# Remove it when upgrading gcc to a version that has it.
patchfiles-append darwin-ppc-fpu.patch

if { ${os.major} == 8 } {
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117834
patchfiles-append darwin8-define-PTHREAD_RWLOCK_INITIALIZER.patch

# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117857
patchfiles-append darwin8-ttyname_r.patch
}
}

# Since GCC 7.4.0, during configure, it detects features supported by target-as.
Expand Down Expand Up @@ -337,7 +360,7 @@
}

# libcxx is unavailable on PPC
if {${build_arch} ni [list ppc ppc64]} {
if {${build_arch} ni [list ppc ppc64] && ${os.major} > 8} {
default_variants-append +stdlib_flag
}

Expand Down Expand Up @@ -394,6 +417,15 @@
# Activate hack for new libgcc
# https://trac.macports.org/wiki/PortfileRecipes#deactivatehack
pre-activate {
if {![catch {set installed [lindex [registry_active libgcc7] 0]}]} {
# Extract the version and revision of the installed libgcc7
set _version [lindex $installed 1]
set _revision [lindex $installed 2]
if {[vercmp $_version < 7.5.0]
|| ($_version eq "7.5.0" && [vercmp $_revision < 2])} {
registry_deactivate_composite libgcc7 "" [list ports_nodepcheck 1]
}
}
if {![catch {set installed [lindex [registry_active libgcc8] 0]}]} {
# Extract the epoch of the installed libgcc8
set _epoch [lindex $installed 5]
Expand Down
33 changes: 33 additions & 0 deletions lang/gcc14/files/darwin8-define-PTHREAD_RWLOCK_INITIALIZER.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From c86f77d40e74cbbd6bc2bb4b2d8aaa30bac04f23 Mon Sep 17 00:00:00 2001
From: Gleb Mazovetskiy <[email protected]>
Date: Thu, 28 Nov 2024 16:00:06 +0000
Subject: [PATCH] define PTHREAD_RWLOCK_INITIALIZER

Per https://github.com/macports/macports-ports/pull/26655#issuecomment-2506351012

Remove this patch once
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117834 is resolved
---
libgcc/gthr-posix.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git libgcc/gthr-posix.h libgcc/gthr-posix.h
index 82e8f9ffcf6..f87283cb0e4 100644
--- libgcc/gthr-posix.h
+++ libgcc/gthr-posix.h
@@ -62,6 +62,12 @@ typedef struct timespec __gthread_time_t;
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#ifndef __cplusplus
+#ifndef PTHREAD_RWLOCK_INITIALIZER
+#ifndef _PTHREAD_RWLOCK_SIG_init
+#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4
+#endif
+#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}
+#endif
#define __GTHREAD_RWLOCK_INIT PTHREAD_RWLOCK_INITIALIZER
#endif
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
--
2.43.0

62 changes: 62 additions & 0 deletions lang/gcc14/files/darwin8-ttyname_r.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
From 7abb2866863471eb6252ebec67ac2de56abda0db Mon Sep 17 00:00:00 2001
From: Gleb Mazovetskiy <[email protected]>
Date: Sat, 30 Nov 2024 08:57:43 +0000
Subject: [PATCH] darwin8 ttyname_r patch

---
libgfortran/io/unix.c | 7 +++++++
.../sanitizer_common_interceptors.inc | 12 ++++++++++++
2 files changed, 19 insertions(+)

diff --git libgfortran/io/unix.c libgfortran/io/unix.c
index 16600c855f2..80d2fad7ef8 100644
--- libgfortran/io/unix.c
+++ libgfortran/io/unix.c
@@ -2094,7 +2094,14 @@ stream_ttyname (stream *s __attribute__ ((unused)),
size_t buflen __attribute__ ((unused)))
{
#ifdef HAVE_TTYNAME_R
+#if __DARWIN_UNIX03
return ttyname_r (((unix_stream *)s)->fd, buf, buflen);
+#else
+ char *p = ttyname_r (((unix_stream *)s)->fd, buf, buflen);
+ if (!p)
+ return errno;
+ return 0;
+#endif
#elif defined HAVE_TTYNAME
char *p;
size_t plen;
diff --git libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
index 607ecae6808..2d2fceedf79 100644
--- libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -5036,6 +5036,7 @@ INTERCEPTOR(char *, ttyname, int fd) {
#endif

#if SANITIZER_INTERCEPT_TTYNAME_R
+#if __DARWIN_UNIX03
INTERCEPTOR(int, ttyname_r, int fd, char *name, SIZE_T namesize) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, ttyname_r, fd, name, namesize);
@@ -5044,6 +5045,17 @@ INTERCEPTOR(int, ttyname_r, int fd, char *name, SIZE_T namesize) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, name, internal_strlen(name) + 1);
return res;
}
+#else
+INTERCEPTOR(char*, ttyname_r, int fd, char *name, SIZE_T namesize) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, ttyname_r, fd, name, namesize);
+ char *res = REAL(ttyname_r)(fd, name, namesize);
+ if (res != nullptr)
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, name, internal_strlen(name) + 1);
+ return res;
+}
+#endif
+
#define INIT_TTYNAME_R COMMON_INTERCEPT_FUNCTION(ttyname_r);
#else
#define INIT_TTYNAME_R
--
2.43.0

Loading
Loading