Skip to content

build(linglong): fix file-loss regressions from buildext migration (recording crash + missing filter LUTs) - #541

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:build/fix-recording-crash-avformat
Nov 10, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:build/fix-recording-crash-avformat

Conversation

@add-uos

@add-uos add-uos commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

背景 / Background

buildext.apt 迁移(dcf0c67)后打包的玲珑包出现两个文件丢失类回归,本 PR 各用一个 commit 修复:

  1. 录像必崩(bca0bbd):裸名 dlopen 软链漏掉 libavformat.so
  2. 滤镜全部失效(89be5e8):buildext depends 合并不含 share/,滤镜 LUT 数据丢失

问题 1:录像必崩 / Recording crash

应用启动、预览、滤镜均正常,但一开始录制视频就崩溃(ll-box retval=139 / SIGSEGV),日志 libavformat.so: cannot open shared object file + 13 个 undefined symbol 与 load_libs.c 的 newAvformat() dlsym 序列完全吻合。

根因:录像链路 libcam/libcam_encoder/mp4.c、muxer.c 经 getAvformat() → dlopen("libavformat.so")。libavformat60 只由 runtime 层提供,不在 Qt LibrariesPath(/usr/lib/${TRIPLET})扫描范围内,libPath() 退回裸名;迁移脚本的裸名软链循环漏了 libavformat.so,ld.so 不做通配匹配 → dlopen 失败 → dlsym 全空 → 首次调用即 SIGSEGV。启动路径 newClass() 不加载 avformat,故迁移冒烟测试未覆盖。

修复:裸名软链循环加入 libavformat.so;并加 cp -L 兜底(闭包未带入真实文件时复制,保证链接目标同目录可解析)。

问题 2:滤镜文件丢失 / Missing filter LUTs

滤镜面板加载时持续输出 filter:bright/warm/cold/classic/print/gray/black file is not found..,所有滤镜不可用。

根因:滤镜 LUT 数据(.CUBE/.dat)由 libimageeditor6 安装在 /usr/share/libimagevisualresult6/filter_cube/。旧 install_dep 整包解包会把它带入层;而 buildext.apt 的 depends 合并仅拷贝 bin/、sbin/、lib/(linyaps linglong_builder.cpp mergeOutput 白名单),share/ 目录被设计性丢弃。应用启动时按编译期 LUT_DIR(${PREFIX}/share/libimagevisualresult6/filter_cube,main.cpp initFilters())加载,目录为空 → 全部滤镜失效。

修复:build 段从构建容器(build_depends 的 libimageeditor6-dev → libimageeditor6 提供)复制 filter_cube 数据到应用层 share 目录。


验证 / Verification

  • ll-builder build 成功(两个 commit 各自构建验证);
  • 录像链路:在构建容器(镜像运行层布局,/usr/lib 无任何 libavformat)中用 python3-ctypes 探针验证:默认 ld 搜索路径下 dlopen("libavformat.so") 成功,录像链路 8 个符号(avformat_open_input / alloc_output_context2 / new_stream / write_header / write_frame / write_trailer / avio_open / avio_closep)全部可解析;
  • 滤镜链路:构建产物层 files/share/libimagevisualresult6/filter_cube/ 含 17 个 .CUBE/.dat 文件;offscreen 启动冒烟测试 file is not found 输出为 0(修复前每个滤镜多次输出);
  • 预览/滤镜代码零改动,滤镜防丢失相关行为不受影响。

Summary by Sourcery

Prevent buildext-based Linglong packages from omitting runtime libraries and filter assets required for recording and camera filters.

Bug Fixes:

  • Restore recording by ensuring the runtime can resolve the dynamically loaded FFmpeg format library and its required link targets.
  • Restore camera filters by including the filter LUT data files in the application layer.

Enhancements:

  • Harden runtime library packaging with fallback copying when dependency closure contents are incomplete.

@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Add the missing bare-name libavformat link and copy its resolved library into the app lib directory when the depends closure did not provide it, preventing recording-time dlopen failure.

  • linglong.yaml L56-76

Copy filter LUT assets from the build container into the application share directory because buildext dependency merging omits share/ data.

  • linglong.yaml L80-93

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@add-uos add-uos changed the title build(linglong): add bare libavformat.so symlink to fix recording crash build(linglong): fix file-loss regressions from buildext migration (recording crash + missing filter LUTs) Nov 10, 2026
The buildext migration (dcf0c67) creates bare-name dlopen symlinks only
for libswscale/libffmpegthumbnailer/libportaudio, missing libavformat.so.
libavformat60 is provided only by the runtime layer and is invisible to
the app's libPath() scan of Qt LibrariesPath (/usr/lib/${TRIPLET}); the
lookup then falls back to the bare name, which ld.so cannot resolve
without a symlink (no wildcard matching). Recording (libcam_encoder
mp4/muxer -> getAvformat) therefore fails dlopen("libavformat.so") and
every dlsym returns NULL, and the first call segfaults the app
(ll-box retval=139) although startup, preview and filters keep working.

- add libavformat.so to the bare-name symlink loop, same recipe as the
  other three libs (link to the real versioned file from the build
  container's -dev package)
- add a cp -L fallback when the depends closure did not bring the real
  file into the app lib dir, keeping the bare link resolvable in-layer
  regardless of buildext skip_existing behaviour

Verified with ll-builder build; in the built container (which mirrors
the runtime layout, no libavformat in /usr/lib) a dlopen probe loads
libavformat.so via the default ld path and resolves all recording-path
symbols (avformat_open_input/alloc_output_context2/new_stream/
write_header/write_frame/write_trailer/avio_open/avio_closep); offscreen
startup smoke test shows no dlopen failures.

Log: 修复玲珑包录像必崩(libavformat.so 裸名缺失导致 dlopen 失败、函数指针为空)
Influence: 玲珑包录像功能恢复正常,滤镜/预览行为不变
Change-Id: Iff8eb0d8af0dbfecbf7ca4a52ee09daa
@add-uos
add-uos force-pushed the build/fix-recording-crash-avformat branch from 89be5e8 to 57eed38 Compare November 10, 2026 02:11
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交修改 linglong.yaml 构建配置,修复 buildext 迁移导致的两个回归问题: 录像崩溃(libavformat.so 缺失致 dlopen 失败 → SIGSEGV)和滤镜 LUT 数据丢失。 四维度分析均无问题,启发式扫描与 OCR 审查均为零缺陷,代码注释详尽、逻辑正确、 安全无风险。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

本次代码无需修复,实现正确。以下为当前实现的良好实践总结: ```yaml # 1. 裸名链接:先确保真实文件在目标目录,再建链接 cd ${PREFIX}/lib/${TRIPLET} for n in libavformat.so libswscale.so libffmpegthumbnailer.so libportaudio.so; do
    src=$(readlink -f /usr/lib/${TRIPLET}/$n 2>/dev/null || true)
    [ -n "$src" ] && [ -e "$src" ] || continue
    real=$(basename "$src")
    if [ ! -e "./$real" ]; then
        cp -L "$src" "./$real"
    fi
    ln -sf "$real" "$n"
done cd - >/dev/null
# 2. 非白名单资源(share/ 目录)手动复制 if [ -d /usr/share/libimagevisualresult6/filter_cube ]; then
    install -d -m 0755 ${PREFIX}/share/libimagevisualresult6/filter_cube
    cp -a /usr/share/libimagevisualresult6/filter_cube/. \
          ${PREFIX}/share/libimagevisualresult6/filter_cube/
fi ```

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 341807f into linuxdeepin:master Nov 10, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants