go icon indicating copy to clipboard operation
go copied to clipboard

affected/package:

Open suchao-lv opened this issue 2 years ago • 0 comments

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/loong64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="loong64"
GOBIN=""
GOCACHE="/home/uos/.cache/go-build"
GOENV="/home/uos/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="loong64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/uos/go/pkg/mod"
GONOPROXY="*.uniontech.com"
GONOSUMDB="*.uniontech.com"
GOOS="linux"
GOPATH="/home/uos/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/share/ubxgo/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/share/ubxgo/go/pkg/tool/linux_loong64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -mabi=lp64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1139878000=/tmp/go-build -gno-record-gcc-switches"

What did you do?

我使用了如下编译命令: go build -x -buildmode=c-shared -o hello.so hello.go 报错如下: -buildmode=c-shared not supported on linux/loong64 于是我修改1.18源码中部分相关文件,让其支持loong64 最终报错停留在了如下: /usr/share/ubxgo/go/pkg/tool/linux_loong64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -installsuffix shared -buildmode=c-shared -buildid=VjSGCzgmjjJmng4hvW1p/WO5bAXmxALTE53mSBcMM/lLTTU0AieOjUvcGiNFbI/VjSGCzgmjjJmng4hvW1p -extld=gcc /home/uos/.cache/go-build/8a/8a684f2f6e11d470d52b1497952c1f44669b428ec4b5cbe654f378ab7a078f2b-d #command-line-arguments /usr/share/ubxgo/go/pkg/tool/linux_loong64/link: running gcc failed: exit status 1 collect2: fatal error: ld terminated with signal 11 [段错误] compilation terminated.

使用的demo代码如下: package main import "C" //export hello func hello(value string) *C.char { return C.CString("hello"+value) }

func main() {

}

What did you expect to see?

loongarch上是不支持将go编译成so吗?

What did you see instead?

suchao-lv avatar Jun 09 '22 06:06 suchao-lv