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

cmd/go: no link cache for plugin on darwin #59845

Closed
578559967 opened this issue Apr 26, 2023 · 3 comments
Closed

cmd/go: no link cache for plugin on darwin #59845

578559967 opened this issue Apr 26, 2023 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Milestone

Comments

@578559967
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20.3 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/r/Library/Caches/go-build"
GOENV="/Users/r/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOMODCACHE="/Users/r/go/pkg/mod"
GOOS="darwin"
GOPATH="/Users/r/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/r/sdk/go1.20.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/r/sdk/go1.20.3/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j_/rq9ph2cd3h50w468sgv34lwh0000gn/T/go-build536055591=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.20.3 darwin/arm64
GOROOT/bin/go tool compile -V: compile version go1.20.3
uname -v: Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000
ProductName:		macOS
ProductVersion:		13.2.1
BuildVersion:		22D68
lldb --version: lldb-1403.0.17.64
Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)

What did you do?

plugin.go:

package main

import "fmt"

func Greet() {
	fmt.Println("in-plugin")
}
# first time
$ go build -buildmode=plugin -o plugin.so plugin.go
# build again
$ go build -buildmode=plugin -x -o plugin.so plugin.go

What did you expect to see?

The second build should use the cache and don't compile or link.

What did you see instead?

The second build links again.
This is the output:

