Tencent / MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
Other
17.39k stars 1.91k forks source link

Fix cgo cannot find functions reference when turn on "MMKV_DISABLE_CRYPT" #1213

Closed catundercar closed 10 months ago

catundercar commented 10 months ago

Turn on "MMKV_DISABLE_CRYPT" will not compile passed by Golang:

➜  test git:(dev) ✗ go build -v        
runtime/cgo
tencent.com/mmkv
mmkv_test
# mmkv_test
/usr/local/go/pkg/tool/linux_amd64/link: running /usr/bin/g++ failed: exit status 1
/usr/bin/ld: /tmp/go-link-2434606250/000002.o: in function `_cgo_370889eb6d07_Cfunc_cryptKey':
/tmp/go-build/cgo-gcc-prolog:228: undefined reference to `cryptKey'
/usr/bin/ld: /tmp/go-link-2434606250/000002.o: in function `_cgo_370889eb6d07_Cfunc_reKey':
/tmp/go-build/cgo-gcc-prolog:1004: undefined reference to `reKey'
/usr/bin/ld: /tmp/go-link-2434606250/000002.o: in function `_cgo_370889eb6d07_Cfunc_checkReSetCryptKey':
/tmp/go-build/cgo-gcc-prolog:146: undefined reference to `checkReSetCryptKey'
collect2: error: ld returned 1 exit status