Skip to content

Commit

Permalink
Bug 20023: Upgrade Go to 1.7.3.
Browse files Browse the repository at this point in the history
Go 1.7 has a necessary fix for macOS Sierra that is not in Go 1.6.3 or
earlier:
golang/go@2da5633
meek was unstable on macOS Sierra when compiled with Go 1.4.3 or 1.6.3.
Reported by tordevSZ0: https://bugs.torproject.org/20250.

We need to use the Mac OS X 10.7 SDK (not 10.6) to build Go 1.7 and
later:
https://bugs.torproject.org/20023#comment:6

We add -std=gnu99 to CFLAGS when building Go. A piece of new C code uses
c99 features. Other code uses "asm", which requires gnu99.
https://bugs.torproject.org/20023#comment:6
https://trac.macports.org/ticket/52506

We hack one of the source files with sed to remove -D__MAC_OS_X_VERSION_MAX_ALLOWED=1060,
which otherwise causes the build to fail, thinking a couple of functions
are unavailable.
golang/go#17732
  • Loading branch information
David Fifield authored and gk-tpo committed Nov 7, 2016
1 parent 51f62d0 commit a101161
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
12 changes: 7 additions & 5 deletions gitian/descriptors/mac/gitian-pluggable-transports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ files:
- "go14.tar.gz"
- "go.tar.gz"
- "apple-uni-sdk-10.6_20110407-0.flosoft1_i386.deb"
- "MacOSX10.7.sdk.tar.gz"
- "multiarch-darwin11-cctools127.2-gcc42-5666.3-llvmgcc42-2336.1-Linux-120724.tar.xz"
- "dzip.sh"
- "gmp-mac64-utils.zip"
Expand All @@ -66,6 +67,8 @@ script: |
#
sudo dpkg -i *.deb
tar xaf multiarch-darwin*tar.xz
# The 10.7 SDK is needed for Go: https://bugs.torproject.org/20023#comment:6
tar xaf MacOSX10.7.sdk.tar.gz
export PATH="$PATH:$HOME/build/apple-osx/bin/"
unzip -d $INSTDIR gmp-mac64-utils.zip
unzip -d $INSTDIR openssl-mac64-utils.zip
Expand All @@ -78,10 +81,6 @@ script: |
export CXX=$HOME/build/apple-osx/bin/i686-apple-darwin11-g++
# http://bugs.python.org/issue9437
export LDSHARED="$CC -pthread -shared"
# XXX Clean up these flags?
export CFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I. -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1 -I$INSTDIR/gmp/include -L$INSTDIR/gmp/lib"
export CXXFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I. -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1 -I$INSTDIR/gmp/include -L$INSTDIR/gmp/lib"
export LDFLAGS="-L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5"
# Building go 1.4.x
# This is needed to bootstrap the go that we actually use
Expand All @@ -101,14 +100,17 @@ script: |
# https://github.com/golang/go/issues/15457
CC_FOR_TARGET="$(pwd)/cc-for-target"
echo "#!/bin/sh" > "$CC_FOR_TARGET"
echo "exec $CC $CFLAGS $LDFLAGS \"\$@\"" >> "$CC_FOR_TARGET"
echo "exec $CC $CFLAGS $LDFLAGS -isysroot $HOME/build/MacOSX10.7.sdk -std=gnu99 \"\$@\"" >> "$CC_FOR_TARGET"
chmod +x "$CC_FOR_TARGET"
# http://golang.org/doc/install/source#environment
export GOPATH="$HOME/go"
export GOOS=darwin
export GOARCH=386
tar xvf go.tar.gz
cd go/src
# Remove a preprocessor directive that causes problems when building with the 10.7 SDK.
# https://github.com/golang/go/issues/17732
sed -i -e '/^#cgo CFLAGS:/s/-D__MAC_OS_X_VERSION_MAX_ALLOWED=1060//' crypto/x509/root_cgo_darwin.go
CGO_ENABLED=1 CC_FOR_TARGET="$CC_FOR_TARGET" CC= CFLAGS= LDFLAGS= ./make.bash
cd ../..
export PATH="$PATH:$PWD/go/bin"
Expand Down
4 changes: 2 additions & 2 deletions gitian/versions
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SETUPTOOLS_VER=1.4
PARSLEY_VER=1.2
# We need a Go 1.4 to bootstrap later versions; see https://golang.org/doc/install/source#go14
GO14_VER=1.4.3
GO_VER=1.6.3
GO_VER=1.7.3
NSIS_VER=2.51

## File names for the source packages
Expand Down Expand Up @@ -112,7 +112,7 @@ PY2EXE_HASH=610a8800de3d973ed5ed4ac505ab42ad058add18a68609ac09e6cf3598ef056c
SETUPTOOLS_HASH=75d288687066ed124311d6ca5f40ffa92a0e81adcd7fff318c6e84082713cf39
PARSLEY_HASH=50d30cee70770fd44db7cea421cb2fb75af247c3a1cd54885c06b30a7c85dd23
GO14_HASH=9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
GO_HASH=6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00
GO_HASH=79430a0027a09b0b3ad57e214c4c1acfdd7af290961dd08d322818895af1ef44
NSIS_HASH=43d4c9209847e35eb6e2c7cd5a7586e1445374c056c2c7899e40a080e17a1be7
NSIS_DEBIAN_HASH=1dee6957b4a4b8dfe69bcf28bc7f301a13b96b3fa5a394e36c8926ae781e774a
GCC_HASH=b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad
Expand Down
4 changes: 2 additions & 2 deletions gitian/versions.alpha
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ SETUPTOOLS_VER=1.4
PARSLEY_VER=1.2
# We need a Go 1.4 to bootstrap later versions; see https://golang.org/doc/install/source#go14
GO14_VER=1.4.3
GO_VER=1.6.3
GO_VER=1.7.3
NSIS_VER=2.51
ELFUTILS_VER=0.160

Expand Down Expand Up @@ -121,7 +121,7 @@ PY2EXE_HASH=610a8800de3d973ed5ed4ac505ab42ad058add18a68609ac09e6cf3598ef056c
SETUPTOOLS_HASH=75d288687066ed124311d6ca5f40ffa92a0e81adcd7fff318c6e84082713cf39
PARSLEY_HASH=50d30cee70770fd44db7cea421cb2fb75af247c3a1cd54885c06b30a7c85dd23
GO14_HASH=9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
GO_HASH=6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00
GO_HASH=79430a0027a09b0b3ad57e214c4c1acfdd7af290961dd08d322818895af1ef44
NSIS_HASH=43d4c9209847e35eb6e2c7cd5a7586e1445374c056c2c7899e40a080e17a1be7
NSIS_DEBIAN_HASH=1dee6957b4a4b8dfe69bcf28bc7f301a13b96b3fa5a394e36c8926ae781e774a
GCC_HASH=608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a
Expand Down
4 changes: 2 additions & 2 deletions gitian/versions.beta
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SETUPTOOLS_VER=1.4
PARSLEY_VER=1.2
# We need a Go 1.4 to bootstrap later versions; see https://golang.org/doc/install/source#go14
GO14_VER=1.4.3
GO_VER=1.6.3
GO_VER=1.7.3

## File names for the source packages
OPENSSL_PACKAGE=openssl-${OPENSSL_VER}.tar.gz
Expand Down Expand Up @@ -102,7 +102,7 @@ PY2EXE_HASH=610a8800de3d973ed5ed4ac505ab42ad058add18a68609ac09e6cf3598ef056c
SETUPTOOLS_HASH=75d288687066ed124311d6ca5f40ffa92a0e81adcd7fff318c6e84082713cf39
PARSLEY_HASH=50d30cee70770fd44db7cea421cb2fb75af247c3a1cd54885c06b30a7c85dd23
GO14_HASH=9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
GO_HASH=6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00
GO_HASH=79430a0027a09b0b3ad57e214c4c1acfdd7af290961dd08d322818895af1ef44
STIXMATHFONT_HASH=e3b0f712e2644438eee2d0dcd2b10b2d54f1b972039de95b2f8e800bae1adbd8
NOTOEMOJIFONT_HASH=415dc6290378574135b64c808dc640c1df7531973290c4970c51fdeb849cb0c5
NOTOJPFONT_HASH=3e8146c4ce0945f255cb9dbc12b392380af80bd117e0a60eae555c99c7e618da
Expand Down
4 changes: 2 additions & 2 deletions gitian/versions.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SETUPTOOLS_VER=1.4
PARSLEY_VER=1.2
# We need a Go 1.4 to bootstrap later versions; see https://golang.org/doc/install/source#go14
GO14_VER=1.4.3
GO_VER=1.6.3
GO_VER=1.7.3
NSIS_VER=2.51
ELFUTILS_VER=0.160

Expand Down Expand Up @@ -124,7 +124,7 @@ PY2EXE_HASH=610a8800de3d973ed5ed4ac505ab42ad058add18a68609ac09e6cf3598ef056c
SETUPTOOLS_HASH=75d288687066ed124311d6ca5f40ffa92a0e81adcd7fff318c6e84082713cf39
PARSLEY_HASH=50d30cee70770fd44db7cea421cb2fb75af247c3a1cd54885c06b30a7c85dd23
GO14_HASH=9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
GO_HASH=6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00
GO_HASH=79430a0027a09b0b3ad57e214c4c1acfdd7af290961dd08d322818895af1ef44
NSIS_HASH=43d4c9209847e35eb6e2c7cd5a7586e1445374c056c2c7899e40a080e17a1be7
NSIS_DEBIAN_HASH=1dee6957b4a4b8dfe69bcf28bc7f301a13b96b3fa5a394e36c8926ae781e774a
GCC_HASH=608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a
Expand Down

0 comments on commit a101161

Please sign in to comment.