Skip to content

ci: drop the restored Go build cache in the macOS CGO jobs - #1633

Open
zeroshade wants to merge 1 commit into
apache:mainfrom
zeroshade:fix-macos-cgo-stale-cache
Open

zeroshade wants to merge 1 commit into
apache:mainfrom
zeroshade:fix-macos-cgo-stale-cache

Conversation

@zeroshade

Copy link
Copy Markdown
Member

Rationale for this change

The "ARM64 macOS 15 Go 1.26 - CGO" job has been failing on unrelated pull requests with:

ld: warning: search path '/opt/homebrew/Cellar/apache-arrow/26.0.1/lib' not found
ld: library 'arrow' not found

Homebrew now installs apache-arrow as revision 26.0.1_1, so the library lives under Cellar/apache-arrow/26.0.1_1. The job restores a Go build cache that was created when the path was 26.0.1. Go does not rebuild a cgo package when the output of pkg-config changes, so the cached package keeps the old -L flag and the link fails. The cache key only depends on the Go version and go.sum, so it does not change when the formula does.

Runners on the older image still install 26.0.1, which is why the same job passes on some runs and fails on others.

What changes are included in this PR?

The macOS CGO jobs run go clean -cache after installing Arrow, so cgo packages are always built against the installed library. The module download cache is still restored.

Are these changes tested?

I reproduced the behaviour locally with a small cgo package and a pkg-config wrapper: after changing the -L path it returns and removing the old directory, go build fails with the same linker error, and succeeds after go clean -cache. The workflow change itself is exercised by this PR's CI.

Are there any user-facing changes?

No.

Go does not rebuild a cgo package when the output of pkg-config changes.
Homebrew's flags for apache-arrow contain a versioned Cellar path, so a
build cache restored from before a formula update links against a
directory that no longer exists and every cgo binary fails with
"ld: library 'arrow' not found".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant