Opened 12 months ago

Last modified 12 months ago

#68725 new defect

go @1.7.13 - Fails to Build on Mtn Lion

Reported by: RobK88 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: mountainlion Cc: ci42, herbygillot (Herby Gillot), RobK88
Port: go

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I previously reported that legacy version of go, version @1.17.13, is completely broken on Lion and Mtn Lion.

See #68700

So I thought maybe I could fix the problem by building go @1.17.13 from source. It failed with a dyld: Symbol not found: _clock_gettime: error. See below.

bash-3.2$ sudo port uninstall go
--->  Deactivating go @1.17.13_0
--->  Cleaning go
--->  Uninstalling go @1.17.13_0
--->  Cleaning go

bash-3.2$ sudo port -vs install go
--->  Computing dependencies for go.
--->  Fetching distfiles for go
--->  go1.17.13.src.tar.gz does not exist in /opt/local/var/macports/distfiles/go
--->  Attempting to fetch go1.17.13.src.tar.gz from https://storage.googleapis.com/golang/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.1M  100 21.1M    0     0  2691k      0  0:00:08  0:00:08 --:--:-- 2766k
--->  go1.17.13.darwin-amd64.tar.gz does not exist in /opt/local/var/macports/distfiles/go
--->  Attempting to fetch go1.17.13.darwin-amd64.tar.gz from https://storage.googleapis.com/golang/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  130M  100  130M    0     0  2208k      0  0:01:00  0:01:00 --:--:-- 3195k
--->  Verifying checksums for go
--->  Checksumming go1.17.13.src.tar.gz
--->  Checksumming go1.17.13.darwin-amd64.tar.gz
--->  Extracting go
--->  Extracting go1.17.13.src.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/go/go1.17.13.src.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go_prebuilt
--->  Applying patches to go
--->  Applying patch-cgo-drop-no-nullability-completeness.diff
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/lang/go/files/patch-cgo-drop-no-nullability-completeness.diff'
patching file src/runtime/cgo/cgo.go
--->  Configuring go
--->  Building go
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go/src" && ./make.bash -v=3 
dyld: Symbol not found: _clock_gettime
  Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go_prebuilt/go/bin/go
  Expected in: flat namespace

Building Go cmd/dist using /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go_prebuilt/go. ()
dyld: Symbol not found: _clock_gettime
  Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go_prebuilt/go/bin/go
  Expected in: flat namespace

./make.bash: line 184: 39300 Trace/BPT trap: 5       GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/work/go/src" && ./make.bash -v=3 
Exit code: 133
Error: Failed to build go: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port go failed

Attachments (1)

main.log (15.1 KB) - added by RobK88 12 months ago.

Download all attachments as: .zip

Change History (10)

Changed 12 months ago by RobK88

Attachment: main.log added

comment:1 Changed 12 months ago by RobK88

Description: modified (diff)

comment:2 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:3 Changed 12 months ago by RobK88

Previously, the go port was able to build on Lion and Mtn Lion. (eg Back in Feb 2023) I suspect the problem is with changes to the legacysupport PortGroup...

comment:4 Changed 12 months ago by RobK88

In particular, I think the building of the go port broke starting with legacy-support @1.0.8 back in March, 2023. Changes relating to the clock_gettime symbol were made in legacy-support @1.0.8.

comment:5 Changed 12 months ago by RobK88

Well I tried building go@1.17.13 with legacy-support @1.0.7 and it did not fix the problem.

But I did discover that the go port uses the prebuilt binary for go version 1.17.13 from the developer's website -- go1.17.13.darwin-amd64.tar.gz

This prebuilt binary does not run properly on Lion and Mtn Lion:

$ ./go
dyld: Symbol not found: _clock_gettime
  Referenced from: /Users/grinch/Downloads/go/bin/./go
  Expected in: flat namespace

Trace/BPT trap: 5

It looks like the legacy-support port will need to be updated to handle the _clock_gettime symbol

comment:6 Changed 12 months ago by RobK88

I found the bug in the go port!!

The legacy_build flag in the Portfile for go was not set properly. As a result, the go port was trying to build go@1.17.13 using the prebuilt binary for go version 1.17.13 from the developer's website -- https://go.dev/dl/go1.17.13.darwin-amd64.tar.gz. The will fail since the prebuilt binary was never built with the legacy-support libraries!

When the legacy_build flag in the Portfile for gois set properly for legacy MacOS's, the go port will build go@1.17.13 using the go-1.4 port.

I am building now. I will set a PR later today.

Version 2, edited 12 months ago by RobK88 (previous) (next) (diff)

comment:7 Changed 12 months ago by RobK88

Well fixing the small bug did help. I made progress. But the port build still failed.

In particular, it failed at this stage -- Building Go toolchain2 using go_bootstrap and Go toolchain1 with a SIGSEGV: segmentation violation error.

Last edited 12 months ago by RobK88 (previous) (diff)

comment:8 Changed 12 months ago by RobK88

Here is a workaround for getting go@1.17.13 to run on Lion, Mountain Lion etc.

  1. Install the legacy-support port (if not already installed)
  2. Download the prebuilt binary for go@1.17.13 from https://go.dev/dl/go1.17.13.darwin-amd64.tar.gz and dynamically insert the legacy-support library.
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.7.5
BuildVersion:	11G63

$ DYLD_INSERT_LIBRARIES="/opt/local/lib/libMacportsLegacySupport.dylib:/opt/local/lib/libMacportsLegacySystem.B.dylib" /Users/rob/Downloads/go/bin/go version
go version go1.17.13 darwin/amd64

I will modify the Portfile for go accordingly and will submit a PR sometime this weekend.

Last edited 12 months ago by RobK88 (previous) (diff)

comment:9 Changed 12 months ago by RobK88

Well my fix did not work.. Even with dynamic library injection, I cannot get the prebuilt binary for go@1.17.13 to compile anything without crashing with a SIGSEGV: segmentation violation error.

I have tried all my tricks. I have no more ideas for a fix.

Note: See TracTickets for help on using tickets.