goplus / llgo

A Go compiler based on LLVM in order to better integrate Go with the C ecosystem including Python
Apache License 2.0
205 stars 15 forks source link

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

Open 2458zhanghehe opened 1 week ago

2458zhanghehe commented 1 week ago

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
spongehah commented 1 week ago

This hash version 54e3210d7e746721979e1726ca961d33003bce1d is working properly, but it does not work properly after updating to the latest version

go version
go1.21.4 darwin-amd64
gop version
gop v1.2.6 devel darwin-amd64