ubuntu上源码编译qt时报错 Project ERROR: Building QtQml requires Python.

make[1]: Leaving directory '/home/qt/qt-everywhere-src-5.12.8/qtsvg'
cd qtdeclarative/ && ( test -e Makefile || /home/qt/qt-everywhere-src-5.12.8/qtbase/bin/qmake -o Makefile /home/qt/qt-everywhere-src-5.12.8/qtdeclarative/qtdeclarative.pro ) && make -f Makefile install
sh: 1: python: not found
Project ERROR: Building QtQml requires Python.
Makefile:348: recipe for target 'module-qtdeclarative-install_subtargets' failed
make: *** [module-qtdeclarative-install_subtargets] Error 3
root@Linux:/home/qt/qt-everywhere-src-5.12.8# cat t.sh 
#!/bin/bash
./configure -prefix /usr/local/qt512 \
-confirm-license \
-opensource \
-release \
-no-opengl \
-v


解决方案:

添加配置选项:-skip qtdeclarative

root@Linux:/home/qt/qt-creator-opensource-src-4.11.2/build# cat ../../qt-everywhere-src-5.12.8/t.sh 
#!/bin/bash
./configure -prefix /usr/local/qt512 \
-confirm-license \
-opensource \
-release \
-no-opengl \
-skip qtdeclarative \
-v

此时./t.sh、make ,整个过程没有报错。。

接着进行make install操作,,,结果整了半天,,报错了。。如下所示。。。。

/home/qt/qt-everywhere-src-5.15.2/qtbase/include/QtGui/5.15.2/QtGui/private/../../../../../src/gui/painting/qdatabuffer_p.h: In constructor ‘QDataBuffer<Type>::QDataBuffer(int)’:
/home/qt/qt-everywhere-src-5.15.2/qtbase/include/QtGui/5.15.2/QtGui/private/../../../../../src/gui/painting/qdatabuffer_p.h:70:24: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
             QT_WARNING_DISABLE_GCC("-Walloc-size-larger-than=")
                        ^
declarativemaps/qdeclarativepolylinemapitem.cpp: In member function ‘virtual void MapPolylineShaderLineStrip::updateState(const QSGMaterialShader::RenderState&, QSGMaterial*, QSGMaterial*)’:
declarativemaps/qdeclarativepolylinemapitem.cpp:1552:17: error: ‘program’ was not declared in this scope
         program()->setUniformValue(m_color_id, v);
                 ^
declarativemaps/qdeclarativepolylinemapitem.cpp:1557:17: error: ‘program’ was not declared in this scope
         program()->setUniformValue(m_matrix_id, state.projectionMatrix());
                 ^
declarativemaps/qdeclarativepolylinemapitem.cpp:1560:13: error: ‘program’ was not declared in this scope
     program()->setUniformValue(m_mapProjection_id, geoProjection);
             ^
declarativemaps/qdeclarativepolylinemapitem.cpp: In member function ‘virtual void MapPolylineShaderExtruded::updateState(const QSGMaterialShader::RenderState&, QSGMaterial*, QSGMaterial*)’:
declarativemaps/qdeclarativepolylinemapitem.cpp:1768:17: error: ‘program’ was not declared in this scope
         program()->setUniformValue(m_color_id, v);
                 ^
declarativemaps/qdeclarativepolylinemapitem.cpp:1773:17: error: ‘program’ was not declared in this scope
         program()->setUniformValue(m_matrix_id, state.projectionMatrix());
                 ^
declarativemaps/qdeclarativepolylinemapitem.cpp:1777:13: error: ‘program’ was not declared in this scope
     program()->setUniformValue(m_mapProjection_id, geoProjection);
             ^

解决办法

configure的进行了 -no-opengl 操作,所以再加一条 -skip qtlocation。

```bash
root@Linux:/home/qt/qt-creator-opensource-src-4.11.2/build# cat ../../qt-everywhere-src-5.12.8/t.sh 
#!/bin/bash
./configure -prefix /usr/local/qt512 \
-confirm-license \
-opensource \
-release \
-no-opengl \
-skip qtdeclarative \
-skip qtlocation \
-v

之后 make clean、./t.sh、make、没有再报错。。。。

make install时还是会报错。。。。。。。。。
先这样吧,,,,后续有空了再倒腾吧。。。。。。。。

你可能感兴趣的:(#,QT开发经验,ubuntu,qt)