Skip to content

[video2x-qt6] Linux build from source fails on Ubuntu/Debian: bundled ncnn not used + XDG model path not searched #1487

Description

@tyy130

Environment

  • OS: Linux Mint 22.3 / Ubuntu 24.04 base
  • Qt: 6.4.2 (system)
  • video2x-qt6: master branch

Summary

Building video2x-qt6 from source on Ubuntu/Debian hits two issues that aren't obvious from the README:


Issue 1: ncnn is not available in Ubuntu/Debian apt repos

The ExternalProject_Add for Video2X in video2x-qt6/CMakeLists.txt does not forward a flag to disable the system ncnn lookup. When cmake configures the Video2X sub-project, it tries find_package(ncnn) and fails because ncnn has no Ubuntu/Debian package.

Suggested fix — add -DVIDEO2X_USE_EXTERNAL_NCNN=OFF to the CMAKE_ARGS block:

ExternalProject_Add(
    Video2X
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/video2x
    CMAKE_ARGS
        -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/video2x-install
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON
        -DVIDEO2X_USE_EXTERNAL_NCNN=OFF   # force bundled ncnn
    BUILD_ALWAYS ON
    INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
)

Issue 2: Runtime model files not found for ~/.local installs

libvideo2x's find_resource_file() in fsutils.cpp searches:

  1. The absolute path itself
  2. /usr/share/video2x/
  3. Next to the executable (get_executable_directory() / path)

If the binary is installed to ~/.local/bin/, models installed to the XDG standard location (~/.local/share/video2x/models/) are never found, causing silent task failure on start.

Suggested fix — add $XDG_DATA_HOME/video2x/ (falling back to ~/.local/share/video2x/) as a search path in find_resource_file().


Workarounds (for anyone hitting this now)

# 1. Add to ExternalProject CMAKE_ARGS in video2x-qt6/CMakeLists.txt:
-DVIDEO2X_USE_EXTERNAL_NCNN=OFF

# 2. After build, make models findable next to binary
mkdir -p ~/.local/share/video2x/
cp -r build/video2x-install/share/video2x/models ~/.local/share/video2x/
ln -sf ~/.local/share/video2x/models ~/.local/bin/models

# 3. Fix rpath so .so files are found without LD_LIBRARY_PATH
patchelf --set-rpath ~/.local/lib ~/.local/lib/libvideo2x.so
patchelf --set-rpath ~/.local/lib ~/.local/bin/video2x-qt6

With these in place the GUI builds and runs correctly on Ubuntu 24.04. Great project overall!

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:BacklogThis issue will be worked on in the future

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions