我在尝试从 Pyenv 安装 Python3.6.1 包时遇到了这个问题。请参阅以下错误消息:
Obtaining file:///home/ml4468/roboschool
Complete output from command python setup.py egg_info:
found resource files: 185
running egg_info
Linux, python3, Ubuntu branch
Link against python 3.6
Slow hardware or software render (no shadows)
rm -f ../robot-test-tool ../robot-test-tool_d ../cpp_household.so ../cpp_household_d.so .build-release/physics-bullet.o .build-release/assets-mesh.o .build-release/random-world-tools.o .build-release/render-glwidget.o .build-release/render-hud.o .build-release/render-simple.o .build-release/render-simple-primitives.o .build-release/test-tool-qt4.o .build-release/python-binding.o .build-debug/physics-bullet.o .build-debug/assets-mesh.o .build-debug/random-world-tools.o .build-debug/render-glwidget.o .build-debug/render-hud.o .build-debug/render-simple.o .build-debug/render-simple-primitives.o .build-debug/test-tool-qt4.o .build-debug/python-binding.o .generated/*.moc *.ilk *.pdb .build-release/physics-bullet.o.dep .build-release/assets-mesh.o.dep .build-release/random-world-tools.o.dep .build-release/render-glwidget.o.dep .build-release/render-hud.o.dep .build-release/render-simple.o.dep .build-release/render-simple-primitives.o.dep .build-release/test-tool-qt4.o.dep .build-release/python-binding.o.dep .build-debug/physics-bullet.o.dep .build-debug/assets-mesh.o.dep .build-debug/random-world-tools.o.dep .build-debug/render-glwidget.o.dep .build-debug/render-hud.o.dep .build-debug/render-simple.o.dep .build-debug/render-simple-primitives.o.dep .build-debug/test-tool-qt4.o.dep .build-debug/python-binding.o.dep
rm -rf .generated
rm -rf .build-debug
rm -rf .build-release
Linux, python3, Ubuntu branch
Link against python 3.6
Slow hardware or software render (no shadows)
mkdir -p .generated
mkdir -p .build-release
mkdir -p .build-debug
gcc -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -O3 -march=native -I/usr/include `pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.6` -Ibullet_local_install/include -Ibullet_local_install/include/bullet -I/usr/local/include/bullet -c physics-bullet.cpp -o.build-release/physics-bullet.o -MMD -MF .build-release/physics-bullet.o.dep
gcc -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -O3 -march=native -I/usr/include `pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.6` -Ibullet_local_install/include -Ibullet_local_install/include/bullet -I/usr/local/include/bullet -c assets-mesh.cpp -o.build-release/assets-mesh.o -MMD -MF .build-release/assets-mesh.o.dep
gcc -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -O3 -march=native -I/usr/include `pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.6` -Ibullet_local_install/include -Ibullet_local_install/include/bullet -I/usr/local/include/bullet -c random-world-tools.cpp -o.build-release/random-world-tools.o -MMD -MF .build-release/random-world-tools.o.dep
gcc -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -O3 -march=native -I/usr/include `pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.6` -Ibullet_local_install/include -Ibullet_local_install/include/bullet -I/usr/local/include/bullet -c render-glwidget.cpp -o.build-release/render-glwidget.o -MMD -MF .build-release/render-glwidget.o.dep
In file included from render-glwidget.h:1:0,
from physics-bullet.cpp:1:
render-simple.h:6:35: fatal error: QtWidgets/QOpenGLWidget: No such file or directory
#include <QtWidgets/QOpenGLWidget>
^
compilation terminated.
In file included from assets-mesh.cpp:1:0:
render-simple.h:6:35: fatal error: QtWidgets/QOpenGLWidget: No such file or directory
#include <QtWidgets/QOpenGLWidget>
^
compilation terminated.
In file included from random-world-tools.cpp:3:0:
render-simple.h:6:35: fatal error: QtWidgets/QOpenGLWidget: No such file or directory
#include <QtWidgets/QOpenGLWidget>
^
compilation terminated.
In file included from render-glwidget.h:1:0,
from render-glwidget.cpp:2:
render-simple.h:6:35: fatal error: QtWidgets/QOpenGLWidget: No such file or directory
#include <QtWidgets/QOpenGLWidget>
^
compilation terminated.
make: *** [.build-release/physics-bullet.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [.build-release/assets-mesh.o] Error 1
make: *** [.build-release/random-world-tools.o] Error 1
make: *** [.build-release/render-glwidget.o] Error 1
cd /home/ml4468/roboschool/roboschool/cpp-household && make clean && make -j4 dirs ../cpp_household.so
C++ dependencies for this project are:
bullet
tinyxml
boost_python
assimp
Qt5
If you see compilation error FIRST THING TO CHECK if pkg-config call was successful.
Install dependencies that pkg-config cannot find.
答案1
因此在 Ubuntu 14.04 上,Qt 版本为 5.2.1,而 opengl 还不是 QOpenGLWidget,它实际上是 QGLWidget,在后续的 Qt 版本中它将被重命名。你可以检查一下:
dpkg -L libqt5opengl5-dev
并查看已安装文件的列表。然后浏览头文件,您将看到是什么 :)