Results 1 to 14 of 14

Thread: Generate a correct makefile

  1. #1
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Generate a correct makefile

    Hi all,
    my problem is t write a correct qmake.conf file to avoid to point to /usr/lib and /usr/include files cause otherwise the crosscompilation mixes some files..

    Which directive i need to overwrite/define to point only cross libs and includes ?

    Thanks
    SteM

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    cause otherwise the crosscompilation mixes some files
    Could you explain what do you mean by that?
    The reason I ask is, that the qmake.conf has the qt configuration on your system.
    So if you want to cross compile on the same system for other arhchs, then the files for those other archs will *HAVE* to be located in other locations as the ones for the current system.
    So how could they be mixed up?
    For example:
    if you have on your current system:
    #include <somesysheader.h>

    then the header for the other archs will have to be somewhere else.
    So in your code you will have to:
    #include <otherarch/somesysheader.h>

    Usually an #ifdef clauses are used to select the correct includes.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    I'm sorry, my message was not so clear ....
    I created a custom mkspec/linux-somethig/* files.
    When i run qmake command and i take a look to the generated Makefile, i always see the inclusion of /usr/include/ and /usr/lib/ paths, even if i didn't write them into the .conf file !

    How can i overwrite o modify this setting ?
    I do not inculde any other conf file ..

    Thanks
    SteM

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    how did you call qmake do use your custom conf file?
    Any way, have a look at QMAKESPEC.
    http://doc.trolltech.com/4.2/qmake-v...html#qmakespec

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Generate a correct makefile

    /usr/lib and /usr/include is a standard (hardcoded?) path to look for libs/headers in your system/compiler, so it might be hard getting rid of it. You can try doing it by not including any of the standard files, but to do that, your specs can't be called linux-something but falafel-something (to make sure linux files won't be included).

  6. #6
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Generate a correct makefile

    /usr/lib and /usr/include are the standard location for libc. This is vitally necessary for any C/C++ application, including Qt applications.

  7. #7
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    Thanks for your attentions.

    Sorry, a step backward ...

    When i cross-compile QT for my toolchain i created a new qmake.conf to notify the path and the name of the cross compiler and then i included linux.conf file.
    I saw on console that the compiler is the wanted one but in the compiler command line there are some references to /usr/local/Trolltech/Qt-4.2.2/ path: for example:
    -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtNetwork
    which are the files compiled for the host machine !

    My questions are:
    - is the reference correct for the crosscompilation?
    - or do i need to point out the original qt sources installation path (on /tmp/qt-commercial-xxxxx/)?
    In the case, do i need to change the variables:
    QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
    QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    ???

    Thansk again.
    SteM

  8. #8
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    Example:
    Crosscompiling QT i see (one of many ..):


    Qt Code:
    1. /opt/montavista/pro/devkit/x86/586/bin/586-g++
    2. -c -pipe -g
    3. -I/opt/firebird/include
    4. -I/usr/include/glib-2.0
    5. -I/usr/lib/glib-2.0/include
    6. -O2 -fvisibility=hidden -fvisibility-inlines-hidden
    7. -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_EDITION=QT_EDITION_DESKTOP
    8. -DQT_BUILD_GUI_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
    9. -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_RASTER_IMAGEENGINE -DQT_HAVE_SSE
    10. -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSXP -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG
    11. -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
    12. -I../../mkspecs/linux-montavista
    13. -I.
    14. -I../../include/QtCore
    15. -I../../include/QtCore
    16. -I../../include
    17. -I../../include/QtGui
    18. -I/usr/include/freetype2
    19. -I../3rdparty/harfbuzz/src
    20. -I.moc/release-shared
    21. -I/usr/X11R6/include
    22. -I.uic/release-shared
    23. -o .obj/release-shared/qguivariant.o kernel/qguivariant.cpp
    24.  
    25. cc1plus: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation
    26. cc1plus: warning: include location "/usr/include/freetype2" is unsafe for cross-compilation
    27. cc1plus: warning: include location "/usr/X11R6/include" is unsafe for cross-compilation
    To copy to clipboard, switch view to plain text mode 

    I need to remove the options:
    -I/usr/include/glib-2.0
    -I/usr/lib/glib-2.0/include
    -I/usr/X11R6/include
    and so on ....

    Thanks!
    SteM

  9. #9
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    did you try what theLSB suggested in his last post?
    QMAKESPEC

    This variable contains the name of the qmake configuration to use when generating Makefiles. The value of this variable is typically handled by qmake and rarely needs to be modified. Use the QMAKESPEC environment variable instead.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  10. #10
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    For the application i simply used:
    qmake -spec linux-montavista

    Compiling QT i used the following:
    ./configure -qt-gif -no-rpath -plugin-sql-ibase -platform linux-montavista -prefix /root/workspace/qt -I/opt/firebird/include -L/tmp2/qt_compil


    My qmake.conf is:
    Qt Code:
    1. #
    2. # qmake configuration for linux-montavista
    3. # by SM
    4. #
    5.  
    6. MAKEFILE_GENERATOR = UNIX
    7. TEMPLATE = app
    8. CONFIG += qt warn_on release incremental link_prl
    9. QT += core gui
    10. QMAKE_INCREMENTAL_STYLE = sublib
    11.  
    12. include(montavista.conf)
    13.  
    14.  
    15. #include(../common/linux.conf)
    16. #Riportato e modificato qui sotto
    17. # --- BEGIN
    18.  
    19. X11_PATH = /opt/montavista/pro/devkit/x86/586/target/usr/X11R6
    20.  
    21. QMAKE_CFLAGS_THREAD += -D_REENTRANT
    22. QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
    23.  
    24. QMAKE_INCDIR =
    25. QMAKE_LIBDIR =
    26. QMAKE_INCDIR_X11 = $(X11_PATH)/include
    27. #/usr/X11R6/include
    28. QMAKE_LIBDIR_X11 = $(X11_PATH)/lib
    29. #/usr/X11R6/lib
    30.  
    31. QMAKE_INCDIR_QT = /tmp2/qt-x11-commercial-src-4.2.2/include
    32. #$$[QT_INSTALL_HEADERS]
    33.  
    34. QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    35.  
    36. QMAKE_INCDIR_OPENGL = $(X11_PATH)/include
    37. #/usr/X11R6/include
    38.  
    39. QMAKE_LIBDIR_OPENGL = $(X11_PATH)/lib
    40. #/usr/X11R6/lib
    41.  
    42. QMAKE_LIBS =
    43. QMAKE_LIBS_DYNLOAD = -ldl
    44. QMAKE_LIBS_X11 = -lXext -lX11 -lm
    45. QMAKE_LIBS_X11SM = -lSM -lICE
    46. QMAKE_LIBS_NIS = -lnsl
    47. QMAKE_LIBS_OPENGL = -lGLU -lGL
    48. QMAKE_LIBS_OPENGL_QT = -lGL
    49. QMAKE_LIBS_THREAD = -lpthread
    50.  
    51. QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
    52. QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
    53.  
    54. QMAKE_AR = ar cqs
    55. QMAKE_RANLIB =
    56.  
    57. QMAKE_TAR = tar -cf
    58. QMAKE_GZIP = gzip -9f
    59.  
    60. QMAKE_COPY = cp -f
    61. QMAKE_COPY_FILE = $(COPY)
    62. QMAKE_COPY_DIR = $(COPY) -r
    63. QMAKE_MOVE = mv -f
    64. QMAKE_DEL_FILE = rm -f
    65. QMAKE_DEL_DIR = rmdir
    66. QMAKE_STRIP = strip
    67. QMAKE_STRIPFLAGS_LIB += --strip-unneeded
    68. QMAKE_CHK_DIR_EXISTS = test -d
    69. QMAKE_MKDIR = mkdir -p
    70. QMAKE_INSTALL_FILE = install -m 644 -p
    71. QMAKE_INSTALL_PROGRAM = install -m 755 -p
    72. # --- END
    73.  
    74. load(qt_config)
    To copy to clipboard, switch view to plain text mode 
    SteM

  11. #11
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    I inserted the Qt package on my virtual machine based on the MontaVista Linux, just to avoid to handle a cross compile.
    If I run the command:

    ./configure -qt-gif -no-rpath

    This is the Qt/X11 Desktop Edition.

    You are licensed to use this software under the terms of
    the Qt COMMERCIAL LICENSE AGREEMENT.

    Type '?' to view the Qt COMMERCIAL LICENSE AGREEMENT.
    Type 'yes' to accept this license offer.
    Type 'no' to decline this license offer.

    Do you accept the terms of the Qt COMMERCIAL LICENSE AGREEMENT? yes

    Creating qmake. Please wait...
    g++ -c -o qlibraryinfo.o -pipe -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -I/opt/qt-x11-commercial-src-4.2.2/src/corelib/arch/generic -I/opt/qt-x11-commercial-src-4.2.2/include -I/opt/qt-x11-commercial-src-4.2.2/include/QtCore -I/opt/qt-x11-commercial-src-4.2.2/include -I/opt/qt-x11-commercial-src-4.2.2/include/QtCore -I/opt/qt-x11-commercial-src-4.2.2/src/corelib/global -I/opt/qt-x11-commercial-src-4.2.2/src/3rdparty/md5 -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_BUILD_QMAKE -DQT_NO_COMPRESS -I/opt/qt-x11-commercial-src-4.2.2/mkspecs/linux-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp
    In file included from /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp:37:
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:2:67: warning: missing terminating " character
    In file included from /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp:37:
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:2: error: missing terminating " character
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    ...
    ...
    ./configure -qt-gif -no-rpath

    This is the Qt/X11 Desktop Edition.

    You are licensed to use this software under the terms of
    the Qt COMMERCIAL LICENSE AGREEMENT.

    Type '?' to view the Qt COMMERCIAL LICENSE AGREEMENT.
    Type 'yes' to accept this license offer.
    Type 'no' to decline this license offer.

    Do you accept the terms of the Qt COMMERCIAL LICENSE AGREEMENT? yes

    Creating qmake. Please wait...
    g++ -c -o qlibraryinfo.o -pipe -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -I/opt/qt-x11-commercial-src-4.2.2/src/corelib/arch/generic -I/opt/qt-x11-commercial-src-4.2.2/include -I/opt/qt-x11-commercial-src-4.2.2/include/QtCore -I/opt/qt-x11-commercial-src-4.2.2/include -I/opt/qt-x11-commercial-src-4.2.2/include/QtCore -I/opt/qt-x11-commercial-src-4.2.2/src/corelib/global -I/opt/qt-x11-commercial-src-4.2.2/src/3rdparty/md5 -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_BUILD_QMAKE -DQT_NO_COMPRESS -I/opt/qt-x11-commercial-src-4.2.2/mkspecs/linux-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp
    In file included from /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp:37:
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:2:67: warning: missing terminating " character
    In file included from /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qlibraryinfo.cpp:37:
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:2: error: missing terminating " character
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    /opt/qt-x11-commercial-src-4.2.2/src/corelib/global/qconfig.cpp:3: error: stray '\' in program
    I opened the qconfig.cpp file and i discovered it was generated in a wrong way:

    Qt Code:
    1. more src/corelib/global/qconfig.cpp
    2. /* License Info */
    3. \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
    4. \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
    5. \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
    6. \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
    To copy to clipboard, switch view to plain text mode 

    It is missing the inital part with the name of a variable !!!?!?!?!?


    Crosscompilation or not i'm not able to build QT libraries !!
    Last edited by jacek; 19th October 2007 at 20:40. Reason: changed [code] to [quote]
    SteM

  12. #12
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    It seems you have a commercial license.
    Did you contact the TT help desk?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  13. #13
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate a correct makefile

    I do not have the direct contact with the TT help desk, i will try to contact Technical Manager of my company in US ...

    Then i return to crosscompilation issues:
    what about the reported problems ?? :-(
    Does my qmake.conf seem to be correct ?
    SteM

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Generate a correct makefile

    qmake.conf is only a part of configuration files used by qmake, so it's really hard to say.

Similar Threads

  1. not able to change Makefile
    By shamik in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2007, 12:00
  2. Replies: 5
    Last Post: 13th March 2006, 20:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.