We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go version go1.17rc2 darwin/amd64
Yes
go env
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/tcastelly/Library/Caches/go-build" GOENV="/Users/tcastelly/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/tcastelly/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/tcastelly/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/tcastelly/go/go1.17rc2" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/tcastelly/go/go1.17rc2/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17rc2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0n/_2h3pfsn6qz1f4tbs1xzkb3r0000gn/T/go-build689424415=/tmp/go-build -gno-record-gcc-switches -fno-common"
Hello,
I'm trying to call Golang from Rust using a build like this:
go build -buildmode=c-archive -o mylib.a main.go
// main.go import ( "C" "crypto/x509" "fmt" ) //export PrintCerts func PrintCerts() bool { start := time.Now() certs, err := x509.SystemCertPool() end := time.Now() if err != nil { panic(err) } fmt.Printf("found %d certs in %v\n", len(certs.Subjects()), end.Sub(start)) return true }
And when I call it I have this error:
Undefined symbols for architecture x86_64: "_SecTrustSettingsCopyTrustSettings", referenced from: _crypto/x509/internal/macos.x509_SecTrustSettingsCopyTrustSettings_trampoline in libgophernize.a(go.o) "_SecPolicyCopyProperties", referenced from: _crypto/x509/internal/macos.x509_SecPolicyCopyProperties_trampoline in libgophernize.a(go.o) "_SecItemExport", referenced from: _crypto/x509/internal/macos.x509_SecItemExport_trampoline in libgophernize.a(go.o) "_SecTrustSettingsCopyCertificates", referenced from: _crypto/x509/internal/macos.x509_SecTrustSettingsCopyCertificates_trampoline in libgophernize.a(go.o) "_CFNumberGetValue", referenced from: _crypto/x509/internal/macos.x509_CFNumberGetValue_trampoline in libgophernize.a(go.o) "_CFDictionaryGetValueIfPresent", referenced from: _crypto/x509/internal/macos.x509_CFDictionaryGetValueIfPresent_trampoline in libgophernize.a(go.o) "_CFDataGetLength", referenced from: _crypto/x509/internal/macos.x509_CFDataGetLength_trampoline in libgophernize.a(go.o) "_CFArrayGetValueAtIndex", referenced from: _crypto/x509/internal/macos.x509_CFArrayGetValueAtIndex_trampoline in libgophernize.a(go.o) "_CFDataGetBytePtr", referenced from: _crypto/x509/internal/macos.x509_CFDataGetBytePtr_trampoline in libgophernize.a(go.o) "_CFEqual", referenced from: _crypto/x509/internal/macos.x509_CFEqual_trampoline in libgophernize.a(go.o) "_CFStringCreateWithBytes", referenced from: _crypto/x509/internal/macos.x509_CFStringCreateWithBytes_trampoline in libgophernize.a(go.o) "_CFRelease", referenced from: _crypto/x509/internal/macos.x509_CFRelease_trampoline in libgophernize.a(go.o) "_CFArrayGetCount", referenced from: _crypto/x509/internal/macos.x509_CFArrayGetCount_trampoline in libgophernize.a(go.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
btw, It works on GNU LInux.
The text was updated successfully, but these errors were encountered:
Duplicate of #42459
Sorry, something went wrong.
Hi,
Is there any workaround? Thank you very much.
Edit: Fixed with
.cargo/config
[build] rustflags = ["-C", "link-args=-framework CoreFoundation -framework Security"]
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Hello,
I'm trying to call Golang from Rust using a build like this:
And when I call it I have this error:
btw, It works on GNU LInux.
The text was updated successfully, but these errors were encountered: