bytedance/sonic

Error: relocation target github.com/bytedance/sonic/internal/rt.StartProf not defined

xhd2015 opened this issue · 4 comments

Is amd64 the only supported arch?

This issue is raised when trying xgo with sonic, see xhd2015/xgo#194.

Reprodue:

git clone --depth=1 https://github.com/bytedance/sonic
cd sonic
mkdir -p ./internal/rt_main
cat > ./internal/rt_main/main.go <<'EOF'
package main

import "github.com/bytedance/sonic/internal/rt"

func main() {
	rt.StartProf()
}
EOF

GOARCH=arm64 go build -o /dev/null ./internal/rt_main

Error:

# github.com/bytedance/sonic/internal/ir_main
main.main: relocation target github.com/bytedance/sonic/internal/rt.StartProf not defined

Originally posted by @xhd2015 in xhd2015/xgo#194 (comment)

This is a internal function, why you use it ?!

I'm curious also, what's this function for?

If as build tag, the Unmarshal/Decode/... caller should not touch this function rt.StartProf() in arm64. It will call encoding/json now.

https://github.com/bytedance/sonic/blob/main/decoder/decoder_compat.go#L1

If as build tag, the Unmarshal/Decode/... caller should not touch this function rt.StartProf() in arm64. It will call encoding/json now.

https://github.com/bytedance/sonic/blob/main/decoder/decoder_compat.go#L1

Thanks, will let the user provide more details.