You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I build with this command go build -trimpath -buildmode=c-shared -ldflags '-w -s -extldflags "-lresolv"' -o keyring.so main.go it builds without error, but it does not generate a C header file and so I cannot use it.
However if I switch to a main file that does not have these external dependencies like this simple file, the exact same build command generates both the .so file and a header.
package main
import "C"
import (
"sort"
"sync"
)
var count int
var mtx sync.Mutex
//export Add
func Add(a, b int) int {
return a + b
}
//export Sort
func Sort(vals []int) {
sort.Ints(vals)
}
func main() {}
What did you expect to see?
I expected item 4 to generate a C header too
What did you see instead?
Only a .so file was generated
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)? 1.20.1Does this issue reproduce with the latest release? Yes
What operating system and processor architecture are you using (
go env
)?GO111MODULE=""
GOARCH="amd64" // note also tried on arm64
GOBIN=""
GOCACHE="/Users/davidchoi/Library/Caches/go-build"
GOENV="/Users/davidchoi/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/davidchoi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/davidchoi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3l/kkjsj0695q9_n194jp473bjh0000gn/T/go-build2986864533=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/mtibben/percent v0.2.1 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
go build -trimpath -buildmode=c-shared -ldflags '-w -s -extldflags "-lresolv"' -o keyring.so main.go
it builds without error, but it does not generate a C header file and so I cannot use it.What did you expect to see?
I expected item 4 to generate a C header too
What did you see instead?
Only a .so file was generated
The text was updated successfully, but these errors were encountered: