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
Re: Generate a correct makefile
Quote:
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.
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
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
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).
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.
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.
Re: Generate a correct makefile
Example:
Crosscompiling QT i see (one of many ..):
Code:
/opt/montavista/pro/devkit/x86/586/bin/586-g++
-c -pipe -g
-I/opt/firebird/include
-I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include
-O2 -fvisibility=hidden -fvisibility-inlines-hidden
-Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_EDITION=QT_EDITION_DESKTOP
-DQT_BUILD_GUI_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
-DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_RASTER_IMAGEENGINE -DQT_HAVE_SSE
-DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSXP -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG
-DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
-I../../mkspecs/linux-montavista
-I.
-I../../include/QtCore
-I../../include/QtCore
-I../../include
-I../../include/QtGui
-I/usr/include/freetype2
-I../3rdparty/harfbuzz/src
-I.moc/release-shared
-I/usr/X11R6/include
-I.uic/release-shared
-o .obj/release-shared/qguivariant.o kernel/qguivariant.cpp
cc1plus: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation
cc1plus: warning: include location "/usr/include/freetype2" is unsafe for cross-compilation
cc1plus: warning: include location "/usr/X11R6/include" is unsafe for cross-compilation
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!
Re: Generate a correct makefile
did you try what theLSB suggested in his last post?
Quote:
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.
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:
Code:
#
# qmake configuration for linux-montavista
# by SM
#
MAKEFILE_GENERATOR = UNIX
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(montavista.conf)
#include(../common/linux.conf)
#Riportato e modificato qui sotto
# --- BEGIN
X11_PATH = /opt/montavista/pro/devkit/x86/586/target/usr/X11R6
QMAKE_CFLAGS_THREAD += -D_REENTRANT
QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
QMAKE_INCDIR =
QMAKE_LIBDIR =
QMAKE_INCDIR_X11 = $(X11_PATH)/include
#/usr/X11R6/include
QMAKE_LIBDIR_X11 = $(X11_PATH)/lib
#/usr/X11R6/lib
QMAKE_INCDIR_QT = /tmp2/qt-x11-commercial-src-4.2.2/include
#$$[QT_INSTALL_HEADERS]
QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
QMAKE_INCDIR_OPENGL = $(X11_PATH)/include
#/usr/X11R6/include
QMAKE_LIBDIR_OPENGL = $(X11_PATH)/lib
#/usr/X11R6/lib
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_X11SM = -lSM -lICE
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_OPENGL = -lGLU -lGL
QMAKE_LIBS_OPENGL_QT = -lGL
QMAKE_LIBS_THREAD = -lpthread
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
QMAKE_AR = ar cqs
QMAKE_RANLIB =
QMAKE_TAR = tar -cf
QMAKE_GZIP = gzip -9f
QMAKE_COPY = cp -f
QMAKE_COPY_FILE = $(COPY)
QMAKE_COPY_DIR = $(COPY) -r
QMAKE_MOVE = mv -f
QMAKE_DEL_FILE = rm -f
QMAKE_DEL_DIR = rmdir
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
QMAKE_CHK_DIR_EXISTS = test -d
QMAKE_MKDIR = mkdir -p
QMAKE_INSTALL_FILE = install -m 644 -p
QMAKE_INSTALL_PROGRAM = install -m 755 -p
# --- END
load(qt_config)
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:
Quote:
./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:
Code:
more src/corelib/global/qconfig.cpp
/* License Info */
\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
\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
\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
\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";
It is missing the inital part with the name of a variable !!!?!?!?!?
:mad: Crosscompilation or not i'm not able to build QT libraries !! :mad:
Re: Generate a correct makefile
It seems you have a commercial license.
Did you contact the TT help desk?
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 ?
Re: Generate a correct makefile
qmake.conf is only a part of configuration files used by qmake, so it's really hard to say.