編譯qt5.9-arm-qmake

一、arm-gcc環境配置

    tar xvf rock3288-kernel-arm-linux-gcc -C /opt

    vim .basgrc 在最後面添加
    
    export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.9/bin:$PATH
    
    用arm-linux-gnueabihf-g++ -v 會提示找不到文件或路徑
    
    我用的是Ubuntu16.04 x64, 需要下載32位庫,百度。
    
    配置成功後: arm-linux-gnueabihf-g++ -v 可以看到版本信息

二、qt5.9 arm-qmake 

    1、qt-everywhere-opensource-src-5.9.0/qtbase/mkspecs$ cp -r  linux-arm-gnueabi-g++/ linux-arm-gnueabihf-g++/
    
    2、修改linux-arm-gnueabihf-g++ qmake.conf 爲
    
    #
    # qmake configuration for building with arm-linux-gnueabihf-g++
    #

    MAKEFILE_GENERATOR      = UNIX
    CONFIG                 += incremental
    QMAKE_INCREMENTAL_STYLE = sublib

    include(../common/linux.conf)
    include(../common/gcc-base-unix.conf)
    include(../common/g++-unix.conf)

    # modifications to g++.conf
    QMAKE_CC                = arm-linux-gnueabihf-gcc
    QMAKE_CXX               = arm-linux-gnueabihf-g++
    QMAKE_LINK              = arm-linux-gnueabihf-g++
    QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++

    # modifications to linux.conf
    QMAKE_AR                = arm-linux-gnueabihf-ar cqs
    QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
    QMAKE_NM                = arm-linux-gnueabihf-nm -P
    QMAKE_STRIP             = arm-linux-gnueabihf-strip
    load(qt_config)
    
    3、 ./configure --prefix=/usr/local/qt5.9-arm-linux -opensource -release -shared -xplatform linux-arm-gnueabihf-g++ -no-opengl -nomake examples
    
    4、        make 時會有錯誤提醒
            1、
            .obj/qgeotiledmapscene.o:qgeotiledmapscene.cpp:function QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode*, QGeoTiledMapScenePrivate*, double, QQuickWindow*, bool): error: undefined reference to 'QSGDefaultImageNode::setAnisotropyLevel(QSGTexture::AnisotropyLevel)'
            collect2: error: ld returned 1 exit status
            Makefile:671: recipe for target '../../lib/libQt5Location.so.5.9.0' failed
            make[3]: *** [../../lib/libQt5Location.so.5.9.0] Error 1
            make[3]: Leaving directory '/home/wgd/src/qt-everywhere-opensource-src-5.9.0/qtlocation/src/location'
            Makefile:152: recipe for target 'sub-location-make_first' failed
            make[2]: *** [sub-location-make_first] Error 2
            make[2]: Leaving directory '/home/wgd/src/qt-everywhere-opensource-src-5.9.0/qtlocation/src'
            Makefile:47: recipe for target 'sub-src-make_first' failed
            make[1]: *** [sub-src-make_first] Error 2
            make[1]: Leaving directory '/home/wgd/src/qt-everywhere-opensource-src-5.9.0/qtlocation'
            Makefile:891: recipe for target 'module-qtlocation-make_first' failed
            make: *** [module-qtlocation-make_first] Error 2
            解決屏蔽如下
            ~/src/qt-everywhere-opensource-src-5.9.0$ vim qtlocation/src/location/maps/qgeotiledmapscene.cpp 
            
            609 /*********
            610                 if (ogl)
            611                     static_cast<QSGDefaultImageNode *>(node)->setAnisotropyLevel(QSGTexture::Anisotropy16x);
            612 **********/
            613                 dirtyBits |= QSGNode::DirtyMaterial;
            614             }
            615             if (dirtyBits != 0)
            616                 node->markDirty(dirtyBits);
            617             it++;
            618         }
            619     }
            620 
            621     for (const QGeoTileSpec &s : toAdd) {
            622         QGeoTileTexture *tileTexture = d->m_textures.value(s).data();
            623         if (!tileTexture || tileTexture->image.isNull())
            624             continue;
            625         QSGImageNode *tileNode = window->createImageNode();
            626         // note: setTexture will update coordinates so do it here, before we buildGeometry
            627         tileNode->setTexture(textures.value(s));
            628         if (d->buildGeometry(s, tileNode, overzooming)
            629                 && qgeotiledmapscene_isTileInViewport(tileNode->rect(), root->matrix(), straight)) {
            630             if (tileNode->texture()->textureSize().width() > d->m_tileSize * pixelRatio) {
            631                 tileNode->setFiltering(QSGTexture::Linear); // with mipmapping QSGTexture::Nearest generates artifacts
            632                 tileNode->setMipmapFiltering(QSGTexture::Linear);
            633             } else {
            634                 tileNode->setFiltering((d->m_linearScaling || overzooming) ? QSGTexture::Linear : QSGTexture::Nearest);
            635             }
            636 /**********
            637             if (ogl)
            638                 static_cast<QSGDefaultImageNode *>(tileNode)->setAnisotropyLevel(QSGTexture::Anisotropy16x);
            639 **********/
            
            2、錯誤
            include/mbgl/gl/gl.hpp:30:23: fatal error: GL/gl.h: No such file or directory
            #include <GL/gl.h>
                               ^
            compilation terminated.
            Makefile:18337: recipe for target '.obj/attribute.o' failed
            make[5]: *** [.obj/attribute.o] Error 1
            
            解決            
            ~/src/qt-everywhere-opensource-src-5.9.0$ vim qtlocation/src/plugins/plugins.pro 
            TEMPLATE = subdirs
            qtHaveModule(positioning): SUBDIRS +=  position
            #qtHaveModule(location): SUBDIRS += geoservices
            
    5、make -j4
    
    6、sudo make install
                                            
    

    

詳細配置。static

./configure -prefix /opt/qt-4.8.7-arm -release -opensource -confirm-license -static -fast -no-largefile -no-exceptions -no-accessibility -no-stl -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -qt-freetype -no-gif -no-libtiff -qt-libpng -no-libmng -qt-libjpeg -no-openssl -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -no-nis -no-cups -no-iconv -no-pch -no-dbus -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-arm-gnueabihf-g++ -no-gtkstyle -no-nas-sound -no-opengl -no-openvg -no-sm -no-xshape -no-xvideo -no-xsync -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-mitshm -no-fontconfig -no-xinput -no-xkb -no-glib -qt-gfx-linuxfb -no-mouse-tslib -qt-kbd-linuxinput -no-mmx -no-3dnow -no-sse -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx

 

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