OpenHarmony开发者论坛

标题: 使用sudo ./build.sh -p rk3568 -t arm64 --ccache 编译OpenHarmony5.0源码时出现如下报错[OHOS ERROR] Code: 4000 [打印本页]

作者: zyxzyx    时间: 2024-12-20 09:32
标题: 使用sudo ./build.sh -p rk3568 -t arm64 --ccache 编译OpenHarmony5.0源码时出现如下报错[OHOS ERROR] Code: 4000
[md]### 【问题描述】

1. 使用sudo ./build.sh -p rk3568 -t arm64 --ccache编译源码时出现如下报错:怀疑工具链有问题,希望提供下完整的工具链或者安装指令

[OHOS ERROR] [1315/8757] CXX clang_x64/obj/arkcompiler/ets_runtime/ecmascript/compiler/libark_jsoptimizer_set_with_maple/bytecode_circuit_builder.o
[OHOS ERROR] FAILED: clang_x64/obj/arkcompiler/ets_runtime/ecmascript/compiler/libark_jsoptimizer_set_with_maple/bytecode_circuit_builder.o
[OHOS ERROR] /usr/bin/ccache ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -MMD -MF clang_x64/obj/arkcompiler/ets_runtime/ecmascript/compiler/libark_jsoptimizer_set_with_maple/bytecode_circuit_builder.o.d -DARK_LITECG_DEBUG -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DPANDA_ENABLE_LTO -DPANDA_USE_MUSL -DIS_PUBLIC_VERSION -DECMASCRIPT_SUPPORT_DEBUGGER -DECMASCRIPT_SUPPORT_CPUPROFILER -DECMASCRIPT_SUPPORT_HEAPPROFILER -DECMASCRIPT_SUPPORT_HEAPSAMPLING -DECMASCRIPT_SUPPORT_SNAPSHOT -DECMASCRIPT_SUPPORT_TRACING -DPANDA_TARGET_PREVIEW -DPANDA_TARGET_UNIX -DPANDA_TARGET_LINUX -DPANDA_USE_FUTEX -DENABLE_COW_ARRAY -DPANDA_TARGET_64 -DPANDA_TARGET_AMD64 -DPANDA_USE_32_BIT_POINTER -DARK_SUPPORT_INTL -Iclang_x64/override/third_party -I../.. -Iclang_x64/gen -I../../prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/llvm/include -I../../prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/cg -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/litecg -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/cg/aarch64 -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/ad -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/ad/target -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/be/aarch64 -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/include/be -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_driver/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_driver/defs -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_driver/defs/default -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_util/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mpl2mpl/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mempool/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_phase/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_ir/include -I../../arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_me/include -I../../base/hiviewdfx/hilog/interfaces/native/innerkits/include -I../../arkcompiler/ets_runtime -I../../arkcompiler/ets_runtime/ecmascript/napi/include -I../../arkcompiler/runtime_core -I../../arkcompiler/runtime_core/libpandabase -Iclang_x64/gen/arkcompiler/runtime_core/libpandabase/include -Iclang_x64/gen/arkcompiler/runtime_core/libpandabase -I../../arkcompiler/runtime_core/libpandafile -I../../arkcompiler/runtime_core/libziparchive -Iclang_x64/gen/arkcompiler/runtime_core/libpandafile -Iclang_x64/gen/arkcompiler/runtime_core/libpandafile/include -I../../third_party/icu/icu4c/source/common -I../../third_party/icu/icu4c/source/i18n -I../../third_party/icu/icu4c/source -I../../third_party/bounds_checking_function/include -I../../third_party/zlib -I../../third_party/zlib/contrib/minizip -fno-strict-aliasing -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -m64 -march=x86-64 -fstack-protector-strong -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 -g0 -fno-common -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -fstack-protector-strong -std=c++17 -fno-exceptions -fno-rtti -DARK_GC_SUPPORT -Wno-gnu-zero-variadic-macro-arguments -Wall -Wshadow -Werror -Wextra -pedantic -Wno-invalid-offsetof -Wno-gnu-statement-expression -pipe -Wdate-time -funwind-tables -fno-rtti -fasynchronous-unwind-tables -Wformat=2 -std=c++17 -Wno-unused-but-set-variable -DCOMPILE_MAPLE -Wall -Wshadow -Werror -Wextra -pedantic -Wno-invalid-offsetof -Wno-gnu-statement-expression -pipe -Wdate-time -funwind-tables -fno-rtti -fasynchronous-unwind-tables -Wformat=2 -std=c++17 -Wno-unused-but-set-variable -c ../../arkcompiler/ets_runtime/ecmascript/compiler/bytecode_circuit_builder.cpp -o clang_x64/obj/arkcompiler/ets_runtime/ecmascript/compiler/libark_jsoptimizer_set_with_maple/bytecode_circuit_builder.o

[OHOS INFO] User Cpu%: 0.0%

[OHOS INFO] System Cpu%: 1.4%

[OHOS INFO] Idle CPU%: 98.6%

[OHOS INFO] Total Memory: 1.9GB

[OHOS INFO] Free Memory: 1.2GB

[OHOS INFO] Swap Memory: 2.0GB

[OHOS INFO] Filesystem: udev, Size: 918M, Used: 0, Available: 918M, Use%: 0%, Mounted on: /dev

[OHOS INFO] Filesystem: tmpfs, Size: 193M, Used: 1.7M, Available: 192M, Use%: 1%, Mounted on: /run

[OHOS INFO] Filesystem: /dev/sda5, Size: 294G, Used: 105G, Available: 174G, Use%: 38%, Mounted on: /

[OHOS INFO] Filesystem: tmpfs, Size: 964M, Used: 0, Available: 964M, Use%: 0%, Mounted on: /dev/shm

[OHOS INFO] Filesystem: tmpfs, Size: 5.0M, Used: 4.0K, Available: 5.0M, Use%: 1%, Mounted on: /run/lock

[OHOS INFO] Filesystem: tmpfs, Size: 964M, Used: 0, Available: 964M, Use%: 0%, Mounted on: /sys/fs/cgroup

[OHOS INFO] Filesystem: /dev/loop0, Size: 128K, Used: 128K, Available: 0, Use%: 100%, Mounted on: /snap/bare/5

[OHOS INFO] Filesystem: /dev/loop1, Size: 64M, Used: 64M, Available: 0, Use%: 100%, Mounted on: /snap/core20/1828

[OHOS INFO] Filesystem: /dev/loop3, Size: 347M, Used: 347M, Available: 0, Use%: 100%, Mounted on: /snap/gnome-3-38-2004/119

[OHOS INFO] Filesystem: /dev/loop2, Size: 64M, Used: 64M, Available: 0, Use%: 100%, Mounted on: /snap/core20/2434

[OHOS INFO] Filesystem: /dev/loop4, Size: 350M, Used: 350M, Available: 0, Use%: 100%, Mounted on: /snap/gnome-3-38-2004/143

[OHOS INFO] Filesystem: /dev/loop5, Size: 92M, Used: 92M, Available: 0, Use%: 100%, Mounted on: /snap/gtk-common-themes/1535

[OHOS INFO] Filesystem: /dev/loop7, Size: 45M, Used: 45M, Available: 0, Use%: 100%, Mounted on: /snap/snapd/23258

[OHOS INFO] Filesystem: /dev/loop6, Size: 46M, Used: 46M, Available: 0, Use%: 100%, Mounted on: /snap/snap-store/638

[OHOS INFO] Filesystem: /dev/loop8, Size: 50M, Used: 50M, Available: 0, Use%: 100%, Mounted on: /snap/snapd/18357

[OHOS INFO] Filesystem: /dev/sda1, Size: 511M, Used: 4.0K, Available: 511M, Use%: 1%, Mounted on: /boot/efi

[OHOS INFO] Filesystem: tmpfs, Size: 193M, Used: 36K, Available: 193M, Use%: 1%, Mounted on: /run/user/1000

[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 47, in wrapper
[OHOS ERROR]     return func(*args, **kwargs)
[OHOS ERROR]            ^^^^^^^^^^^^^^^^^^^^^
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 70, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 67, in run
[OHOS ERROR]     super().run()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 70, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 68, in run
[OHOS ERROR]     self._ninja()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/timer_util.py", line 30, in inner
[OHOS ERROR]     res = func(*arg, **kwarg)
[OHOS ERROR]           ^^^^^^^^^^^^^^^^^^^
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 125, in _ninja
[OHOS ERROR]     self._target_compilation()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 105, in _target_compilation
[OHOS ERROR]     self.target_compiler.run()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/services/ninja.py", line 38, in run
[OHOS ERROR]     self._execute_ninja_cmd()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/services/ninja.py", line 69, in _execute_ninja_cmd
[OHOS ERROR]     SystemUtil.exec_command(
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/system_util.py", line 77, in exec_command
[OHOS ERROR]     LogUtil.get_failed_log(log_path)
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/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/zhang/Desktop/master_code/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/zhang/Desktop/master_code/out/sdk/error.log, and for more build information in /home/zhang/Desktop/master_code/out/sdk/build.log
[OHOS ERROR]

[OHOS ERROR] Code:        4000
[OHOS ERROR]
[OHOS ERROR] Reason:      COMPILE Failed! Please check error in /home/zhang/Desktop/master_code/out/sdk/error.log, and for more build information in /home/zhang/Desktop/master_code/out/sdk/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]
[OHOS ERROR] ohos-sdk build failed! You can try to use '--no-prebuilt-sdk' to skip the build of ohos-sdk.

按着提示加入'--no-prebuilt-sdk'后使用sudo ./build.sh -p rk3568 -t arm64 --ccache--no-prebuilt-sdk依旧不能编译成功,报错如下:


[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 47, in wrapper
[OHOS ERROR]     return func(*args, **kwargs)
[OHOS ERROR]            ^^^^^^^^^^^^^^^^^^^^^
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 70, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 67, in run
[OHOS ERROR]     super().run()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 70, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 68, in run
[OHOS ERROR]     self._ninja()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/timer_util.py", line 30, in inner
[OHOS ERROR]     res = func(*arg, **kwarg)
[OHOS ERROR]           ^^^^^^^^^^^^^^^^^^^
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/interface/build_module_interface.py", line 125, in _ninja
[OHOS ERROR]     self._target_compilation()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/modules/ohos_build_module.py", line 105, in _target_compilation
[OHOS ERROR]     self.target_compiler.run()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/services/ninja.py", line 38, in run
[OHOS ERROR]     self._execute_ninja_cmd()
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/services/ninja.py", line 69, in _execute_ninja_cmd
[OHOS ERROR]     SystemUtil.exec_command(
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/system_util.py", line 77, in exec_command
[OHOS ERROR]     LogUtil.get_failed_log(log_path)
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/log_util.py", line 192, in get_failed_log
[OHOS ERROR]     LogUtil.get_ninja_failed_log(log_path)
[OHOS ERROR]   File "/home/zhang/Desktop/master_code/build/hb/util/log_util.py", line 157, in get_ninja_failed_log
[OHOS ERROR]     raise OHOSException(
[OHOS ERROR] exceptions.ohos_exception.OHOSException: NINJA Failed! Please check error in /home/zhang/Desktop/master_code/out/rk3568/error.log, and for more build information in /home/zhang/Desktop/master_code/out/rk3568/build.log
[OHOS ERROR]

[OHOS ERROR] Code:        4016
[OHOS ERROR]
[OHOS ERROR] Reason:      NINJA Failed! Please check error in /home/zhang/Desktop/master_code/out/rk3568/error.log, and for more build information in /home/zhang/Desktop/master_code/out/rk3568/build.log
[OHOS ERROR]
[OHOS ERROR] Error Type:  ninja build error: missing and no known rule to make it
[OHOS ERROR]
[OHOS ERROR] Description: Ninja build error. The ninja build system cannot find the target.
[OHOS ERROR]
[OHOS ERROR] Solution:    Please check the target file is exists.
[OHOS ERROR]
=====build  error=====

### 【运行环境】

ubuntu20.04
[/md]
作者: Deng_tao2914    时间: 2024-12-20 10:48
为什么要加sudo?
作者: zyxzyx    时间: 2024-12-20 14:10
回复 Deng_tao2914: 不加sudo有的没权限

作者: Deng_tao2914    时间: 2024-12-20 16:12
回复 zyxzyx: 不要用root用户去编译  所有操作都是在普通用户下完成
作者: zyxzyx    时间: 2024-12-20 17:49
回复 Deng_tao2914: 还是一样的错误,
[OHOS INFO] The OHOS-SDK was not detected, so the SDK compilation will be prioritized automatically. You can also control whether to execute this process by using '--no-prebuilt-sdk' and '--prebuilt-sdk'.
[OHOS INFO] building the latest ohos-sdk...


Traceback (most recent call last):
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 47, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/build/hb/containers/arg.py", line 378, in read_args_file
    IoUtil.copy_file(src=default_file_path, dst=args_file_path)
  File "/home/zhang/Desktop/master_code/build/hb/util/io_util.py", line 74, in copy_file
    return shutil.copy(src, dst)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/prebuilts/python/linux-x86/3.11.4/lib/python3.11/shutil.py", line 419, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/zhang/Desktop/master_code/prebuilts/python/linux-x86/3.11.4/lib/python3.11/shutil.py", line 258, in copyfile
    with open(dst, 'wb') as fdst:
         ^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/home/zhang/Desktop/master_code/out/hb_args/envargs.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 47, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/build/hb/main.py", line 92, in main
    'build': main._init_indep_build_module if main._is_indep_build() else main._init_build_module,
                                              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/build/hb/main.py", line 212, in _is_indep_build
    env_args_dict = Arg.read_args_file(ModuleType.ENV)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 65, in wrapper
    _print_formatted_tracebak(_code, str(exception), _type, _desc, _solution)
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 87, in _print_formatted_tracebak
    LogUtil.write_log(_log_path, traceback.format_exc() + '\n', 'error')
  File "/home/zhang/Desktop/master_code/build/hb/util/log_util.py", line 85, in write_log
    with open(log_path, 'at', encoding='utf-8') as log_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/home/zhang/Desktop/master_code/out/sdk/build.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zhang/Desktop/master_code/build/hb/main.py", line 296, in <module>
    sys.exit(Main.main())
             ^^^^^^^^^^^
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 65, in wrapper
    _print_formatted_tracebak(_code, str(exception), _type, _desc, _solution)
  File "/home/zhang/Desktop/master_code/build/hb/containers/status.py", line 87, in _print_formatted_tracebak
    LogUtil.write_log(_log_path, traceback.format_exc() + '\n', 'error')
  File "/home/zhang/Desktop/master_code/build/hb/util/log_util.py", line 85, in write_log
    with open(log_path, 'at', encoding='utf-8') as log_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/home/zhang/Desktop/master_code/out/sdk/build.log'
[OHOS ERROR] ohos-sdk build failed! You can try to use '--no-prebuilt-sdk' to skip the build of ohos-sdk.





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