WORK=/var/folders/j_/rq9ph2cd3h50w468sgv34lwh0000gn/T/go-build3709016315
mkdir -p $WORK/b001/
cat >/var/folders/j_/rq9ph2cd3h50w468sgv34lwh0000gn/T/go-build3709016315/b001/importcfg.link << 'EOF' # internal
packagefile command-line-arguments=/Users/r/Library/Caches/go-build/f8/f819b1e3d1b8926d344dd6a801ca968c278b5f684dd708e676cdc4ed8389f104-d
packagefile fmt=/Users/r/Library/Caches/go-build/da/daec736883ac78f3456fffdcfe266ddb97fec41d0c710287cc1550f7c3ffd564-d
packagefile runtime=/Users/r/Library/Caches/go-build/e4/e4a9ce3b55b65efacb4ab629c85624cbb1c5ea80223619692597ba295398ce93-d
packagefile runtime/cgo=/Users/r/Library/Caches/go-build/0c/0c003003f24255f810379c630d0b3a6f9e5d9ae252143836db44fe54bb61b4c6-d
packagefile errors=/Users/r/Library/Caches/go-build/a6/a62778dbd335cd1349e95948237d419139204af30c0b22f15277a54edb731ab1-d
packagefile internal/fmtsort=/Users/r/Library/Caches/go-build/fe/feb37dcff3cc0f195d65f2de92c3e7b9ca53037a8cba6efe99953c7fba70055d-d
packagefile io=/Users/r/Library/Caches/go-build/49/491852fa54a131f0ff95dca6d89925eca168dfd407d56d310aa523b5e49a8e75-d
packagefile math=/Users/r/Library/Caches/go-build/c8/c8ea2e55f0032ab43147b4de9502de54a878c6c8d3e66c8d6e14c2a8a833d5a4-d
packagefile os=/Users/r/Library/Caches/go-build/37/370edb38c35948a5573288abf0181571a6c69c1e66611ff116f38c179aa6dfa2-d
packagefile reflect=/Users/r/Library/Caches/go-build/41/4114cb83c0293dbd823b1119ed67335e4d3a0dfbe2aa52c829dded9493fcc887-d
packagefile sort=/Users/r/Library/Caches/go-build/28/28a1e13c6ff3a2ca895d14f97bc711fe9bf7cf9909fd1b0a0796459772b5c8a8-d
packagefile strconv=/Users/r/Library/Caches/go-build/18/18074393edb02bac73ab0f74a0508a6e8c511e5c7abb74da475e841af673f2d1-d
packagefile sync=/Users/r/Library/Caches/go-build/ed/ed51ab7243e61d2bb49e4a6157129ae9297a456a6ae36ed6bd369f443149c875-d
packagefile unicode/utf8=/Users/r/Library/Caches/go-build/a3/a382f6549e0c2c1f494e7b04e4d4de2ba026fda143c020560140e6dd6a4f1210-d
packagefile internal/abi=/Users/r/Library/Caches/go-build/75/75ab107879dbdb0f5dfb744817af53999d855e3f6698537c79156042b9cb0c55-d
packagefile internal/bytealg=/Users/r/Library/Caches/go-build/09/09843d96b792a17e29760e24449e6f9d549205c2401269862fc1df533c1179e4-d
packagefile internal/coverage/rtcov=/Users/r/Library/Caches/go-build/eb/eb831baf1ad2eaadb962fff40f7cfe43efdd61d90b63f293e3d67c406f835383-d
packagefile internal/cpu=/Users/r/Library/Caches/go-build/13/13cdc7b5b37ab6feef002b329490a244b04a22928f08445a07c3d0217630ad72-d
packagefile internal/goarch=/Users/r/Library/Caches/go-build/3c/3c6ab2565078eaf772e96945d2a91e7fc02af16adc2756ca7eba1d66fe743a2f-d
packagefile internal/goexperiment=/Users/r/Library/Caches/go-build/f7/f7d8c78b1acd06a69d498d7ed3849c7e7d0d87ca9bb8b619cf8fe210233abaa7-d
packagefile internal/goos=/Users/r/Library/Caches/go-build/85/8514c9c624816db832df0831e14fbdb071e59870ec715de82c10cc81b728147a-d
packagefile runtime/internal/atomic=/Users/r/Library/Caches/go-build/9a/9a640772545b6959a01e5a7d63932ee527edebf3bb9fb6390f9cec2669b2e2c5-d
packagefile runtime/internal/math=/Users/r/Library/Caches/go-build/0f/0f2ae98553bfe0db8b5a345bd73ebaaf51154ee316abec34b6a8641c2acdb359-d
packagefile runtime/internal/sys=/Users/r/Library/Caches/go-build/14/1419cd5f4c10a4733e7444a091d619633ad39f6dad77a674ed661469f79bbd43-d
packagefile sync/atomic=/Users/r/Library/Caches/go-build/ee/eef2eb26f11962a92f0e4acab0d65818408973b8388782882b54a9ce2c6a7034-d
packagefile internal/reflectlite=/Users/r/Library/Caches/go-build/85/855b9bcffe3be5970e1d8b2d14a3a9383441fcd43084001ad99017a915cc7e80-d
packagefile math/bits=/Users/r/Library/Caches/go-build/73/7367e0ee281c7406b4b5f4e783a89f61807b73900c4c0836f42c09f88d676f2e-d
packagefile internal/itoa=/Users/r/Library/Caches/go-build/55/5566ed32c50fd2c8a1d53b5065fe537380aa32e87f7712fa919ffa4ea754829b-d
packagefile internal/poll=/Users/r/Library/Caches/go-build/10/10aa349ab9a026cbb3ed4df9b09d814158c4ab369d8d07073d9fcd5633cb147e-d
packagefile internal/safefilepath=/Users/r/Library/Caches/go-build/87/8787f3c8ee11683d1d8d9e2b1bf73591e68fe7070b769d52a340b08c36d433ad-d
packagefile internal/syscall/execenv=/Users/r/Library/Caches/go-build/04/0499f70d691ce9d495321f454b9ddafabf90bebf047ab95239c719662ed0997d-d
packagefile internal/syscall/unix=/Users/r/Library/Caches/go-build/ea/eadc1dd5b721bdd9991b6390a46186a15e1bdd1454578bce276185d57c850b49-d
packagefile internal/testlog=/Users/r/Library/Caches/go-build/42/42fcb8d2f42d15ce4726bb36e4e47b4c723940ada1436a3b59788f64ae5dbf55-d
packagefile io/fs=/Users/r/Library/Caches/go-build/96/967fa8f8cc4bb13455bf4c43fd7d79105abdc9149d30cfe547292c4740156c1b-d
packagefile syscall=/Users/r/Library/Caches/go-build/2b/2b691de501e1dfca9850eff57dbf9728cca5e4b306f9ea772a3fa881e9082d1f-d
packagefile time=/Users/r/Library/Caches/go-build/ec/ec05cdc59fe3a54a413a0c1a8b1993460cc05cd1ce2a33d86ee574a5db47733a-d
packagefile internal/unsafeheader=/Users/r/Library/Caches/go-build/2e/2eae91eb00abf6a3af0cc2bc1667889cdbe6bf86a32ff4923bcfd34912cee72a-d
packagefile unicode=/Users/r/Library/Caches/go-build/2e/2ed5ae925b6f1b6ce18ccae40adde731fef537a47738398ddc480f381a613ce5-d
packagefile internal/race=/Users/r/Library/Caches/go-build/68/681abd1a90d4e439d8d55bafdde1c7908df280e008b60998979ae14cb0d1dcc7-d
packagefile internal/oserror=/Users/r/Library/Caches/go-build/d9/d9d76ab20280780e2b76d23ed4f10f376123c49d35b5330272a5e537d050a53e-d
packagefile path=/Users/r/Library/Caches/go-build/89/8918248f968cda44f63f02c3600170f953a51d1d50467177e0a778296efb39df-d
modinfo "0w\xaf\f\x92t\b\x02A\xe1\xc1\a\xe6\xd6\x18\xe6path\tcommand-line-arguments\nbuild\t-buildmode=plugin\nbuild\t-compiler=gc\nbuild\tCGO_ENABLED=1\nbuild\tCGO_CFLAGS=\nbuild\tCGO_CPPFLAGS=\nbuild\tCGO_CXXFLAGS=\nbuild\tCGO_LDFLAGS=\nbuild\tGOARCH=arm64\nbuild\tGOOS=darwin\n\xf92C1\x86\x18 r\x00\x82B\x10A\x16\xd8\xf2"
EOF
mkdir -p $WORK/b001/exe/
cd .
/Users/r/sdk/go1.20.3/pkg/tool/darwin_arm64/link -o $WORK/b001/exe/a.out.so -importcfg $WORK/b001/importcfg.link -installsuffix dynlink -pluginpath plugin/unnamed-4ea55e68d7b8d81fcff350342abfab57c9c7c231 -buildmode=plugin -buildid=o7FP7ozW71pcyXB_0xFm/IQJuRAaKxpT7EvXtrjD_/f9Dn4Xq8ms1l0Vbe-FlR/o7FP7ozW71pcyXB_0xFm -extld=clang /Users/r/Library/Caches/go-build/f8/f819b1e3d1b8926d344dd6a801ca968c278b5f684dd708e676cdc4ed8389f104-d
/Users/r/sdk/go1.20.3/pkg/tool/darwin_arm64/buildid -w $WORK/b001/exe/a.out.so # internal
mv $WORK/b001/exe/a.out.so plugin.so
rm -r $WORK/b001/
@578559967
Copy link
Author

This only happens on darwin. It's okay on linux.

@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Apr 26, 2023
@dmitshur dmitshur added this to the Backlog milestone Apr 26, 2023
@dmitshur
Copy link
Contributor

CC @bcmills, @matloob.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/489457 mentions this issue: cmd/link: write buildid to plugin

@golang golang locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
None yet
Development

No branches or pull requests

3 participants