golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.97k stars 17.66k forks source link

c-archive only supported on FreeBSD for amd64 #65538

Closed UnitedMarsupials closed 9 months ago

UnitedMarsupials commented 9 months ago

Go version

go version go1.21.5 freebsd/386

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='386'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='386'
GOHOSTOS='freebsd'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='freebsd'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/go121'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go121/pkg/tool/freebsd_386'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
GO386='sse2'
AR='ar'
CC='cc'
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 -m32 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1902526263=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Tried building the gowhatsapp plugin for Pidgin. The bulk of that code is written in Go and linked into a library using the c-archive mode.

What did you see happen?

go build -buildmode=c-archive -o /wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/purple-go-whatsapp.a bridge.go login.go handler.go send_message.go handle_message.go logger.go send_file.go mark_read.go presence.go profile.go send_file_checks.go message_cache.go conversations.go groups.go
FAILED: src/go/purple-go-whatsapp.a src/go/purple-go-whatsapp.h /wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/purple-go-whatsapp.a /wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/purple-go-whatsapp.h 
cd /wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/purple-gowhatsapp-1.13.0/src/go && /usr/local/bin/cmake -E env GOPATH=/wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/go CGO_LDFLAGS="/wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/libpurple-dummy.a" go build -buildmode=c-archive -o /wrkdirs/usr/ports/net-im/purple-gowhatsapp/work/.build/src/go/purple-go-whatsapp.a bridge.go login.go handler.go send_message.go handle_message.go logger.go send_file.go mark_read.go presence.go profile.go send_file_checks.go message_cache.go conversations.go groups.go
# command-line-arguments
invalid value "c-archive" for flag -buildmode: buildmode c-archive not supported on freebsd/386

What did you expect to see?

Successful linking. Apparently, when it comes to FreeBSD, the c-archive (and c-shared) modes are only supported for the amd64 hardware. Other platforms -- like i386 or arm (see earlier request #44084), mips, etcætera -- fail...

A quick search shows, support for Darwin is wider (see #12683, for example), than for FreeBSD, which gives hope, it can be expanded to cover FreeBSD with relative ease: because Darwin itself is a FreeBSD derivative...

seankhliao commented 9 months ago

Duplicate of #44084