Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error in Build qtdeclarative module



  • I cross compile QT 5.6 from this link
    for Raspberry pi on Ubuntu 14.04
    I get the module with:
    git clone git://code.qt.io/qt/qtdeclarative.git -b 5.6

    and when make it I get these error :

    items/qquicktextcontrol.cpp:1289:14: error: missing binary operator before token "("
     #if QT_CONFIG(im)
                  ^
    items/qquicktextcontrol.cpp:1572:14: error: missing binary operator before token "("
     #if QT_CONFIG(clipboard)
                  ^
    items/qquicktextcontrol.cpp:1622:14: error: missing binary operator before token "("
     #if QT_CONFIG(texthtmlparser)
                  ^
    items/qquicktextcontrol.cpp:1712:14: error: missing binary operator before token "("
     #if QT_CONFIG(im)
                  ^
    items/qquicktextcontrol.cpp:1774:14: error: missing binary operator before token "("
     #if QT_CONFIG(texthtmlparser)
                  ^
    items/qquicktextcontrol.cpp:1801:14: error: missing binary operator before token "("
     #if QT_CONFIG(im)
                  ^
    items/qquicktextcontrol.cpp:1818:14: error: missing binary operator before token "("
     #if QT_CONFIG(textodfwriter)
                  ^
    items/qquicktextcontrol.cpp:1836:14: error: missing binary operator before token "("
     #if QT_CONFIG(texthtmlparser)
                  ^
    items/qquicktextcontrol.cpp:1839:14: error: missing binary operator before token "("
     #if QT_CONFIG(textodfwriter)
    .
    .
    .
    .
    

    from qquicktextcontrol class ,is it need a library?,qinputcontorl library is not recognize by it and I add complete address in header file
    I change <QtGui/private/qinputcontrol_p.h>
    to </home/ubuntu/qtbase/include/QtGui/5.6.0/QtGui/private/qinputcontrol_p.h>
    so it can find the library
    the header is this
    and this
    and this is .cpp
    what library is this class need?or need to define complete address?
    #if QT_CONFIG(......) is use like below:

    #include "qquicktextcontrol_p.h"
    #include "qquicktextcontrol_p_p.h"
    #ifndef QT_NO_TEXTCONTROL
    #include <qcoreapplication.h>
    #include <qfont.h>
    #include <qfontmetrics.h>
    #include <qevent.h>
    #include <qdebug.h>
    #include <qclipboard.h>
    #include <qtimer.h>
    #include <qinputmethod.h>
    #include "private/qtextdocumentlayout_p.h"
    #include "private/qabstracttextdocumentlayout_p.h"
    #include "qtextdocument.h"
    #include "private/qtextdocument_p.h"
    #include "qtextlist.h"
    #include "qtextdocumentwriter.h"
    #include "private/qtextcursor_p.h"
    #include <QtCore/qloggingcategory.h>
    #include <qtextformat.h>
    #include <qdatetime.h>
    #include <qbuffer.h>
    #include <qguiapplication.h>
    #include <limits.h>
    #include <qtexttable.h>
    #include <qvariant.h>
    #include <qurl.h>
    #include <qstylehints.h>
    #include <qmetaobject.h>
    #include <private/qqmlglobal_p.h>
    // ### these should come from QStyleHints
    const int textCursorWidth = 1;
    QT_BEGIN_NAMESPACE
    Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)
    // could go into QTextCursor...
    static QTextLine currentTextLine(const QTextCursor &cursor)
    {
        const QTextBlock block = cursor.block();
        if (!block.isValid())
            return QTextLine();
        const QTextLayout *layout = block.layout();
        if (!layout)
            return QTextLine();
        const int relativePos = cursor.position() - block.position();
        return layout->lineForTextPosition(relativePos);
    }
    QQuickTextControlPrivate::QQuickTextControlPrivate()
        : doc(nullptr),
    #if QT_CONFIG(im)
          preeditCursor(0),
    #endif
          interactionFlags(Qt::TextEditorInteraction),
          cursorOn(false),
          cursorIsFocusIndicator(false),
          mousePressed(false),
          lastSelectionState(false),
          ignoreAutomaticScrollbarAdjustement(false),
          overwriteMode(false),
          acceptRichText(true),
          cursorVisible(false),
          cursorBlinkingEnabled(false),
          hasFocus(false),
          hadSelectionOnMousePress(false),
          wordSelectionEnabled(false),
          hasImState(false),
          cursorRectangleChanged(false),
          lastSelectionStart(-1),
          lastSelectionEnd(-1)
    {}
    bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
    {
    #if !QT_CONFIG(shortcut)
        Q_UNUSED(e);
    #endif
        Q_Q(QQuickTextControl);
        if (cursor.isNull())
            return false;
        const QTextCursor oldSelection = cursor;
        const int oldCursorPos = cursor.position();
        QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
        QTextCursor::MoveOperation op = QTextCursor::NoMove;
        if (false) {
        }
    #if QT_CONFIG(shortcut)
        if (e == QKeySequence::MoveToNextChar) {
                op = QTextCursor::Right;
        }
        else if (e == QKeySequence::MoveToPreviousChar) {
                op = QTextCursor::Left;
        }
        else if (e == QKeySequence::SelectNextChar) {
               op = QTextCursor::Right;
               mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectPreviousChar) {
                op = QTextCursor::Left;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectNextWord) {
                op = QTextCursor::WordRight;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectPreviousWord) {
                op = QTextCursor::WordLeft;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectStartOfLine) {
                op = QTextCursor::StartOfLine;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectEndOfLine) {
                op = QTextCursor::EndOfLine;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectStartOfBlock) {
                op = QTextCursor::StartOfBlock;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectEndOfBlock) {
                op = QTextCursor::EndOfBlock;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectStartOfDocument) {
                op = QTextCursor::Start;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectEndOfDocument) {
                op = QTextCursor::End;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectPreviousLine) {
                op = QTextCursor::Up;
                mode = QTextCursor::KeepAnchor;
        }
        else if (e == QKeySequence::SelectNextLine) {
                op = QTextCursor::Down;
                mode = QTextCursor::KeepAnchor;
                {
                    QTextBlock block = cursor.block();
                    QTextLine line = currentTextLine(cursor);
                    if (!block.next().isValid()
                        && line.isValid()
                        && line.lineNumber() == block.layout()->lineCount() - 1)
                        op = QTextCursor::End;
                }
        }
    ....
    

  • Moderators

    @isan said in Error in Build qtdeclarative module:

    I get the module with:
    git clone git://code.qt.io/qt/qtdeclarative.git -b 5.6

    You have to check out whole Qt repo, and run the init-repository script, then configure. Otherwise other modules won't compile - they all depend on qtbase.

    If you want to save some time, pick the Qt tarball, then you don't need to init-repository (but configure is still required).



  • @sierdzio how should I run the init-repository script? and what is Qt tarball?


  • Moderators

    @isan said in Error in Build qtdeclarative module:

    @sierdzio how should I run the init-repository script?

    Here is the full guide: https://wiki.qt.io/Building_Qt_5_from_Git

    and what is Qt tarball?

    The .tar.xz file in the archive. Here is one for Qt 5.11.1, for example: https://download.qt.io/official_releases/qt/5.11/5.11.1/single/



  • @sierdzio I cross compile QT before from this link

    And I want to add qml quick module with this

    git clone git://code.qt.io/qt/<qt-module>.git -b <qt-version>
    cd <qt-module>
    
    ~/raspi/qt5/bin/qmake -r
    make
    make install
    

    That said In this guide, I've added qtmultimedia and qtcharts,..... and it's OK


  • Moderators

    @isan said in Error in Build qtdeclarative module:

    @sierdzio I cross compile QT before from this link

    And I want to add qml quick module with this

    git clone git://code.qt.io/qt/<qt-module>.git -b <qt-version>
    cd <qt-module>
    
    ~/raspi/qt5/bin/qmake -r
    make
    make install
    

    That said In this guide, I've added qtmultimedia and qtcharts,..... and it's OK

    OK if you say so. I always build them all in one go, it feels safer. I don't know how to help you, then.



  • @sierdzio so thank you,I think It need correct library address or new library



  • Also I add #include </home/ubuntu/qtbase/src/corelib/global/qglobal.h> to headers of qquicktextcontrol class beacuse use QT_USE_NAMESPACE in class but still I get errors


  • Moderators

    @isan said in Error in Build qtdeclarative module:

    Also I add #include </home/ubuntu/qtbase/src/corelib/global/qglobal.h> to headers of qquicktextcontrol class beacuse use QT_USE_NAMESPACE in class but still I get errors

    I'd still recommend just compiling whole Qt from git or tarball. It is possible that the errors you are seeing stem from missing configuration.

    See my last post here: https://forum.qt.io/topic/91846/qwt-from-windows-to-linux-porting/20 for a ready script to download and cross-compile.



  • I get the module from https://download.qt.io/archive/qt/5.6/5.6.0/submodules/
    instead of http://code.qt.io/qt/qtdeclarative.git
    and extract in ~/raspi/
    then I do

    cd <qt-module>
    git clean -dfx
    ~/raspi/qt5/bin/qmake -r
    make
    make install
    

    and it is work for me with no error


Log in to reply