编译C++库出现多条相同警告信息,能够编译出so,但加载次so时直接crash
System is unknown to camke, create:
Platform/OHOS to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
crash信息:
Device info:HUAWEI Mate 40 Pro
Build info:NOH-AN00 4.1.0.59\(DEVC00E59R1P1log\)
Fingerprint:8f080fae5c0d96f843f4d3b95bdad3655a54daa1dbb9381ddb4fb8aa5b694cc6
Module name:com.tencent.wemeet.app
Version:1.0.0
VersionCode:1000000
PreInstalled:No
Foreground:Yes
Timestamp:2024-01-27 11:18:41.433
Pid:26205
Uid:20010179
Process name:com.tencent.wemeet.app
Reason:Signal:SIGABRT\(SI\_TKILL\)@0x013154c30000665d from:26205:20010179
LastFatalMessage:\[gc\] AllocateBuffer:567 size must have a size bigger than 0
Fault thread Info:
Tid:26205, Name:cent.wemeet.app
\#00 pc 000000000017faa4 /system/lib/ld-musl-aarch64.so.1\(raise+124\)\(a10e24722cdee9e5e5e0ae20fd619ccb\)
\#01 pc 0000000000137394 /system/lib/ld-musl-aarch64.so.1\(abort+20\)\(a10e24722cdee9e5e5e0ae20fd619ccb\)
\#02 pc 00000000002c86e4 /system/lib64/platformsdk/libark\_jsruntime.so\(panda::ecmascript::JSPandaFileManager::JSPandaFileAllocator::AllocateBuffer\(unsigned long\)+1132\)\(8c4826a562e41c5de97fa66e489e6d27\)
\#03 pc 00000000002bde5c /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#04 pc 00000000002bd560 /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#05 pc 00000000002c7128 /system/lib64/platformsdk/libark\_jsruntime.so\(panda::ecmascript::JSPandaFileManager::NewJSPandaFile\(panda::panda\_file::File const\*, std::\_\_h::basic\_string<char, std::\_\_h::char\_traits<char\>, panda::ecmascript::CAddressAllocator<char\>\> const&\)+76\)\(8c4826a562e41c5de97fa66e489e6d27\)
\#06 pc 00000000002c4680 /system/lib64/platformsdk/libark\_jsruntime.so\(panda::ecmascript::JSPandaFileManager::GenerateJSPandaFile\(panda::ecmascript::JSThread\*, panda::panda\_file::File const\*, std::\_\_h::basic\_string<char, std::\_\_h::char\_traits<char\>, panda::ecmascript::CAddressAllocator<char\>\> const&, std::\_\_h::basic\_string\_view<char, std::\_\_h::char\_traits<char\>\>\)+88\)\(8c4826a562e41c5de97fa66e489e6d27\)
\#07 pc 00000000002c3628 /system/lib64/platformsdk/libark\_jsruntime.so\(panda::ecmascript::JSPandaFileManager::LoadJSPandaFile\(panda::ecmascript::JSThread\*, std::\_\_h::basic\_string<char, std::\_\_h::char\_traits<char\>, panda::ecmascript::CAddressAllocator<char\>\> const&, std::\_\_h::basic\_string\_view<char, std::\_\_h::char\_traits<char\>\>, bool\)+484\)\(8c4826a562e41c5de97fa66e489e6d27\)
\#08 pc 00000000003a07c0 /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#09 pc 00000000003a05a8 /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#10 pc 00000000003a6064 /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#11 pc 00000000003a99fc /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#12 pc 00000000003a9804 /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#13 pc 00000000003a949c /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#14 pc 00000000002e26ec /system/lib64/platformsdk/libark\_jsruntime.so\(8c4826a562e41c5de97fa66e489e6d27\)
\#15 pc 00000000003dd7a0 /system/lib64/platformsdk/libark\_jsruntime.so\(panda::JSNApi::Execute\(panda::ecmascript::EcmaVM\*, std::\_\_h::basic\_string<char, std::\_\_h::char\_traits<char\>, std::\_\_h::allocator<char\>\> const&, std::\_\_h::basic\_string<char, std::\_\_h::char\_traits<char\>, std::\_\_h::allocator<char\>\> const&, bool\)+932\)\(8c4826a562e41c5de97fa66e489e6d27\)
\#16 pc 00000000022794b8 /system/lib64/platformsdk/libace\_compatible.z.so\(7fb6238c773a1743be6ecc4f4caca515\)
\#17 pc 00000000021a4cf0 /system/lib64/platformsdk/libace\_compatible.z.so\(7fb6238c773a1743be6ecc4f4caca515\)
\#18 pc 00000000021a53d8 /system/lib64/platformsdk/libace\_compatible.z.so\(7fb6238c773a1743be6ecc4f4caca515\)
\#19 pc 0000000000683928 /system/lib64/platformsdk/libace\_compatible.z.so\(7fb6238c773a1743be6ecc4f4caca515\)
\#20 pc 00000000006b443c /system/lib64/platformsdk/libace\_compatible.z.so\(7fb6238c773a1743be6ecc4f4caca515\)
可以参考这篇文档解决:https://gitee.com/openharmony-sig/tpc\_c\_cplusplus/blob/master/lycium/doc/ohos\_use\_sdk/OHOS\_SDK-Usage.md