OpenHarmony开发者论坛

标题: OpenHarmony 安全基础能力子系统 设备互信认证 怎么才能正确配置依赖? [打印本页]

作者: weixin_46507345    时间: 2025-3-4 21:28
标题: OpenHarmony 安全基础能力子系统 设备互信认证 怎么才能正确配置依赖?
[md]### 【问题描述】

我想要自己编写设备互信认证的代码,但是

```
InitDeviceAuthService();
    const DeviceGroupManager *gmInstance = GetGmInstance();
    if (gmInstance == NULL) {
        printf("Failed to get DeviceGroupManager instance\n");
        return;
    }
```

编译:./build.sh --product-name khdvk_rk3568_a --ccache --build-target softbus_tool_new

出现以下报错:

FAILED: communication/dsoftbus/softbus_tool_new exe.unstripped/communication/dsoftbus/softbus_tool_new
[OHOS ERROR] /usr/bin/env "../../build/toolchain/gcc_link_wrapper.py" --output="communication/dsoftbus/softbus_tool_new" --strip="../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip" --unstripped-file="./exe.unstripped/communication/dsoftbus/softbus_tool_new"  --mini-debug -- ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -Wl,--pack-dyn-relocs=android+relr -Wl,--fatal-warnings -Wl,--build-id=md5 -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-undefined -Wl,--exclude-libs=libunwind_llvm.a -Wl,--exclude-libs=libc++_static.a -Wl,--exclude-libs=libvpx_assembly_arm.a --target=arm-linux-ohos -Werror -Wl,--warn-shared-textrel -Wl,-O2 -Wl,--gc-sections -Wl,--gdb-index --sysroot=obj/third_party/musl -nostdlib -Lobj/third_party/musl/usr/lib/arm-linux-ohos -L../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos -Wl,--warn-shared-textrel -Bdynamic -Wl,-z,nocopyreloc -pie -o "./exe.unstripped/communication/dsoftbus/softbus_tool_new" obj/third_party/musl/usr/lib/arm-linux-ohos/Scrt1.o obj/third_party/musl/usr/lib/arm-linux-ohos/crti.o -Wl,--start-group  @"communication/dsoftbus/softbus_tool_new.rsp"  -lunwind -lc++ ../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos/libclang_rt.builtins.a -lc -lc++abi -ldl -lm obj/foundation/communication/dsoftbus/adapter/libsoftbus_adapter.z.so obj/foundation/communication/dsoftbus/core/common/libsoftbus_utils.z.so obj/foundation/communication/dsoftbus/sdk/libsoftbus_client.z.so obj/foundation/communication/bluetooth/frameworks/inner/libbtframework.z.so -Wl,--end-group  obj/third_party/musl/usr/lib/arm-linux-ohos/crtn.o
[OHOS ERROR] ld.lld: error: undefined symbol: InitDeviceAuthService
[OHOS ERROR] >>> referenced by auth.c:9 (../../foundation/communication/dsoftbus/tools/softbus_tool_new/src/auth.c:9)
[OHOS ERROR] >>>               obj/foundation/communication/dsoftbus/tools/softbus_tool_new/src/softbus_tool_new/auth.oau_CreateGroup)
[OHOS ERROR]
[OHOS ERROR] ld.lld: error: undefined symbol: GetGmInstance
[OHOS ERROR] >>> referenced by auth.c:10 (../../foundation/communication/dsoftbus/tools/softbus_tool_new/src/auth.c:10)
[OHOS ERROR] >>>               obj/foundation/communication/dsoftbus/tools/softbus_tool_new/src/softbus_tool_new/auth.oau_CreateGroup)
[OHOS ERROR] clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
[/md]




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5