问题一:-xcb作为后端问题记录
在源码外目录新建hostbuild作为编译输出目录,在hostbuild新建build.sh编译脚本,记得用
chmod +x build.sh
添加运行权限
#/bin/bash
../qt-everywhere-src-6.5.4/configure -extprefix /home/li/workplace/local \
-shared \
-platform linux-g++ \
-xcb \
-Wno-dev \
-redo
Feature "xcb": Forcing to "ON" breaks its condition:
QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11
Condition values dump:
QT_FEATURE_thread = "ON"
TARGET XCB::XCB found
TEST_xcb_syslibs = "FALSE"
QT_FEATURE_xkbcommon_x11 not evaluated
出错在TEST_xcb_syslibs = "FALSE"条件不成立;测试条件可以在源码中找到,源码路径qt-everywhere-src-6.5.4/qtbase/src/gui/configure.cmake
截取部分代码。意思可以看出所需的库XCB::CURSOR~XCB::XCB都要有,才成立了。
# xcb_syslibs
qt_config_compile_test(xcb_syslibs
LABEL "XCB (extensions)"
LIBRARIES
XCB::CURSOR
XCB::ICCCM
XCB::IMAGE
XCB::KEYSYMS
XCB::RANDR
XCB::RENDER
XCB::RENDERUTIL
XCB::SHAPE
XCB::SHM
XCB::SYNC
XCB::XFIXES
XCB::XKB
XCB::XCB
CODE
"// xkb.h is using a variable called 'explicit', which is a reserved keyword in C++
#define explicit dont_use_cxx_explicit
#include <xcb/xcb.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xcb_cursor.h>
#include <xcb/randr.h>
#include <xcb/render.h>
#include <xcb/shape.h>
#include <xcb/shm.h>
#include <xcb/sync.h>
#include <xcb/xfixes.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_renderutil.h>
#include <xcb/xkb.h>
#undef explicit
int main(void)
{
/* BEGIN TEST: */
int primaryScreen = 0;
xcb_connection_t *c = xcb_connect(\"\", &primaryScreen);
/* RENDER */
xcb_generic_error_t *error = nullptr;
xcb_render_query_pict_formats_cookie_t formatsCookie =
xcb_render_query_pict_formats(c);
xcb_render_query_pict_formats_reply_t *formatsReply =
xcb_render_query_pict_formats_reply(c, formatsCookie, &error);
/* RENDERUTIL: xcb_renderutil.h include won't compile unless version >= 0.3.9 */
xcb_render_util_find_standard_format(nullptr, XCB_PICT_STANDARD_ARGB_32);
/* XKB: This takes more arguments in xcb-xkb < 1.11 */
xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof(nullptr, 0, 0, 0, 0, 0, 0, 0, 0);
/* END TEST: */
return 0;
}
")
解决方法:
sudo apt-get install \
libxcb-cursor-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-keysyms1-dev \
libxcb-randr0-dev \
libxcb-render0-dev \
libxcb-render-util0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-sync-dev \
libxcb-xfixes0-dev \
libxcb-xkb-dev \
libxcb1-dev
Multimedia 模块使用ffmpeg作为后端
link
前提已经编译好ffmpeg二进制文件,<FFMPEG_DIR>路径为make install到的文件夹,里面包含bin、include、lib文件;建议使用静态库。
注意点:
在Linux环境,要安装pulseaudio开发环境,不然发现不了ffmpeg,使用-pulseaudio,就不要使用-alsa,经测会有冲突
sudo apt install libpulse-dev
示例
configure -- -DFFMPEG_DIR=<FFMPEG_DIR>
实例
../qt-everywhere-src-6.5.4/configure \
-prefix /home/li/workplace/local/hostqt6.5.4 \
-pulseaudio \
-- -DFFMPEG_DIR=/home/li/workplace/local/hostffmpeg4
正确的config.summary截取如下片段
Qt Multimedia:
Spatial Audio .......................... yes
Spatial Audio (Quick3D) ................ yes
Low level Audio Backend:
ALSA (experimental) .................. no
PulseAudio ........................... yes
MMRenderer ........................... no
CoreAudio ............................ no
Windows Media SDK .................... no
Open SLES (Android) .................. no
Web Assembly ......................... no
Plugin:
GStreamer 1.0 ........................ no
FFmpeg ............................... yes
MMRenderer ........................... no
AVFoundation ......................... no
Windows Media Foundation ............. no
Hardware acceleration and features:
Video for Linux ...................... yes
VAAPI support ........................ no
Linux DMA buffer support ............. yes
VideoToolbox ......................... no
Qt 3D: