QT 5.12.4 QWebEngineView XDG_RUNTIME_DIR錯誤接近方案

引用官方文檔:https://doc.qt.io/archives/qt-5.11/qtwebengine-platform-notes.html

運行環境:

  • Ubuntu 16.04 LTS
  • QT 5.12.4

遇到的問題:

  • 非root用戶運行無問題,切換到root用戶或者以sudo方式運行出現問題。

錯誤如下圖:

Sandboxing Support

Qt WebEngine provides out-of-the-box sandboxing support for Chromium render processes on Linux and macOS. Sandboxing is currently not supported on Windows due to a limitation in how the sandbox is set up and how it interacts with the host process provided by the Qt WebEngine libraries.

On macOS, there are no special requirements for enabling sandbox support.

On Linux, the kernel has to support the anonymous namespaces feature (kernel version >= 3.8) and seccomp-bpf feature (kernel version >= 3.5). Setuid sandboxes are not supported and are thus disabled.

To explicitly disable sandboxing, the QTWEBENGINE_DISABLE_SANDBOX environment variable can be set to 1 or alternatively the --no-sandbox command line argument can be passed to the user application executable.

根據官方文檔提示,啓動參數加入 --no-sandbox或者設置環境變量QTWEBENGINE_DISABLE_SANDBOX=1即可解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章