登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
代码拉取完成,页面将自动刷新
仓库状态说明
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
58
Star
129
Fork
1.6K
OpenHarmony
/
build
关闭
代码
Issues
219
Pull Requests
126
Wiki
统计
流水线
服务
JavaDoc
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
[Bug]: Multiple build issues with OpenHarmony 5.1 Release inside a Docker container
待办的
#ICP17B
ahmadbilal
创建于
2025-07-27 05:30
### 发生了什么问题? English version: Hello, I'm trying to build qemu-based version of OpenHarmony 5.1 Release (with GUI ideally) inside a Docker container, but having a few issues that is causing my build to be unsuccessful. I have tried the official documentation on https://docs.openharmony.cn/pages/v5.1/en/device-dev/subsystems/subsys-build-all.md but many documents are for 3.2 Release NOT 5.1. I hope for your helpful guidance. Thank you very much for any help! The issues are mostly around: - Subsystem & Component names - ffrt & ylong_runtime related Machine-translated to Chinese (so forgive me for inaccuracies): 您好,我正在尝试在Docker容器中构建基于Qemu的OpenHarmony5.1版本(理想情况下使用GUI),但有一些问题导致我的构建不成功。 我已经尝试了官方文档https://docs.openharmony.cn/pages/v5.1/en/device-dev/subsystems/subsys-build-all.md 但是很多文档是针对3.2版本而不是5.1版本的。 我希望你有帮助的指导。 非常感谢! 问题主要围绕着: -"子系统"和"组件"名称 -ffrt&ylong_runtime相关 The kind of issues I'm facing: - subsystem name config incorrect in '/openharmony/OpenHarmony/device/qemu/x86_64_virt/linux/ohos.build', build file subsystem name is device_x86_64_virt,configured subsystem name is device_qemu-x86_64-linux - subsystem name config incorrect in '/openharmony/OpenHarmony/third_party/ylong_runtime/ohos.build', build file subsystem name is commonlibrary,configured subsystem name is thirdparty. - find component device_qemu-x86_64-linux failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - find subsystem device_x86_64_virt failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - find component product_qemu-x86_64-linux-min failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - #36 33.77 [OHOS INFO] [GN] ERROR at //developtools/hdc/BUILD.gn:229:7: OHOS innerapi: (ylong_runtime) not found for component (ylong_runtime). This is my public repo: https://github.com/SomeAB/openharmonyos_test/ This is my current dockerfile: ```shell # --- Stage 1: The "Builder" --- FROM ubuntu:22.04 AS builder # STEP 1: Set the working directory for all subsequent commands. # This also creates the /openharmony directory. WORKDIR /openharmony # STEP 2: Force the system shell to be bash for better script compatibility. RUN ln -sf /bin/bash /bin/sh # STEP 3: Download the full source code archive. # This large layer will be cached after the first successful download. COPY code-v5.1.0-Release.tar.gz . # STEP 4: Extract the source code and remove the archive to save space. RUN tar --strip-components=1 -xzf code-v5.1.0-Release.tar.gz && rm code-v5.1.0-Release.tar.gz # STEP 5: Change the working directory post-extraction to /openharmony/OpenHarmony folder WORKDIR /openharmony/OpenHarmony # STEP 6: Install the comprehensive list of all build and runtime dependencies. # This list is designed to be exhaustive to prevent missing package errors. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ bc \ bison \ build-essential \ cargo \ ccache \ clang \ coreutils \ cpio \ curl \ default-jdk \ default-jdk-headless \ dosfstools \ flex \ gcc-arm-none-eabi \ genext2fs \ git \ git-lfs \ gperf \ jq \ libelf-dev \ libffi-dev \ libglib2.0-dev \ liblz4-tool \ libncurses-dev \ libpixman-1-dev \ libsdl2-dev \ libssl-dev \ libtinfo5 \ libx11-dev \ libxml2-dev \ libxrandr-dev \ make \ mtd-utils \ mtools \ ninja-build \ ovmf \ perl \ python3 \ python3-pip \ qemu-system-x86 \ ruby \ rustc \ rsync \ scons \ u-boot-tools \ unzip \ wget \ xsltproc \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* # STEP 6B: Create a symbolic link so 'python' command points to 'python3' RUN ln -sf /usr/bin/python3 /usr/bin/python # STEP 7A: Use 'printf' to reliably create the pip config file and disable the PEP 668 error. RUN printf "[global]\nbreak-system-packages = true\n" > /etc/pip.conf # STEP 7B: Add ~/.local/bin to PATH so 'hb' command can be found ENV PATH="/root/.local/bin:${PATH}" # STEP 7C: This makes the 'hb' command available and installs its Python dependencies. RUN python3 -m pip install --user build/hb # STEP 8: Create compiler wrapper scripts to force-include the missing header. RUN mkdir -p /usr/local/bin_wrappers && \ printf '#!/bin/bash\nexec /usr/bin/gcc -include cstdint "$@"' > /usr/local/bin_wrappers/gcc && \ printf '#!/bin/bash\nexec /usr/bin/g++ -include cstdint "$@"' > /usr/local/bin_wrappers/g++ && \ printf '#!/bin/bash\nexec /usr/bin/clang -include cstdint "$@"' > /usr/local/bin_wrappers/clang && \ printf '#!/bin/bash\nexec /usr/bin/clang++ -include cstdint "$@"' > /usr/local/bin_wrappers/clang++ && \ chmod +x /usr/local/bin_wrappers/* # STEP 9: Prepend the wrapper directory to the PATH environment variable. # This ensures our wrappers are called instead of the real compilers. ENV PATH="/usr/local/bin_wrappers:${PATH}" # STEP 10: Download the pre-built compiler toolchain required by the build script. RUN ./build/prebuilts_download.sh # =================================================================== # Fix no 1 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- Compile Standard Whitelist BEFORE patch ---" && \ find build/ -name compile_standard_whitelist.json -print0 | xargs -0 cat || echo "Source whitelist not found." # Patch 1: Add entries to compile_standard_whitelist.json RUN echo "=== Applying the patch no 1 ===" && \ find build/ -name compile_standard_whitelist.json | while read file; do \ echo "Processing file: $file"; \ # Check if subsystem_components is empty and add entries if jq -e '.subsystem_components | length == 0' "$file" >/dev/null 2>&1; then \ echo "Adding entries to empty subsystem_components array in $file"; \ jq '.subsystem_components = ["device_qemu-x86_64-linux", "device_x86_64_virt", "product_qemu-x86_64-linux-min"]' "$file" > tmp.json && mv tmp.json "$file" && echo "Entries added successfully to subsystem_components"; \ else \ echo "subsystem_components array is not empty, checking individual entries"; \ jq '.subsystem_components |= (. + ["device_qemu-x86_64-linux", "device_x86_64_virt", "product_qemu-x86_64-linux-min"] | unique)' "$file" > tmp.json && mv tmp.json "$file" && echo "Missing entries added to subsystem_components"; \ fi; \ # Also add the bundle_subsystem_error entry if ! jq -e ".bundle_subsystem_error[] | select(. == \"device/qemu/x86_64_virt/linux/ohos.build\")" "$file" >/dev/null 2>&1; then \ echo "Adding entry to bundle_subsystem_error in $file"; \ jq ".bundle_subsystem_error += [\"device/qemu/x86_64_virt/linux/ohos.build\"]" "$file" > tmp.json && mv tmp.json "$file" && echo "Entry added successfully to bundle_subsystem_error"; \ else \ echo "Entry already exists in bundle_subsystem_error array"; \ fi; \ done # Diagnostic: Find & Show the contents after the patch. RUN echo "--- Compile Standard Whitelist AFTER patch ---" && \ find build/ -name compile_standard_whitelist.json -print0 | xargs -0 cat || echo "Source whitelist not found." # =================================================================== # Fix no 2 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- Subsystem Components Whitelist BEFORE patch ---" && \ find build/ -name subsystem_components_whitelist.json -print0 | xargs -0 cat || echo "Subsystem components whitelist not found." # Patch 2: Add 3 entries to the subsystem_components_whitelist.json RUN echo "=== Applying the patch no 2 ===" && \ find build/ -name subsystem_components_whitelist.json | while read file; do \ echo "Processing file: $file"; \ device_exists=$(jq -e "has(\"device_qemu-x86_64-linux\")" "$file" 2>/dev/null); \ product_exists=$(jq -e "has(\"product_qemu-x86_64-linux-min\")" "$file" 2>/dev/null); \ virt_exists=$(jq -e "has(\"device_x86_64_virt\")" "$file" 2>/dev/null); \ echo "Device exists: $device_exists, Product exists: $product_exists, Virt exists: $virt_exists"; \ if [ "$device_exists" = "true" ] || [ "$product_exists" = "true" ] || [ "$virt_exists" = "true" ]; then \ echo "Info: One or more entries were already present in subsystem_components_whitelist"; \ fi; \ echo "Adding entries to $file"; \ jq ". + {\"device_qemu-x86_64-linux\": \"device_qemu-x86_64-linux\", \"product_qemu-x86_64-linux-min\": \"product_qemu-x86_64-linux-min\", \"device_x86_64_virt\": \"device_x86_64_virt\"}" "$file" > tmp.json && mv tmp.json "$file" && echo "Entries added successfully"; \ done # Diagnostic: Find and Show the contents after the patch. RUN echo "--- Subsystem Components Whitelist AFTER patch ---" && \ find build/ -name subsystem_components_whitelist.json -print0 | xargs -0 cat || echo "Subsystem components whitelist not found." # =================================================================== # Fix no 3 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- config.json BEFORE patch ---" && \ cat vendor/ohemu/qemu_x86_64_linux_min/config.json || echo "config.json not found." # Patch 3: Atomically update config.json with robust pre- and post-validation RUN echo "=== Applying the patch no 3 ===" && \ config_file="vendor/ohemu/qemu_x86_64_linux_min/config.json" && \ output_file="config_patched.json" && \ echo "Processing config file: $config_file" && \ \ echo "--- Running Pre-flight Validations ---" && \ if ! jq -e '.subsystems[] | select(.subsystem == "device_x86_64_virt")' "$config_file" >/dev/null 2>&1; then \ echo "✗ ERROR: Prerequisite 'device_x86_64_virt' subsystem not found. Aborting patch." >&2; \ exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "commonlibrary")' "$config_file" >/dev/null 2>&1; then \ echo "✗ ERROR: Prerequisite 'commonlibrary' subsystem not found. Aborting patch." >&2; \ exit 1; \ fi && \ echo "✓ Pre-flight checks passed." && \ \ echo "--- Applying all changes atomically ---" && \ jq ' \ (.subsystems[] | select(.subsystem == "device_x86_64_virt").subsystem) = "device_qemu-x86_64-linux" | \ (.subsystems[] | select(.subsystem == "commonlibrary").components) |= (. + [{"component": "ylong_runtime", "features": []}] | unique_by(.component)) | \ if any(.subsystems[]; .subsystem == "resourceschedule") then . else .subsystems += [{ \ "subsystem": "resourceschedule", \ "components": [ \ { "component": "ffrt", "features":[] }, \ { "component": "frame_aware_sched", "features":[] } \ ] \ }] end \ ' "$config_file" > "$output_file" && \ echo "✓ Changes generated into temporary file." && \ \ echo "--- Running Post-flight Validations on generated file ---" && \ if ! jq -e '.subsystems[] | select(.subsystem == "device_qemu-x86_64-linux")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'device_qemu-x86_64-linux' subsystem not found in output." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "commonlibrary").components[] | select(.component == "ylong_runtime")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'ylong_runtime' component not found in output." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "resourceschedule").components[] | select(.component == "ffrt")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'ffrt' component not found in 'resourceschedule' subsystem." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "resourceschedule").components[] | select(.component == "frame_aware_sched")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'frame_aware_sched' component not found in 'resourceschedule' subsystem." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ echo "✓ Post-flight checks passed." && \ \ mv "$output_file" "$config_file" && \ echo "✓✓✓ Patch 3 applied and validated successfully! ✓✓✓" # Diagnostic: Find and Show the contents after the patch. RUN echo "--- config.json AFTER patch ---" && \ cat vendor/ohemu/qemu_x86_64_linux_min/config.json || echo "config.json not found." # --- START DIAGNOSTIC BLOCK (Essential Pre-Build) --- # Diagnostic: Confirm the current working directory. RUN echo "--- Current Working Directory ---" && pwd || true RUN echo "--- Contents of current directory (first few lines) ---" && ls -la . | head -n 10 || true # Diagnostic: Show hb set help (useful syntax reminder). Helps to confirm hb is installed. RUN echo "--- hb set --help ---" && hb set --help || true # --- END DIAGNOSTIC BLOCK --- # STEP 11: Set the product configuration for the OpenHarmony build. # Now that 'hb' is on the PATH, call it directly. Removed the 'touch .hb' from here, as it was causing conflict with folder creation WORKDIR /openharmony/OpenHarmony RUN hb set --product-name qemu-x86_64-linux-min@ohemu # Diagnostic: Check the environment hb is using to find the root path and other variables. RUN echo "--- hb environment details ---" && \ hb env || true # STEP 12: Build using the accompanying 'hb build' command RUN echo "=== Running hb build to build the OpenHarmony OS ===" && \ hb build --product-name qemu-x86_64-linux-min@ohemu \ --target-cpu x86_64 \ --verbose \ --log-level debug || \ (echo "=== BUILD FAILED - Dumping error.log ===" && \ cat /openharmony/OpenHarmony/out/qemu-x86_64-linux/error.log 2>/dev/null || echo "No error.log found" && \ echo "=== BUILD FAILED - Dumping any other error logs ===" && \ find /openharmony/OpenHarmony/out/ -name "*.log" -exec echo "=== {} ===" \; -exec tail -50 {} \; 2>/dev/null || echo "No additional logs found" && \ false) # Diagnostic: List all final build artifacts in the main output directory. RUN echo "--- Listing All Final Build Artifacts in the 'out' directory ---" && \ ls -lR out/ || true # --- Stage 2: The "Runtime" --- FROM ubuntu:22.04 # STEP 13: Copy the compiled OS images and the launch script from the builder stage. COPY --from=builder /openharmony/out/qemu-x86_64-linux/packages/phone/images /ohos COPY --from=builder /openharmony/device/qemu/x86_64/launch.sh / # STEP 14: Install the minimal dependencies needed to RUN the OS. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ qemu-system-x86 ovmf spice-client-tools && \ rm -rf /var/lib/apt/lists/* # STEP 15: Make the launch script executable. RUN chmod +x /launch.sh # STEP 16: Document that the container exposes port 5900 for the VNC/SPICE stream. EXPOSE 5900 # STEP 17: Set the launch script as the default command when the container starts. ENTRYPOINT ["/launch.sh"] ``` ### 期望行为是什么? Successful Build ### 如何复现该缺陷 Run `docker build filename` command ### 其他补充信息 ### 版本或分支信息 - [ ] master - [x] 5.1-Release - [ ] 5.0-Release - [ ] 5.0-Beta1 - [ ] Release 4.1 - [ ] Release 4.0 - [ ] Release 3.2
### 发生了什么问题? English version: Hello, I'm trying to build qemu-based version of OpenHarmony 5.1 Release (with GUI ideally) inside a Docker container, but having a few issues that is causing my build to be unsuccessful. I have tried the official documentation on https://docs.openharmony.cn/pages/v5.1/en/device-dev/subsystems/subsys-build-all.md but many documents are for 3.2 Release NOT 5.1. I hope for your helpful guidance. Thank you very much for any help! The issues are mostly around: - Subsystem & Component names - ffrt & ylong_runtime related Machine-translated to Chinese (so forgive me for inaccuracies): 您好,我正在尝试在Docker容器中构建基于Qemu的OpenHarmony5.1版本(理想情况下使用GUI),但有一些问题导致我的构建不成功。 我已经尝试了官方文档https://docs.openharmony.cn/pages/v5.1/en/device-dev/subsystems/subsys-build-all.md 但是很多文档是针对3.2版本而不是5.1版本的。 我希望你有帮助的指导。 非常感谢! 问题主要围绕着: -"子系统"和"组件"名称 -ffrt&ylong_runtime相关 The kind of issues I'm facing: - subsystem name config incorrect in '/openharmony/OpenHarmony/device/qemu/x86_64_virt/linux/ohos.build', build file subsystem name is device_x86_64_virt,configured subsystem name is device_qemu-x86_64-linux - subsystem name config incorrect in '/openharmony/OpenHarmony/third_party/ylong_runtime/ohos.build', build file subsystem name is commonlibrary,configured subsystem name is thirdparty. - find component device_qemu-x86_64-linux failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - find subsystem device_x86_64_virt failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - find component product_qemu-x86_64-linux-min failed, please check it in /openharmony/OpenHarmony/out/preloader/qemu-x86_64-linux-min/parts.json - #36 33.77 [OHOS INFO] [GN] ERROR at //developtools/hdc/BUILD.gn:229:7: OHOS innerapi: (ylong_runtime) not found for component (ylong_runtime). This is my public repo: https://github.com/SomeAB/openharmonyos_test/ This is my current dockerfile: ```shell # --- Stage 1: The "Builder" --- FROM ubuntu:22.04 AS builder # STEP 1: Set the working directory for all subsequent commands. # This also creates the /openharmony directory. WORKDIR /openharmony # STEP 2: Force the system shell to be bash for better script compatibility. RUN ln -sf /bin/bash /bin/sh # STEP 3: Download the full source code archive. # This large layer will be cached after the first successful download. COPY code-v5.1.0-Release.tar.gz . # STEP 4: Extract the source code and remove the archive to save space. RUN tar --strip-components=1 -xzf code-v5.1.0-Release.tar.gz && rm code-v5.1.0-Release.tar.gz # STEP 5: Change the working directory post-extraction to /openharmony/OpenHarmony folder WORKDIR /openharmony/OpenHarmony # STEP 6: Install the comprehensive list of all build and runtime dependencies. # This list is designed to be exhaustive to prevent missing package errors. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ bc \ bison \ build-essential \ cargo \ ccache \ clang \ coreutils \ cpio \ curl \ default-jdk \ default-jdk-headless \ dosfstools \ flex \ gcc-arm-none-eabi \ genext2fs \ git \ git-lfs \ gperf \ jq \ libelf-dev \ libffi-dev \ libglib2.0-dev \ liblz4-tool \ libncurses-dev \ libpixman-1-dev \ libsdl2-dev \ libssl-dev \ libtinfo5 \ libx11-dev \ libxml2-dev \ libxrandr-dev \ make \ mtd-utils \ mtools \ ninja-build \ ovmf \ perl \ python3 \ python3-pip \ qemu-system-x86 \ ruby \ rustc \ rsync \ scons \ u-boot-tools \ unzip \ wget \ xsltproc \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* # STEP 6B: Create a symbolic link so 'python' command points to 'python3' RUN ln -sf /usr/bin/python3 /usr/bin/python # STEP 7A: Use 'printf' to reliably create the pip config file and disable the PEP 668 error. RUN printf "[global]\nbreak-system-packages = true\n" > /etc/pip.conf # STEP 7B: Add ~/.local/bin to PATH so 'hb' command can be found ENV PATH="/root/.local/bin:${PATH}" # STEP 7C: This makes the 'hb' command available and installs its Python dependencies. RUN python3 -m pip install --user build/hb # STEP 8: Create compiler wrapper scripts to force-include the missing header. RUN mkdir -p /usr/local/bin_wrappers && \ printf '#!/bin/bash\nexec /usr/bin/gcc -include cstdint "$@"' > /usr/local/bin_wrappers/gcc && \ printf '#!/bin/bash\nexec /usr/bin/g++ -include cstdint "$@"' > /usr/local/bin_wrappers/g++ && \ printf '#!/bin/bash\nexec /usr/bin/clang -include cstdint "$@"' > /usr/local/bin_wrappers/clang && \ printf '#!/bin/bash\nexec /usr/bin/clang++ -include cstdint "$@"' > /usr/local/bin_wrappers/clang++ && \ chmod +x /usr/local/bin_wrappers/* # STEP 9: Prepend the wrapper directory to the PATH environment variable. # This ensures our wrappers are called instead of the real compilers. ENV PATH="/usr/local/bin_wrappers:${PATH}" # STEP 10: Download the pre-built compiler toolchain required by the build script. RUN ./build/prebuilts_download.sh # =================================================================== # Fix no 1 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- Compile Standard Whitelist BEFORE patch ---" && \ find build/ -name compile_standard_whitelist.json -print0 | xargs -0 cat || echo "Source whitelist not found." # Patch 1: Add entries to compile_standard_whitelist.json RUN echo "=== Applying the patch no 1 ===" && \ find build/ -name compile_standard_whitelist.json | while read file; do \ echo "Processing file: $file"; \ # Check if subsystem_components is empty and add entries if jq -e '.subsystem_components | length == 0' "$file" >/dev/null 2>&1; then \ echo "Adding entries to empty subsystem_components array in $file"; \ jq '.subsystem_components = ["device_qemu-x86_64-linux", "device_x86_64_virt", "product_qemu-x86_64-linux-min"]' "$file" > tmp.json && mv tmp.json "$file" && echo "Entries added successfully to subsystem_components"; \ else \ echo "subsystem_components array is not empty, checking individual entries"; \ jq '.subsystem_components |= (. + ["device_qemu-x86_64-linux", "device_x86_64_virt", "product_qemu-x86_64-linux-min"] | unique)' "$file" > tmp.json && mv tmp.json "$file" && echo "Missing entries added to subsystem_components"; \ fi; \ # Also add the bundle_subsystem_error entry if ! jq -e ".bundle_subsystem_error[] | select(. == \"device/qemu/x86_64_virt/linux/ohos.build\")" "$file" >/dev/null 2>&1; then \ echo "Adding entry to bundle_subsystem_error in $file"; \ jq ".bundle_subsystem_error += [\"device/qemu/x86_64_virt/linux/ohos.build\"]" "$file" > tmp.json && mv tmp.json "$file" && echo "Entry added successfully to bundle_subsystem_error"; \ else \ echo "Entry already exists in bundle_subsystem_error array"; \ fi; \ done # Diagnostic: Find & Show the contents after the patch. RUN echo "--- Compile Standard Whitelist AFTER patch ---" && \ find build/ -name compile_standard_whitelist.json -print0 | xargs -0 cat || echo "Source whitelist not found." # =================================================================== # Fix no 2 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- Subsystem Components Whitelist BEFORE patch ---" && \ find build/ -name subsystem_components_whitelist.json -print0 | xargs -0 cat || echo "Subsystem components whitelist not found." # Patch 2: Add 3 entries to the subsystem_components_whitelist.json RUN echo "=== Applying the patch no 2 ===" && \ find build/ -name subsystem_components_whitelist.json | while read file; do \ echo "Processing file: $file"; \ device_exists=$(jq -e "has(\"device_qemu-x86_64-linux\")" "$file" 2>/dev/null); \ product_exists=$(jq -e "has(\"product_qemu-x86_64-linux-min\")" "$file" 2>/dev/null); \ virt_exists=$(jq -e "has(\"device_x86_64_virt\")" "$file" 2>/dev/null); \ echo "Device exists: $device_exists, Product exists: $product_exists, Virt exists: $virt_exists"; \ if [ "$device_exists" = "true" ] || [ "$product_exists" = "true" ] || [ "$virt_exists" = "true" ]; then \ echo "Info: One or more entries were already present in subsystem_components_whitelist"; \ fi; \ echo "Adding entries to $file"; \ jq ". + {\"device_qemu-x86_64-linux\": \"device_qemu-x86_64-linux\", \"product_qemu-x86_64-linux-min\": \"product_qemu-x86_64-linux-min\", \"device_x86_64_virt\": \"device_x86_64_virt\"}" "$file" > tmp.json && mv tmp.json "$file" && echo "Entries added successfully"; \ done # Diagnostic: Find and Show the contents after the patch. RUN echo "--- Subsystem Components Whitelist AFTER patch ---" && \ find build/ -name subsystem_components_whitelist.json -print0 | xargs -0 cat || echo "Subsystem components whitelist not found." # =================================================================== # Fix no 3 # =================================================================== # Diagnostic: Find and Show the contents before the patch. RUN echo "--- config.json BEFORE patch ---" && \ cat vendor/ohemu/qemu_x86_64_linux_min/config.json || echo "config.json not found." # Patch 3: Atomically update config.json with robust pre- and post-validation RUN echo "=== Applying the patch no 3 ===" && \ config_file="vendor/ohemu/qemu_x86_64_linux_min/config.json" && \ output_file="config_patched.json" && \ echo "Processing config file: $config_file" && \ \ echo "--- Running Pre-flight Validations ---" && \ if ! jq -e '.subsystems[] | select(.subsystem == "device_x86_64_virt")' "$config_file" >/dev/null 2>&1; then \ echo "✗ ERROR: Prerequisite 'device_x86_64_virt' subsystem not found. Aborting patch." >&2; \ exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "commonlibrary")' "$config_file" >/dev/null 2>&1; then \ echo "✗ ERROR: Prerequisite 'commonlibrary' subsystem not found. Aborting patch." >&2; \ exit 1; \ fi && \ echo "✓ Pre-flight checks passed." && \ \ echo "--- Applying all changes atomically ---" && \ jq ' \ (.subsystems[] | select(.subsystem == "device_x86_64_virt").subsystem) = "device_qemu-x86_64-linux" | \ (.subsystems[] | select(.subsystem == "commonlibrary").components) |= (. + [{"component": "ylong_runtime", "features": []}] | unique_by(.component)) | \ if any(.subsystems[]; .subsystem == "resourceschedule") then . else .subsystems += [{ \ "subsystem": "resourceschedule", \ "components": [ \ { "component": "ffrt", "features":[] }, \ { "component": "frame_aware_sched", "features":[] } \ ] \ }] end \ ' "$config_file" > "$output_file" && \ echo "✓ Changes generated into temporary file." && \ \ echo "--- Running Post-flight Validations on generated file ---" && \ if ! jq -e '.subsystems[] | select(.subsystem == "device_qemu-x86_64-linux")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'device_qemu-x86_64-linux' subsystem not found in output." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "commonlibrary").components[] | select(.component == "ylong_runtime")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'ylong_runtime' component not found in output." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "resourceschedule").components[] | select(.component == "ffrt")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'ffrt' component not found in 'resourceschedule' subsystem." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ if ! jq -e '.subsystems[] | select(.subsystem == "resourceschedule").components[] | select(.component == "frame_aware_sched")' "$output_file" >/dev/null 2>&1; then \ echo "✗ Validation failed: 'frame_aware_sched' component not found in 'resourceschedule' subsystem." >&2; \ rm -f "$output_file"; exit 1; \ fi && \ echo "✓ Post-flight checks passed." && \ \ mv "$output_file" "$config_file" && \ echo "✓✓✓ Patch 3 applied and validated successfully! ✓✓✓" # Diagnostic: Find and Show the contents after the patch. RUN echo "--- config.json AFTER patch ---" && \ cat vendor/ohemu/qemu_x86_64_linux_min/config.json || echo "config.json not found." # --- START DIAGNOSTIC BLOCK (Essential Pre-Build) --- # Diagnostic: Confirm the current working directory. RUN echo "--- Current Working Directory ---" && pwd || true RUN echo "--- Contents of current directory (first few lines) ---" && ls -la . | head -n 10 || true # Diagnostic: Show hb set help (useful syntax reminder). Helps to confirm hb is installed. RUN echo "--- hb set --help ---" && hb set --help || true # --- END DIAGNOSTIC BLOCK --- # STEP 11: Set the product configuration for the OpenHarmony build. # Now that 'hb' is on the PATH, call it directly. Removed the 'touch .hb' from here, as it was causing conflict with folder creation WORKDIR /openharmony/OpenHarmony RUN hb set --product-name qemu-x86_64-linux-min@ohemu # Diagnostic: Check the environment hb is using to find the root path and other variables. RUN echo "--- hb environment details ---" && \ hb env || true # STEP 12: Build using the accompanying 'hb build' command RUN echo "=== Running hb build to build the OpenHarmony OS ===" && \ hb build --product-name qemu-x86_64-linux-min@ohemu \ --target-cpu x86_64 \ --verbose \ --log-level debug || \ (echo "=== BUILD FAILED - Dumping error.log ===" && \ cat /openharmony/OpenHarmony/out/qemu-x86_64-linux/error.log 2>/dev/null || echo "No error.log found" && \ echo "=== BUILD FAILED - Dumping any other error logs ===" && \ find /openharmony/OpenHarmony/out/ -name "*.log" -exec echo "=== {} ===" \; -exec tail -50 {} \; 2>/dev/null || echo "No additional logs found" && \ false) # Diagnostic: List all final build artifacts in the main output directory. RUN echo "--- Listing All Final Build Artifacts in the 'out' directory ---" && \ ls -lR out/ || true # --- Stage 2: The "Runtime" --- FROM ubuntu:22.04 # STEP 13: Copy the compiled OS images and the launch script from the builder stage. COPY --from=builder /openharmony/out/qemu-x86_64-linux/packages/phone/images /ohos COPY --from=builder /openharmony/device/qemu/x86_64/launch.sh / # STEP 14: Install the minimal dependencies needed to RUN the OS. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ qemu-system-x86 ovmf spice-client-tools && \ rm -rf /var/lib/apt/lists/* # STEP 15: Make the launch script executable. RUN chmod +x /launch.sh # STEP 16: Document that the container exposes port 5900 for the VNC/SPICE stream. EXPOSE 5900 # STEP 17: Set the launch script as the default command when the container starts. ENTRYPOINT ["/launch.sh"] ``` ### 期望行为是什么? Successful Build ### 如何复现该缺陷 Run `docker build filename` command ### 其他补充信息 ### 版本或分支信息 - [ ] master - [x] 5.1-Release - [ ] 5.0-Release - [ ] 5.0-Beta1 - [ ] Release 4.1 - [ ] Release 4.0 - [ ] Release 3.2
评论 (
2
)
登录
后才可以发表评论
状态
待办的
待办的
进行中
已完成
已拒绝
负责人
未设置
标签
bug
waiting_for_assign
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (370)
标签 (53)
master
OpenHarmony_feature_20250702
weekly_20250908
OpenHarmony_feature_Release_20250728
OpenHarmony-6.0-Release
weekly_20250901
revert-merge-5849-OpenHarmony_feature_20250702
revert-merge-5841-OpenHarmony_feature_20250702
weekly_20250825
weekly_20250818
revert-merge-5792-master
weekly_20250811
weekly_20250804
revert-merge-5731-master
weekly_20250728
revert-merge-5716-master
revert-merge-5659-OpenHarmony_feature_20250702
weekly_20250721
weekly_20250714
OpenHarmony_feature_release_20250603
OpenHarmony_feature_20250328
revert-merge-5528-OpenHarmony_feature_20250328
weekly_20250707
OpenHarmony-6.0-Beta1
weekly_20250630
llvm-build-19.1.7
weekly_20250623
revert-merge-5487-OpenHarmony_feature_20250328
weekly_20250616
weekly_20250609
revert-merge-5351-master
OpenHarmony-5.0.3-Release
weekly_20250602
OpenHarmony_feature_Release_20250411
revert-merge-5301-master
weekly_20250526
revert-merge-5326-master
revert-merge-5327-master
revert-merge-5313-master
OpenHarmony-4.1-Release
weekly_20250519
OpenHarmony_feature_20250327
weekly_20250512
OpenHarmony-5.1.0-Release
weekly_20250505
weekly_20250428
revert-merge-5124-master
revert-merge-5121-master
revert-merge-5071-master
OpenHarmony_feature_20250424
weekly_20250421
revert-merge-5044-OpenHarmony_feature_Release_20250411
OpenHarmony_foundation_20250415
OpenHarmony_foundation_release_20250415
revert-merge-5027-OpenHarmony_feature_20250328
weekly_20250414
revert-merge-4990-OpenHarmony_feature_20250328
OpenHarmony_feature_20241108
weekly_20250407
weekly_20250331
revert-merge-4903-master
OpenHarmony_UIPlugin_20250323
weekly_20250324
revert-merge-4887-master
revert-merge-4876-OpenHarmony_feature_20241108
weekly_20250317
revert-merge-4683-master
weekly_20250310
weekly_20250303
revert-merge-4797-OpenHarmony_feature_20241108
OpenHarmony_debug_20250227
weekly_20250224
OpenHarmony_debug_20250224
weekly_20250217
revert-merge-4746-master
OpenHarmony_debug_20250219
weekly_20250210
weekly_20250127
weekly_20250203
OpenHarmony-5.0.2-Release
weekly_20250120
revert-merge-4671-OpenHarmony-5.0.2-Release
revert-merge-4656-OpenHarmony_feature_20241108
weekly_20250113
weekly_20250106
cherry-pick-1736144294
revert-merge-4614-master
revert-merge-4379-master
weekly_20241230
weekly_20241223
revert-merge-4572-master
OpenHarmony_feature_20241121
weekly_20241216
weekly_20241209
revert-merge-4449-master
revert-merge-4378-master
revert-merge-4454-master
weekly_20241202
OpenHarmony-5.0.1-Release
revert-merge-4408-master
revert-merge-4416-master
weekly_20241125
revert-merge-4369-OpenHarmony-5.0.1-Release
revert-merge-4355-master
weekly_20241118
OpenHarmony_feature_202401017
revert-merge-4333-master
weekly_20241111
weekly_20241104
weekly_20241028
OpenHarmony-4.0-Release
weekly_20241014
weekly_20241021
revert-merge-4235-master
revert-merge-4214-master
revert-merge-4001-master
weekly_20241007
weekly_20240930
cherry-pick-1727596141
cherry-pick-1727595509
weekly_20240923
OpenHarmony-5.0-Release
OpenHarmony-5.0.0-Release
OpenHarmony_debug_20240926
revert-merge-2648-master
weekly_20240916
weekly_20240909
revert-f62df2f
revert-merge-4020-master
weekly_20240902
weekly_20240826
OpenHarmony_debug_20240822
revert-merge-3799-master
weekly_20240819
OpenHarmony_debug_20240815
revert-merge-3882-master
revert-merge-3871-master
revert-merge-3875-master
revert-merge-3873-master
weekly_20240812
weekly_20240729
weekly_20240805
revert-merge-2505-master
revert-merge-3671-master
weekly_20240722
revert-merge-2746-master
revert-merge-3772-revert-merge-2746-master
revert-merge-3739-OpenHarmony-4.0-Release
revert-merge-3731-master
weekly_20240715
revert-merge-3738-master
OpenHarmony_debug_20240704
OpenHarmony_ArkUI_Upstream_2024
OpenHarmony_debug_20240717
weekly_20240708
revert-merge-3674-master
weekly_20240701
weekly_20240624
revert-merge-3633-master
weekly_20240617
OpenHarmony-5.0-Beta1
weekly_20240610
weekly_20240603
OpenHarmony_debug_20240606
weekly_20240527
OpenHarmony_debug_20240603
weekly_20240520
revert-merge-3515-master
revert-merge-3513-master
revert-merge-3493-master
weekly_20240506
revert-merge-3459-master
weekly_20240422
kernel_from_master0513_20240515
weekly_20240513
weekly_20240429
revert-merge-3317-master
weekly_20240415
kernel_from_weekly0422_20240511
weekly_20240408
revert-merge-3286-master
weekly_20240401
revert-merge-3210-master
weekly_20240325
revert-merge-3045-OpenHarmony-4.1-Release
revert-merge-3172-master
revert-merge-3127-master
revert-merge-3153-master
revert-merge-3091-master
weekly_20240318
revert-merge-3099-master
weekly_20240311
weekly_20240304
weekly_20240226
weekly_20240219
weekly_20240212
revert-merge-2890-OpenHarmony-4.1-Release
tmp
weekly_20240205
revert-merge-2844-master
revert-merge-2837-master
weekly_20240129
revert-merge-2776-master
weekly_20240122
weekly_20240115
revert-merge-2786-master
OpenHarmony-3.2-Release
weekly_20231225
revert-merge-2771-OpenHarmony-4.0-Release
weekly_20240108
OpenHarmony-4.1-Beta1
weekly_20240101
revert-merge-2694-master
revert-merge-2697-master
weekly_20231218
revert-merge-2682-master
revert-merge-2667-master
weekly_20231211
weekly_20231204
npm_enable
weekly_20231010
revert-merge-2616-master
revert-merge-2626-master
weekly_20231127
weekly_20231031
revert-merge-2536-master
weekly_20231120
weekly_20231114
weekly_20231107
revert-merge-2475-master
revert-merge-2466-master
revert-merge-2460-master
revert-merge-2459-master
weekly_20231024
weekly_20231017
debug_OpenHarmony-4.0-Release_20231013
weekly_20231003
weekly_20230926
weekly_20230919
lbl_test
monthly_20230815
weekly_20230912
weekly_20230905
revert-merge-2322-weekly_20230905
revert-merge-2323-master
weekly_20230829
weekly_20230822
weekly_20230815
weekly_20230808
OpenHarmony-4.0-Beta2
weekly_20230801
weekly_20230725
revert-merge-2155-master
weekly_20230712
weekly_20230704
revert-merge-2114-master
weekly_20230627
weekly_20230626
weekly_20230619
weekly_20230613
cherry-pick-1686728834
profile
weekly_20230606
OpenHarmony-4.0-Beta1
weekly_20230530
weekly_20230523
revert-merge-1947-OpenHarmony-4.0-Beta1
weekly_20230516
revert-merge-1920-master
weekly_20230509
weekly_20230502
weekly_20230425
weekly_20230328
weekly_20230418
weekly_20230411
weekly_20230404
revert-merge-1779-master
weekly_20230321
weekly_20230314
monthly_20221018
weekly_20230307
revert-merge-1706-master
weekly_20230228
OpenHarmony-3.2-Beta5
weekly_20230221
cherry-pick-1676890371
weekly_20230214
weekly_20230207
weekly_20230131
weekly_20230124
weekly_20230117
revert-merge-1617-master
revert-merge-1615-master
weekly_20230110
revert-merge-1584-master
weekly_20230103
OpenHarmony-3.2-Beta4
OpenHarmony-3.1-Release
weekly_20221227
revert-merge-1484-master
weekly_20221220
weekly_20221213
beta4_prebuilts
cherry-pick-1670385726
weekly_20221206
OpenHarmony-3.2-Beta3
weekly_20221129
weekly_20221122
OpenHarmony-3.2-Beta1
weekly_20221115
weekly_20221108
gen_module_info_ninja
revert-merge-1398-master
weekly_20221101
weekly_20221025
lldb-1021
weekly_20221018
revert-merge-1364-master
weekly_20221011
revert-merge-1342-master
revert-merge-1278-master
monthly_20220816
revert-merge-1236-master
OpenHarmony-3.2-Beta2
OpenHarmony-3.1-lubinglun
feature_IDL_20220811
OpenHarmony-3.1-API8-SDK-Public
revert-merge-1124-master
revert-merge-1081-master
weekly_20220719
weekly_20220712
monthly_20220614
weekly_20220705
weekly_20220628
weekly_20220621
OpenHarmony-3.1-Beta
OpenHarmony-2.2-Beta2
OpenHarmony-3.0-LTS
OpenHarmony-3.1-API9-SDK-Canary
OpenHarmony_filemanager_develop_20220614
weekly_20220614
weekly_20220607
weekly_20220531
weekly_20220524
OpenHarmony_filemanager_develop_20220505
revert-merge-789-OpenHarmony-3.1-Release
revert-merge-780-master
weekly_20220510
weekly_20220503
weekly_20220426
weekly_20220419
weekly_20220412
stage_form
weekly_20220406
weekly_20220301
weekly_20220222
weekly_20220215
weekly_20220208
weekly_20220201
weekly_20220125
mytest
mybranch
weekly_20220118
revert-merge-480-master
weekly_20220111
weekly_20220105
revert-merge-348-master
revert-merge-346-master
revert-merge-297-master
OpenHarmony-v2.2-Beta
OpenHarmony-v6.0-Release
OpenHarmony-v6.0-Beta1
OpenHarmony-v4.1.4-Release
OpenHarmony-v5.1.0-Release
OpenHarmony-v5.0.3-Release
OpenHarmony-v4.1.3-Release
OpenHarmony-v5.0.2-Release
OpenHarmony-v4.1.2-Release
OpenHarmony-v5.0.1-Release
OpenHarmony-v4.0.4-Release
OpenHarmony-v5.0.0-Release
OpenHarmony-v4.0.3-Release
OpenHarmony-v4.0.2-Release
OpenHarmony-v5.0-Beta1
OpenHarmony-v4.1.1-Release
OpenHarmony-v4.0.1-Release
OpenHarmony-v4.1-Release
weekly_20240115-v
master-v
OpenHarmony-v4.1-Beta1
OpenHarmony-v4.0-Release
OpenHarmony-v3.2.3-Release
OpenHarmony-v3.2.4-Release
OpenHarmony-v4.0-Beta2
OpenHarmony-v4.0-Beta1
OpenHarmony-v3.2.1-Release
OpenHarmony-v3.2.2-Release
OpenHarmony-v3.2-Release
OpenHarmony-v3.2-Beta5
OpenHarmony-v3.1.5-Release
OpenHarmony-v3.1.6-Release
OpenHarmony-v3.1.7-Release
OpenHarmony-v3.2-Beta4
OpenHarmony-v3.1.4-Release
OpenHarmony-v3.2-Beta3
OpenHarmony-v3.1.3-Release
OpenHarmony-v3.1.2-Release
OpenHarmony-v3.2-Beta2
OpenHarmony-v3.0.5-LTS
OpenHarmony-v3.0.6-LTS
OpenHarmony-v3.0.7-LTS
OpenHarmony-v3.0.8-LTS
OpenHarmony-v3.2-Beta1
OpenHarmony-v3.1.1-Release
OpenHarmony-v3.1-Release
OpenHarmony-v3.0.2-LTS
OpenHarmony-v3.0.3-LTS
OpenHarmony-v3.1-Beta
OpenHarmony-v3.0.1-LTS
OpenHarmony-v3.0-LTS
OpenHarmony-v3.0-Beta1
OpenHarmony-v2.2-Beta2
OpenHarmony-2.0-Canary
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(1)
1
https://gitee.com/openharmony/build.git
git@gitee.com:openharmony/build.git
openharmony
build
build
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册