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
#!/usr/bin/env bash
ZIG_LOCAL_CACHE_DIR="$HOME/tmp" zig cc -target x86_64-macos $@
zxx:
#!/usr/bin/env bash
ZIG_LOCAL_CACHE_DIR="$HOME/tmp" zig c++ -target x86_64-macos $@
$ CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 CC='zcc' CXX='zxx' go build -o test ./main.go
Expected Behavior
Cross-compiled binary for x86_64-macos
Actual Behavior
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running zcc failed: exit status 1
warning: unsupported linker arg: -headerpad
warning: unsupported linker arg: 1144
warning: unsupported linker arg: -no_pie
warning: unsupported linker arg: -pagezero_size
warning: unsupported linker arg: 4000000
warning: unsupported linker arg: --compress-debug-sections
warning: unsupported linker arg: zlib-gnu
warning(link): framework not found for '-framework CoreFoundation'
warning(link): framework not found for '-framework Security'
warning(link): Framework search paths:
error(link): undefined reference to symbol '_SecTrustSettingsCopyTrustSettings'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_SecTrustSettingsCopyCertificates'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_SecPolicyCopyProperties'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_SecItemExport'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFStringCreateWithBytes'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFRelease'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFNumberGetValue'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFEqual'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFDictionaryGetValueIfPresent'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFDataGetLength'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFDataGetBytePtr'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFArrayGetCount'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error(link): undefined reference to symbol '_CFArrayGetValueAtIndex'
error(link): first referenced in '/tmp/go-link-87708621/go.o'
error: UndefinedSymbolReference
It's not possible to workaround this by providing the relevant framework files, either, because the Go linker expects xcrun to be available:
The text was updated successfully, but these errors were encountered:
emidoots
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Mar 3, 2022
emidoots
changed the title
Cannot cross compile Go HTTP server from Linux -> macOS
Cannot cross compile Go HTTP server + CGO code from Linux -> macOS
Mar 3, 2022
Zig Version
0.10.0-dev.670+e1a535360
Steps to Reproduce
This issue only occurs in programs that import Go's networking packages AND CGO. When CGO is being used, Go's networking packages import the macOS CoreFoundation framework for x509 roots: https://github.com/golang/go/tree/master/src/crypto/x509/internal/macos
main.go
:zcc
:zxx
:Expected Behavior
Cross-compiled binary for x86_64-macos
Actual Behavior
It's not possible to workaround this by providing the relevant framework files, either, because the Go linker expects
xcrun
to be available:The text was updated successfully, but these errors were encountered: