ubunt22.04, qt是5.13.0,原来能用的,有阵子没登陆这个系统了。现在发现运行qt带界面的程序,包括qtcreator,都会报下面这个错误。
运行qt/Toos/qtcreator/bin/qtcreator.sh这个脚本倒是能打开qtcreator。
运行qt/Toos/qtcreator/bin/qtcreator就报错。运行其他qt编写的gui也报这个错。
qt maintentools倒是能运行。
以为重装能解决问题,就删除了qt5.13.0,装了qt5.13.2,倒是真能运行,但是一重启电脑后,就又报这个错了。
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
离线
才发现,重新安装qt后,自己编写的qt应用程序,可以启动了,虽然有提示:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
但是qtcreator直接运行,还是报错:
/opt/Qt/Tools/QtCreator/bin$ ./qtcreator
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
离线
sudo apt install --reinstall libxcb-xinerama0
离线
sudo apt install --reinstall libxcb-xinerama0
试过的,没效果。
目前的状况是,qt编写的gui程序,可以运行,不报错。
会有这么个警告:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
而/opt/qt/5.13.2/Tools/QtCreator/bin目录下,有qtcreator和qtcreator.sh两个文件。
运行qtcreator会报错:
./qtcreator
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
而运行qtcreator.sh脚本,则能运行。
./qtcreator.sh
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Failed to load color scheme: "/opt/Qt5.13.0/Tools/QtCreator/share/qtcreator/styles/dark.xml"
Cannot update Qt version information: /home/any/imx6ul/qt5.13.0-arm/bin/qmake cannot be run.
离线
你可以看看qtcreator.sh是怎么写的。
离线
以下是qtcreator.sh的全部内容:
#! /bin/sh
# Use this script if you add paths to LD_LIBRARY_PATH
# that contain libraries that conflict with the
# libraries that Qt Creator depends on.
makeAbsolute() {
case $1 in
/*)
# already absolute, return it
echo "$1"
;;
*)
# relative, prepend $2 made absolute
echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
;;
esac
}
me=`which "$0"` # Search $PATH if necessary
if test -L "$me"; then
# Try GNU readlink(1)
nme=`readlink -nf "$me" 2>/dev/null`
if test -n "$nme"; then
me=$nme
else
# No GNU readlink(1), so let's try ls -l
base=`dirname "$me"`
me=`ls -l "$me" | sed 's/^.*-> //'`
me=`makeAbsolute "$me" "$base"`
fi
fi
bindir=`dirname "$me"`
libdir=`cd "$bindir/../lib" ; pwd`
# Add path to deployed Qt libraries in package
qtlibdir=$libdir/Qt/lib
if test -d "$qtlibdir"; then
qtlibpath=:$qtlibdir
fi
# Add Qt Creator library path
_ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$libdir:$libdir/qtcreator$qtlibpath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
exec "$bindir/qtcreator" -user-library-path "$_ORIGINAL_LD_LIBRARY_PATH" ${1+"$@"}
试过注释掉以下这几句,这运行qtcreator.sh也会报错:
# Add path to deployed Qt libraries in package
qtlibdir=$libdir/Qt/lib
if test -d "$qtlibdir"; then
qtlibpath=:$qtlibdir
fi
最近编辑记录 Gentlepig (2023-02-16 14:50:34)
离线
查看
/opt/Qt/Tools/QtCreator/lib/Qt/lib$
目录下,qt库是qt5.13.1的。qtcreator.sh好像是引用这个文件目录下的库。
而我是用qt5.15.2离线安装包安装的qt,顺带安装了qtcreator,竟然不是用同一版本的库...
离线