请选择 进入手机版 | 继续访问电脑版

积分1 / 贡献0

提问1答案被采纳0文章0

作者动态

    Openharmony-4.1-Beta1分支编译arm64位,类型错误异常 精华

    18234078229 显示全部楼层 发表于 2024-2-11 09:19:10

    分支:Openharmony-4.1-Beta1

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

    报错信息 error: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Werror,-Wformat]

    b141a124_11560026.png

    您尚未登录,无法参与评论,登录后可以:
    参与开源共建问题交流
    认同或收藏高质量问答
    获取积分成为开源共建先驱

    精彩评论12

    martin_hu

    沙发 发表于 2024-2-26 12:19:13
    遇到了相同报错,题主有解决吗?

    论坛小助手

    发表于 2024-3-1 14:18  IP属地: 广东省广州市

    回复 martin_hu: 新更新下版本即可,已经修复

    martin_hu

    发表于 2024-3-1 14:41  IP属地: 广东省广州市

    回复 论坛小助手: 什么时候更新的,我前天拉的最新代码,64位编译仍然报错啊

    论坛小助手

    发表于 2024-3-1 16:32  IP属地: 广东省广州市

    回复 martin_hu: 今天刚合入更新的,辛苦看一下哈

    martin_hu

    发表于 2024-3-3 19:08  IP属地: 广东省广州市

    回复 论坛小助手: 还是不行啊,有pr吗,麻烦贴一下

    论坛小助手

    发表于 2024-3-4 10:00  IP属地: 广东省广州市

    回复 martin_hu: 辛苦提供一下报错截图

    martin_hu

    发表于 2024-3-4 11:16  IP属地: 广东省广州市

    回复 论坛小助手:

    1. [OHOS ERROR] /usr/bin/ccache ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang -MMD -MF obj/third_party/pulseaudio/src/pulsecore/pulsecore_sources/sink.o.d -DV8_DEPRECATION_WARNINGS -D_GNU_SOURCE -DHAVE_SYS_UIO_H -D__MUSL__ -D_LIBCPP_HAS_MUSL_LIBC -D__BUILD_LINUX_WITH_CLANG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD -D__GNU_SOURCE=1 -DCHROMIUM_CXX_TWEAK_INLINES -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Iobj/third_party/musl/usr/include/aarch64-linux-ohos -Ioverride/third_party -I../.. -Igen -I../../third_party/pulseaudio/include -I../../third_party/pulseaudio -I../../third_party/pulseaudio/src -I../../third_party/pulseaudio/ohosbuild/include -I../../third_party/pulseaudio/ohosbuild/src -I../../third_party/glib/glib -I../../third_party/glib -I../../third_party/libsnd/include -I../../base/hiviewdfx/hilog/interfaces/native/innerkits/include -fno-strict-aliasing -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -flto=thin -fsplit-lto-unit -ffunction-sections -fno-short-enums --target=aarch64-linux-ohos -march=armv8-a -mfloat-abi=hard -mfpu=neon-fp-armv8 --param=ssp-buffer-size=4 -fstack-protector-strong -fPIC -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-error=c99-designator -Wno-error=anon-enum-enum-conversion -Wno-error=sizeof-array-div -Wno-error=implicit-fallthrough -Wno-error=reorder-init-list -Wno-error=range-loop-construct -Wno-error=deprecated-copy -Wno-error=implicit-int-float-conversion -Wno-error=inconsistent-dllimport -Wno-error=unknown-warning-option -Wno-error=sign-compare -Wno-error=int-in-bool-context -Wno-error=return-stack-address -Wno-error=dangling-gsl -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-but-set-parameter -Wno-null-pointer-subtraction -Wno-unqualified-std-cast-call -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g2 -ggnu-pubnames -fno-common -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare --param=ssp-buffer-size=4 -fstack-protector-ret-strong -Wall -Werror -Wno-implicit-function-declaration -Wno-unused-function -Wno-uninitialized -DHAVE_CONFIG_H -D_GNU_SOURCE -D__INCLUDED_FROM_PULSE_AUDIO -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang --sysroot=obj/third_party/musl -c ../../third_party/pulseaudio/src/pulsecore/sink.c -o obj/third_party/pulseaudio/src/pulsecore/pulsecore_sources/sink.o
    2. [OHOS ERROR] ../../third_party/pulseaudio/src/pulsecore/sink.c:2831:57: error: format specifies type 'unsigned long long' but the argument has type 'pa_usec_t' (aka 'unsigned long') [-Werror,-Wformat]
    3. [OHOS ERROR]                     pa_log_debug("Move took %llu usec", usec);
    4. [OHOS ERROR]                                             ~~~~        ^~~~
    5. [OHOS ERROR]                                             %lu
    6. [OHOS ERROR] ../../third_party/pulseaudio/src/pulsecore/log.h:126:91: note: expanded from macro 'pa_log_debug'
    7. [OHOS ERROR] #define pa_log_debug(...)  pa_log_level_meta(PA_LOG_DEBUG,  __FILE__, __LINE__, __func__, __VA_ARGS__)
    8. [OHOS ERROR]                                                                                           ^~~~~~~~~~~
    9. [OHOS ERROR] ../../third_party/pulseaudio/src/pulsecore/sink.c:2882:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    10. [OHOS ERROR]         case PA_SINK_MESSAGE_SET_VOLUME:
    11. [OHOS ERROR]         ^
    12. [OHOS ERROR] ../../third_party/pulseaudio/src/pulsecore/sink.c:2882:9: note: insert '__attribute__((fallthrough));' to silence this warning
    13. [OHOS ERROR]         case PA_SINK_MESSAGE_SET_VOLUME:
    14. [OHOS ERROR]         ^
    15. [OHOS ERROR]         __attribute__((fallthrough));
    复制代码

    【6 条回复】

    wudilsr

    来自手机 板凳 发表于 2024-3-1 09:29:42
    目前没办法

    论坛小助手

    地板 发表于 2024-3-1 14:18:03
    新更新下版本即可,已经修复

    ctf-gitee

    发表于 2024-4-23 09:48  IP属地: - 中国广东省广州市 中国电信IDC

    回复 论坛小助手: 遇到同样的问题
    用编译
    hb build -p rk3568 --target-cpu arm64

    [OHOS ERROR] ../../foundation/communication/netmanager_base/services/netmanagernative/src/netsys/dnsresolv/dns_quality_diag.cpp:238:57: error: format specifies type 'unsigned int' but the argument has type 'std::list<OHOS::NetsysNative::NetDnsResultReport>::size_type' (aka 'unsigned long') [-Werror,-Wformat]
    [OHOS ERROR]         NETNATIVE_LOG_D("send_dns_report (%{public}u)", reportSend.size());
    [OHOS ERROR]                                           ~~~~~~~~~~    ^~~~~~~~~~~~~~~~~
    [OHOS ERROR]                                           %lu
    [OHOS ERROR] ../../foundation/communication/netmanager_base/interfaces/innerkits/netmanagernative/include/netnative_log_wrapper.h:36:66: note: expanded from macro 'NETNATIVE_LOG_D'
    [OHOS ERROR] #define NETNATIVE_LOG_D(fmt, ...) PRINT_NATIVE_LOG(DEBUG, fmt, ##__VA_ARGS__)
    [OHOS ERROR]                                                           ~~~    ^~~~~~~~~~~
    [OHOS ERROR] ../../foundation/communication/netmanager_base/interfaces/innerkits/netmanagernative/include/netnative_log_wrapper.h:34:59: note: expanded from macro 'PRINT_NATIVE_LOG'
    [OHOS ERROR]                                     FILENAME, __LINE__, ##__VA_ARGS__)
    [OHOS ERROR]                                                           ^~~~~~~~~~~
    [OHOS ERROR] ../../base/hiviewdfx/hilog/interfaces/native/innerkits/include/hilog/log_c.h:95:90: note: expanded from macro 'HILOG_DEBUG'
    [OHOS ERROR] #define HILOG_DEBUG(type, ...) ((void)HILOG_IMPL((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
    [OHOS ERROR]                                                                                          ^~~~~~~~~~~
    [OHOS ERROR] ../../base/hiviewdfx/hilog/interfaces/native/innerkits/include/hilog/log_c.h:113:90: note: expanded from macro 'HILOG_IMPL'
    [OHOS ERROR] #define HILOG_IMPL(type, level, domain, tag, ...) HiLogPrint(type, level, domain, tag, ##__VA_ARGS__)
    [OHOS ERROR]                                                                                          ^~~~~~~~~~~
    [OHOS ERROR] 1 error generated.

    [OHOS ERROR] Traceback (most recent call last):
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/containers/status.py", line 47, in wrapper
    [OHOS ERROR]     return func(*args, **kwargs)
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/modules/ohos_build_module.py", line 67, in run
    [OHOS ERROR]     raise exception
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/modules/ohos_build_module.py", line 65, in run
    [OHOS ERROR]     super().run()
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/modules/interface/build_module_interface.py", line 72, in run
    [OHOS ERROR]     raise exception
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/modules/interface/build_module_interface.py", line 70, in run
    [OHOS ERROR]     self._target_compilation()
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation
    [OHOS ERROR]     self.target_compiler.run()
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/services/ninja.py", line 38, in run
    [OHOS ERROR]     self._execute_ninja_cmd()
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/services/ninja.py", line 69, in _execute_ninja_cmd
    [OHOS ERROR]     SystemUtil.exec_command(
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/util/system_util.py", line 64, in exec_command
    [OHOS ERROR]     LogUtil.get_failed_log(log_path)
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/build/hb/util/log_util.py", line 193, in get_failed_log
    [OHOS ERROR]     LogUtil.get_compiler_failed_log(log_path)
    [OHOS ERROR]   File "/home/work/OHOS/OpenHarmony-v4.1/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 /home/work/OHOS/OpenHarmony-v4.1/out/rk3568/error.log, and for more build information in /home/work/OHOS/OpenHarmony-v4.1/out/rk3568/build.log
    [OHOS ERROR]

    [OHOS ERROR] Code:        4000
    [OHOS ERROR]
    [OHOS ERROR] Reason:      COMPILE Failed! Please check error in /home/work/OHOS/OpenHarmony-v4.1/out/rk3568/error.log, and for more build information in /home/work/OHOS/OpenHarmony-v4.1/out/rk3568/build.log
    [OHOS ERROR]
    [OHOS ERROR] Error Type:  Ninja build error
    [OHOS ERROR]
    [OHOS ERROR] Description: An unknown error occurred while executing 'ninja -C'.
    [OHOS ERROR]
    [OHOS ERROR] Solution:    no solution
    [OHOS ERROR]

    有什么办法吗?

    论坛小助手

    发表于 2024-4-23 14:50  IP属地: 广东省广州市

    回复 ctf-gitee: 这一行有点问题

    1. NETNATIVE_LOG_D("send_dns_report (%{public}u)", reportSend.size());
    复制代码

    需要修改格式化字符串中的占位符,以匹配 reportSend.size() 返回的类型,修改后的代码
    1. NETNATIVE_LOG_D("send_dns_report (%lu)", reportSend.size());
    复制代码

    看看能不能解决

    论坛小助手

    发表于 2024-4-23 14:52  IP属地: 广东省广州市

    回复 论坛小助手: 具体步骤
    1. 打开 ../../foundation/communication/netmanager_base/services/netmanagernative/src/netsys/dnsresolv/dns_quality_diag.cpp 文件。
    2. 找到第 238 行,将格式化字符串中的 %u 改为 %lu。
    3. 保存文件并重新编译。
    4. 如果修改正确,编译应该能够顺利通过。

    【3 条回复】

    Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

    返回顶部