bytedance / sonic

A blazingly fast JSON serializing & deserializing library
Apache License 2.0
6.54k stars 322 forks source link

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

Closed xhd2015 closed 1 month ago

xhd2015 commented 1 month ago

Is amd64 the only supported arch?

This issue is raised when trying xgo with sonic, see https://github.com/xhd2015/xgo/issues/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 https://github.com/xhd2015/xgo/issues/194#issuecomment-2149142800

AsterDY commented 1 month ago

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

xhd2015 commented 1 month ago

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

liuq19 commented 1 month ago

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

xhd2015 commented 1 month ago

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.