OpenHarmony开发者论坛

标题: 编译OpenHarmony-v4.1-Beta1版本失败,报symbol未定义错误,怎么解决? [打印本页]

作者: xinxz1732    时间: 2024-3-23 13:23
标题: 编译OpenHarmony-v4.1-Beta1版本失败,报symbol未定义错误,怎么解决?
【问题描述】
问题现象和发生的背景
代码拉取:repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v4.1-Beta1 --no-repo-verify

编译命令:./build.sh --product-name rk3568 --ccache --target-cpu arm64

多个log打印的类型不匹配的问题改了,但是又报了如下错误。

相关的代码,截图,日志信息:
[OHOS ERROR] [13452/23372] SOLINK account/os_account/libaccountmgr.z.so
[OHOS ERROR] FAILED: account/os_account/libaccountmgr.z.so lib.unstripped/account/os_account/libaccountmgr.z.so
[OHOS ERROR] /usr/bin/env "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-readobj" --nm="../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-nm" --strip=../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip   --sofile="./lib.unstripped/account/os_account/libaccountmgr.z.so"  --output="account/os_account/libaccountmgr.z.so" --mini-debug -- ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -shared -Wl,--version-script=../../base/account/os_account/services/accountmgr/libaccountmgr.map -Wl,--pack-dyn-relocs=android+relr -Wl,--fatal-warnings -Wl,--build-id=md5 -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,-z,max-page-size=4096 -Wl,--icf=all -Wl,--color-diagnostics -flto=thin -Wl,--thinlto-jobs=8 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy,cache_size=10\%:cache_size_bytes=10g:cache_size_files=100000 -Wl,--lto-O0 -Wl,--no-undefined -Wl,--exclude-libs=libunwind_llvm.a -Wl,--exclude-libs=libc++_static.a -Wl,--exclude-libs=libvpx_assembly_arm.a --target=aarch64-linux-ohos -Wl,--hash-style=gnu -march=armv8-a -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -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/aarch64-linux-ohos -L../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos -Wl,--warn-shared-textrel -fsanitize-trap=all -ftrap-function=abort -flto -fsanitize=cfi -fsanitize-cfi-cross-dso -Wl,--version-script=/root/openharmony/build/config/sanitizers/cfi.versionscript -o "./lib.unstripped/account/os_account/libaccountmgr.z.so" @"account/os_account/libaccountmgr.z.so.rsp" -Wl,-soname="libaccountmgr.z.so"
[OHOS ERROR] ld.lld: error: undefined symbol: OHOS::AccountSA::OsAccountInfo::OsAccountInfo(int, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, OHOS::AccountSA::OsAccountType, long)
[OHOS ERROR] >>> referenced by inner_os_account_manager.cpp:98 (/root/openharmony/out/rk3568/../../base/account/os_account/services/accountmgr/src/osaccount/inner_os_account_manager.cpp:98)
[OHOS ERROR] >>>               lto.tmpOHOS::AccountSA::IInnerOsAccountManager::CreateBaseStandardAccount())
[OHOS ERROR] clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/root/openharmony/build/hb/containers/status.py", line 47, in wrapper
[OHOS ERROR]     return func(*args, **kwargs)
[OHOS ERROR]   File "/root/openharmony/build/hb/modules/ohos_build_module.py", line 67, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/root/openharmony/build/hb/modules/ohos_build_module.py", line 65, in run
[OHOS ERROR]     super().run()
[OHOS ERROR]   File "/root/openharmony/build/hb/modules/interface/build_module_interface.py", line 72, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/root/openharmony/build/hb/modules/interface/build_module_interface.py", line 70, in run
[OHOS ERROR]     self._target_compilation()
[OHOS ERROR]   File "/root/openharmony/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation
[OHOS ERROR]     self.target_compiler.run()
[OHOS ERROR]   File "/root/openharmony/build/hb/services/ninja.py", line 38, in run
[OHOS ERROR]     self._execute_ninja_cmd()
[OHOS ERROR]   File "/root/openharmony/build/hb/services/ninja.py", line 69, in _execute_ninja_cmd
[OHOS ERROR]     SystemUtil.exec_command(
[OHOS ERROR]   File "/root/openharmony/build/hb/util/system_util.py", line 64, in exec_command
[OHOS ERROR]     LogUtil.get_failed_log(log_path)
[OHOS ERROR]   File "/root/openharmony/build/hb/util/log_util.py", line 193, in get_failed_log
[OHOS ERROR]     LogUtil.get_compiler_failed_log(log_path)
[OHOS ERROR]   File "/root/openharmony/build/hb/util/log_util.py", line 180, in get_compiler_failed_log
[OHOS ERROR]     raise OHOSException(
[OHOS ERROR] exceptions.ohos_exception.OHOSException: COMPILE Failed! Please check error in /root/openharmony/out/rk3568/error.log, and for more build information in /root/openharmony/out/rk3568/build.log




我尝试过的解决方法和结果:
试着加了头文件引用,还是一样的报错




作者: s_hao    时间: 2024-3-28 14:17
可以试试32位的编译,64位的编译没有人去看护,会有不少编译问题
作者: 深开鸿_胡瑞涛    时间: 2024-3-28 17:59
试试编译默认的32位的镜像吧
作者: xinxz1732    时间: 2024-3-29 19:06
回复 s_hao: 谢谢,主要是目前需要用到64验证环境,64为编译问题确实比较多
作者: xinxz1732    时间: 2024-3-29 19:08
回复 深开鸿_胡瑞涛: 32位的编译没问题,64为的4.0编译也能通过,4.1的问题很多。
作者: 小~Q    时间: 2024-4-1 09:10
在4.1Release已经修复了,
作者: s_hao    时间: 2024-4-1 10:08
回复 xinxz1732: https://gitee.com/openharmony/account_os_account/pulls/1719
可以看下这个,这周也会正式进行合入
作者: zhikai    时间: 2024-9-5 14:38
回复 小~Q: 但是我用镜像网站下载的源码编译64位还是有问题啊




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