xgo-dev / xgo-dev/llgo

llgo running _demo/math/math.go get error : Undefined symbols for architecture x86_64

Open
#367 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
LLVM
Stars
758
Forks
49
Avg merge
1d 6h
Merged PRs (30d)
138

Description

when using llgo run . running _demo/math/math.go get error:

Undefined symbols for architecture x86_64:
  "_internal/cpu.X86", referenced from:
      _math.init$hasPatch in 661363be1bd784975e2a005f92f4b60cfdb12b43c29d86a19616165bebe38d40-d-0649bb.o
  "_internal/cpu.init", referenced from:
      _math.init$hasPatch in 661363be1bd784975e2a005f92f4b60cfdb12b43c29d86a19616165bebe38d40-d-0649bb.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

go version : 1.21.4.
macOS : 13.6.7

It was correct when using go1.22.4, but the go+ plugin got connect error in go1.22.4

go env :

GO111MODULE=''
GOARCH='amd64'
GOBIN='/Users/zhangyifan/go/bin'
GOCACHE='/Users/zhangyifan/Library/Caches/go-build'
GOENV='/Users/zhangyifan/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/zhangyifan/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/zhangyifan/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/zhangyifan/Documents/llgo/go.mod'
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 -ffile-prefix-map=/var/folders/nc/j_4dvjq50w37k5l3tmsm8jn80000gn/T/go-build2288917245=/tmp/go-build -gno-record-gcc-switches -fno-common'

Environment variables

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export LLGOROOT="/Users/zhangyifan/Documents/llgo"
export LLGO_LIB_PYTHON="/opt/anaconda3/lib/python3.11"
export DYLD_LIBRARY_PATH="/opt/anaconda3/lib:$DYLD_LIBRARY_PATH"
export GOROOT=/usr/local/go
export PATH=$PATH:$HOME/go/bin
export PATH=$PATH:$GOROOT/bin
#export GOPATH=$HOME/go
#export GOBIN=$HOME/go/bin

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing llgo run . with _demo/math/math.go under Go 1.21.4 on macOS, then compare the behavior with Go 1.22.4 and inspect the reported missing _internal/cpu.X86 and _internal/cpu.init symbols. Done means the demo links successfully without the undefined-symbol error while preserving the relevant go+ plugin behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.