I compiled qt 4.8.5 for CentOS 6.4. Everything works perfectly. When I am compiling other libraries using this compiled qt version is compiling as long as I keep the installer folder in the same location. If I move the installer folder in another location, then I get the following errors:
cd common/ && make -f Makefile
make[1]: Entering directory `/path/MashLab/meshlab/src/common'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DGLEW_STATIC -DQT_NO_DEBUG -DQT_SCRIPT_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../qt/install_dir/mkspecs/linux-g++-64 -I. -I/path/qt/install/include/QtCore -I/path/qt/install/include/QtGui -I/path/qt/install/include/QtOpenGL -I/path/qt/install/include/QtXml -I/path/qt/install/include/QtXmlPatterns -I/path/qt/install/include/QtScript -I/path/qt/install/include -I../.. -I../../../vcglib -I../external/glew-1.7.0/include -I. -I../external/jhead-2.95 -I/usr/X11R6/inc
lude -I. -o filterparameter.o filterparameter.cpp
filterparameter.cpp:24:18: error: QtCore: No such file or directory
filterparameter.cpp:25:16: error: QMap: No such file or directory
filterparameter.cpp:26:17: error: QPair: No such file or directory
filterparameter.cpp:27:19: error: QAction: No such file or directory
It's still searching for the libs and includes in the path where it was installed even if I export the environment variables to the new location:
$: export QMAKESPEC=/path/qt/install_dir/mkspecs/linux-g++-64
$: export QTLIB=/path/qt/install_dir/lib
$: export QTINC=/path/qt/install_dir/include
$: export QTDIR=/path/qt/install_dir
installed location: /path/qt/install
new location: /path/qt/install_dir
Question: Is there a way (some arguments) which you can compile qt and use dynamic paths of libs/includes?
With Qt >= 5.3 create a qt.conf next to where qmake is (e.g. /path/qt/install_dir/bin/qt.conf)
[Paths]
Prefix = ..
If this doesn't work, check which at path qmake is looking for qt.conf with
strace qmake -query 2>&1 | grep qt.conf
Related
I'm using a custom ressource management (in replacement to qrc) and I'm trying to integrate it to QtCreaor.
I have a Python script that generates a source file to be compiled. I use QMAKE_EXTRA_TARGETS/PRE_TARGETDEPS to tell QMake that this script must be executed before files are compiled. So I do, in my pro file:
CONFIG += ordered
generated_file.target = my_custom_target
generated_file.commands = echo "Generating..." && d:/dev/vobs_ext_2015/tools_ext/python/Python34_light/python.exe $$PWD/pyc_res_generator.py -o $$PWD/generated/generated.cpp && echo "Generated!"
generated_file.depends = FORCE
QMAKE_EXTRA_TARGETS += generated_file
PRE_TARGETDEPS += my_custom_target
SOURCES += generated/generated.cpp
#DEPENDPATH = ./generated
With pyc_res_generator.py simply being:
#! /usr/bin/env python
# -*- coding: utf8 *-*
import argparse
parser = argparse.ArgumentParser(description="", formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("-o", type=str, help="Output file name")
args = parser.parse_args()
with open(args.o, 'w') as output_file:
output_file.write( "// This is valid C++!" )
To test this, I write some invalid C++ in generated.cpp (like fjkfkfk). When I compile (target is Android), I see in the log:
echo Generating... && python.exe pyc_res_generator.py -o generated/generated.cpp && echo Generated!
Generating...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o main.obj ..\TestQt\main.cpp
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o dialog.obj ..\TestQt\dialog.cpp
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o generated.obj ..\TestQt\generated\generated.cpp
B:\QtCreator5_6_1\5.6\android_armv7\bin\moc.exe -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IB:/QtCreator5_6_1/5.6/android_armv7/mkspecs/android-g++ -IC:/Users/jp225611/Documents/TestQt -IB:/QtCreator5_6_1/5.6/android_armv7/include -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtWidgets -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtGui -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtCore -I. -IB:\Android\android-ndk-r11b/sources/cxx-stl/gnu-libstdc++/4.9/include -IB:\Android\android-ndk-r11b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IB:\Android\android-ndk-r11b/platforms/android-9/arch-arm//usr/include ..\TestQt\dialog.h -o moc_dialog.cpp
..\TestQt\generated\generated.cpp:1:1: error: 'fjkfkfk' does not name a type
// This is valid C++!
^
makefile:670: recipe for target 'generated.obj' failed
mingw32-make: *** [generated.obj] Error 1
mingw32-make: *** Waiting for unfinished jobs....
Generated!
13:59:08: Le processus "B:\QtCreator5_6_1\Tools\mingw492_32\bin\mingw32-make.exe" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet TestQt (kit : android_armeabi-v7a)
When executing step "Make"
13:59:08: Temps écoulé : 00:03.
And I see that generated\generated.cpp was correctly generated by pyc_res_generator.py (it now contains // This is valid C++!)...but apparently too lately as the compiler saw fjkfkfk...
As you can see, the output reports:
Generating...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ .... ..\TestQt\generated\generated.cpp
Generated...
While one would expect:
Generating...
Generated...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ .... ..\TestQt\generated\generated.cpp
This only occurs when parallel builds are enabled (I set MAKEFLAGS environment variable to '-j8`)
It looks like my custom command generated_file is started before generated\generated.cpp is compiled, but the system does not wait for it to end before actually compiling generated\generated.cpp.
Am I doing something wrong?
PRE_TARGETDEPS (custom targets) is not the good approach here as generated_file.target must match exactly the Makefile target name which may be vary on different options:
shadow build enabled or not
host platform (using slashs or backslash as a folder separator)
probably targetted compiler/platform
However, custom compiler apparently works much better. That's how moccing files is done. A custom compiler can generate a new file to be compiled (and then the system waits for the file to be generated before compiling it, even when performing parallel builds).
# Set fuiles to be generated in a variable
TO_GENERATE = $$PWD/generated/generated.cpp
# Specify custom command output file:
custom_generator.output = $$PWD/generated/generated.cpp
# Specify custom command:
custom_generator.commands = 'echo "Generating..." && python $$PWD/pyc_res_generator.py -o $$PWD/generated/generated.cpp && echo "Generated..."'
# dependency:
custom_generator.depends = FORCE
# link to input file variable
custom_generator.input = TO_GENERATE
# link to variable to store generated file to
custom_generator.variable_out = SOURCES
# add to qmake:
QMAKE_EXTRA_COMPILERS += custom_generator
Then, you don't even need to specify SOURCES += $$PWD/generated/generated.cpp. And also, $$PWD/generated/generated.cpp gets deleted upon clean!
This works perfectly as expected!
You need to set the name of the target to the name of the file that it generates. Here's a full project file that works for me (qmake 3.1, Qt 5.10.1):
# Filename relative to the *build* directory.
generated_file.target = generated/generated.cpp
generated_file.commands = 'echo "Generating..." && mkdir -p generated && echo "int main() {}" > generated/generated.cpp'
generated_file.depends = FORCE
QMAKE_EXTRA_TARGETS += generated_file
# Filename relative to the *source* directory.
SOURCES += $$OUT_PWD/generated/generated.cpp
The reason is that generated_file.target becomes the name of the target in the Makefile, so when generated.cpp is needed, your custom rule will be executed to create the file.
You can also remove it from PRE_TARGETDEPS, because you're already adding the generated file to SOURCES instead, which creates the proper dependency.
Note that this approach generates the file in the build directory, not the source directory. This is why you need to specify $$OUT_PWD when adding it to SOURCES: by default, qmake seems to assume that SOURCES are relative to the source directory.
If you want to generate it in the source directory instead, you might think that you just prefix $$PWD everywhere, but then qmake sometimes uses absolute paths and sometimes relative, and everything fails. You can probably work around that with $$absolute_path($$PWD) but I haven't tried.
Relevant sections from the generated Makefile (comments are mine):
# How to create generated/generated.cpp.
# Depending on FORCE to make it always stale (fails if you create a file named FORCE :)).
generated/generated.cpp: FORCE
echo "Generating..." && mkdir -p generated && echo "int main() {}" > generated/generated.cpp
# generated.o depends on generated/generated.cpp.
# Note that it's not in the same directory; we don't care.
generated.o: generated/generated.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o generated.o generated/generated.cpp
# The final executable depends on the compiled generated.o.
OBJECTS = generated.o
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
The qmake documentation is pretty vague about this, only stating that target should be "The name of the custom build target.". However, the example shows that they're setting it to the name of the output file. (As a bonus, it also shows how to not repeat that name in the commands.)
An alternative relies on the TEMPLATE=subdirs, to honour libname.depends in a parallel build environment. You would need two .pro files in each application folder. And one in the shared library folder. Any other folders in your development area that use TEMPLATE=subdirs need to be made compatible.
eg TestApp using LibLarry.
Folder TestApp has
bld.pro and TestApp.pro.
TestApp.pro:
#This is a TEMPLATE=subdirs, which gmake will interpret;
# making sure the build dependencies are respected
TEMPLATE = subdirs
SUBDIRS += bld mylib
bld.file = bld.pro
bld.depends = mylib # force library to be built first.
mylib.file = $${PATH_TO_LIB_LARRY}/liblarry.pro
bld.pro:
TARGET=TestApp
SOURCES+=TestApp.cpp
PRE_TARGETDEPS+=$${PATH_TO_LIB_LARRY}/liblarry.a
#boilerplate...
QT -= gui
CONFIG = ...
include ($${PATH_TO_LIB_LARRY}/liblarry.pri) # contains include file info
CONFIG += link_prl # allow lib larry to specify its position in the linker input command.
Folder LibLarry has
LibLarry.pro
containing
LibLarry.pro:
TARGET=larry
TEMPLATE=lib
CONFIG+=staticlib
CONFIG+=create_prl # export information, so apps can link correctly
SOURCES+=my_shared_function.cpp
include (liblarry.pri)
liblarry.pri:
HEADERS += $$PWD/my_shared_function.h
INCLUDEPATH += $$PWD
I'm trying to compile the simavr project from https://github.com/buserror/simavr on Windows 10 using MSYS2 and mingw-w64.
After editing the makefiles to enable the MSYS clauses (Which are commented out by default), and changing the order of 2 include files, I can get the project to compile. I do however encounter an error in the linking step.
The output is
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Editing the makefile to print the ${LDFLAGS}, yield the following.
-L/lib -L/local/lib -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
Looking in the folder "obj-i686-w64-mingw32" mentioned in the build script, the file "libsimavr.a" is present. If I copy the file to the msys lib folder the linking step works fine.
The folder structure of the project is as follows:
simavr root (Where i run the makefile from, located in /c/Users/University/GitHub)
simavr
obj-i686-w64-mingw32
As far as I can tell, LD should be able to link properly without me copying the file manually. What am I missing here?
Edit:
The final command before the linker error.
cc -MMD -Werror -O2 -Wall -g -I/usr/local/include -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/lib -L/local/lib -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
Edit 2:
Cleaning the include paths of MSYS folders:
cc -MMD -Werror -O2 -Wall -g -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Passing CC=gcc to make:
gcc -MMD -Werror -O2 -Wall -g -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Edit 3:
Output of the find command:
$ find /c/Users/University/GitHub/simavr -name 'libsimavr.a'
/c/Users/University/GitHub/simavr/simavr/obj-i686-w64-mingw32/libsimavr.a
Note that previous entries have been made using the git bash prompt, not the one from msys2. However, running the same commands in the msys2 prompt or the mingw prompt from msys2 yields the same results.
Using mingw-w64 toolchain to build project you MUST remove from CFLAGS/CXXFLAGS/CPPFLAGS all paths with /usr, /local, /lib, /include as this paths can contain headers and libs from MSYS2 itself. Second, try pass "CC=gcc" to makefile.
new update
I think I should edit the title now.
To make sure I got a clean environment, I
download qt5.1.1 src code from qt-prject.
export QNX_TARGET, QNX_HOST, AND add QNX_HOST into PATH.
then Run the script
./configure -opensource -confirm-license -xplatform qnx-armv7le-qcc -v
so in here, -opensource -confirm-license just avoid the Q&A -v is to show full message.
a lot of error message.
Creating qmake...
make: Nothing to be done for `first'.
Running configuration tests...
Determining architecture... ()
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -g -Wall -W -fPIE -DQT_NO_CLIPBOARD -I../../mkspecs/qnx-armv7le-qcc -I. -I/opt/qnx650/target/qnx6/usr/include -I/opt/qnx650/target/qnx6/usr/include/freetype2 -o arch.o arch.cpp
Unable to determine architecture!
Could not determine the target architecture!
Turn on verbose messaging (-v) to see the final report.
Determining architecture... ()
g++ -c -pipe -g -Wall -W -fPIE -I../../mkspecs/linux-g++ -I. -o arch.o arch.cpp
g++ -o arch arch.o { test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'arch' && test -f arch.gdb-index && objcopy --add-section '.gdb_index=arch.gdb-index' --set-section-flags '.gdb_index=readonly' 'arch' 'arch' && rm -f arch.gdb-index || true
Found architecture in binary
CFG_HOST_ARCH="x86_64"
CFG_HOST_CPUFEATURES=" mmx sse sse2"
System architecture: 'unknown'
Host architecture: 'x86_64'
C++11 auto-detection... ()
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -O2 -Wc,-std=gnu++0x -Wall -W -fPIE-DQT_NO_CLIPBOARD -I../../../mkspecs/qnx-armv7le-qcc -I. -I/opt/qnx650/target/qnx6/usr/include -I/opt/qnx650/target/qnx6/usr/include/freetype2 -o c++11.o c++11.cpp
C++11 disabled.
floatmath auto-detection... ()
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -O2 -Wall -W -fPIE -DQT_NO_CLIPBOARD-I../../../mkspecs/qnx-armv7le-qcc -I. -I/opt/qnx650/target/qnx6/usr/include -I/opt/qnx650/target/qnx6/usr/include/freetype2 -o floatmath.o floatmath.cpp
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -O2 -Wall -W -fPIE -DQT_NO_CLIPBOARD -I../../../mkspecs/qnx-armv7le-qcc -I. -I/opt/qnx650/target/qnx6/usr/include -I/opt/qnx650/target/qnx6/usr/include/freetype2 -o freetype.o freetype.cpp
FreeType disabled.
STL auto-detection... ()
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -O2 -Wall -W -fPIE -DQT_NO_CLIPBOARD -I../../../mkspecs/qnx-armv7le-qcc -I. -I/opt/qnx650/target/qnx6/usr/include -I/opt/qnx650/target/qnx6/usr/include/freetype2 -o stltest.o stltest.cpp
STL disabled.
STL functionality check failed! Cannot build Qt with this STL library.
Turn on verbose messaging (-v) to /home/pasadeveloper/qt-everywhere-opensourcesrc-5.1.1/qtbase/configure to see the final report.
UPDATE:
I am working on QNX for ARM, target is an arm platform device.
Thing is getting weird. in Env Var, I put
$QNX_CONFIGURATION=/etc/qnx
$QNX_JAVAHOME=/opt/qnx650/_jvm
$QNX_TARGET=/opt/qnx650/target/qnx6
$QNX_HOST=/opt/qnx650/host/linux/x86
but when I do qmake qmake.conf mkspecs/qnx-armv7le-qcc folder
it returns an error message Project ERROR: QNX_TARGET environment variable not set
Have no clue what is going on now.
not just qmake qmake.conf
I try to build qt 5.1.2 at another host, ubuntu 12.04-64bit.
also get the same error message. Project ERROR: QNX_TARGET environment variable not set
I was working at Qt development under linux(FYI Ubuntu 12.04 -64bits), but I need to compile this program to binary for QNX.
I install QNX MOmentics IDE which provide QNX-gcc for me.
but I can't find the qmake-qnx.
Under the QT/gcc_64/mkspecs/qnx-armv7le-qcc, there is a file call qmake.conf. I guess this is where I can generate my qmake-qnx. after I run qmake -o Makefile qmake.conf, there is a Makefile generated.
However, when I run make, error occured.
qcc -Vgcc_ntoarmv7le -lang-c++ -Wl,-rpath-link,/opt/qnx650/target/qnx6/armle-v7/lib -Wl,-rpath-link,/opt/qnx650/target/qnx6/armle-v7/usr/lib -Wl,-O1 -Wl,-O1 -Wl,-rpath,/home/pasadeveloper/Qt5.1.0/5.1.0/gcc_64 -Wl,-rpath,/home/pasadeveloper/Qt5.1.0/5.1.0/gcc_64/lib -o qmake -L/opt/qnx650/target/qnx6/armle-v7/lib -L/opt/qnx650/target/qnx6/armle-v7/usr/lib -lm -L/home/pasadeveloper/Qt5.1.0//5.1.0/gcc_64/lib -lQt5Gui -lQt5Core -lGL -lpthread
cc: no files to process
make: *** [qmake] Error 1
pasadeveloper#ubuntu:~/Qt5.1.0/5.1.0/gcc_64/mkspecs/qnx-armv7le-qcc$
You do not "generate" your qmake-qnx like that. You are supposed to use the native qmake for generating proper makefiles for your target to aid the cross-compilation. Also, running qmake qmake.conf in the relevant mkspecs folder is wrong because that is not a project file as you may think.
When building Qt itself for instance, you should be using the proper mkspecs files for the target in which case, it is the one you also mentioned above if it is built for that particular arm qnx variant, called qnx-armv7le-qcc.
Here is the exact command you need to run after downloading the relevant Qt sources, like 5.1.1:
./configure -opensource -confirm-license -xplatform qnx-armv7le-qcc -v
For this QNX version, the bottom line is, if you do not have SP1 and libscreen, it will not work. The QPA plugin would link against it. This library provides the API to the graphics server on newer QNX variants. You need to talk to your QNX representatives.
Here you can find further information about the topic.
$QNX_TARGET=/opt/qnx650/target/qnx6
is probably not doing what you want. In shell scripts, you don't put a "$" in front of a variable when you are defining the variable, only when you access the variable:
X=hello
echo $X
I want to try using QML ShaderEffectItem on QGraphicsView
I have cloned files from https://qt.gitorious.org/qt-labs/qml1-shadersplugin how is written in post, and i have compiled this plugin in ~/Dev/GitRepo/qml1-shadersplugin$:
using QtCreator, compiles this file: qmlshadersplugin.pro
But now i run in this folder(~/Dev/GitRepo/qml1-shadersplugin): make install
And i have many: errors:
~/Dev/GitRepo/qml1-shadersplugin$ make installcd src/ && make -f Makefile install
make[1]: Entering directory `/home/goran/Dev/GitRepo/qml1-shadersplugin/src'
g++ -c -m32 -pipe -O2 -D_REENTRANT -Wall -W -fPIC -DQT_NO_DEBUG -DQT_PLUGIN -DQT_DECLARATIVE_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/linux-g++-32 -I. -I../../../../QtSDK/Desktop/Qt/474/gcc/include/QtCore -I../../../../QtSDK/Desktop/Qt/474/gcc/include/QtGui -I../../../../QtSDK/Desktop/Qt/474/gcc/include/QtOpenGL -I../../../../QtSDK/Desktop/Qt/474/gcc/include/QtDeclarative -I../../../../QtSDK/Desktop/Qt/474/gcc/include -I/usr/X11R6/include -I. -o qmlshadersplugin_plugin.o qmlshadersplugin_plugin.cpp
In file included from ../../../../QtSDK/Desktop/Qt/474/gcc/include/QtOpenGL/QtOpenGL:5:0,
from shadereffectitem.h:46,
from qmlshadersplugin_plugin.cpp:43:
../../../../QtSDK/Desktop/Qt/474/gcc/include/QtOpenGL/qgl.h:77:20: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [qmlshadersplugin_plugin.o] Error 1
make[1]: Leaving directory `/home/igor/Dev/GitRepo/qml1-shadersplugin/src'
make: *** [sub-src-install_subtargets] Error 2
What's the problem ?
GL/gl.h: No such file or directory
This means that you either do not have opengl library installed (very unlikely), or you didn't enabled it in your qmake file (very likely). To enable opengl in the qmake file, you need to add this line :
QT += opengl
More about it here.
I am trying to compile a project in my system using qmake. Some dependencies of the project are not installed but reside in my home directory, more or less like this: libs files: /home/myusername/local/lib and my includes directory /home/myusername/local/include. Inside the include directory I have a folder, qjson with the needed headers from the library. In the lib folder I have the files libqjson.so libqjson.so.0 libqjson.so.0.7.1.
My qmake project file looks something like this:
linux-g++ {
INCLUDEPATH += /home/myusername/local/include/
LIBS += -L/home/myusername/local/lib/ -lqjson
}
and the generated makefile will produce commands like this one:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB \
-DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../qbuzz \
-I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui \
-I/usr/include/qt4 -I/home/myusername/local/include/ -I. -I. -I../myproject -I. \
-o qbuzz-result.o ../myproject/myfile.cc
It is clear that my include directory is in the -I option of gcc. myfile.cc contains an include like this one:
#include <qjson/parser.h>
However, after running make, I get the error:
../myproject/myfile.cc:2:26: fatal error: qjson/parser.h: No such file or directory
compilation terminated.
Now, if I modify the environment variable CPLUS_INCLUDE_PATH to add my local include file, I have no problems there, but in the linker stage I got the error:
/usr/bin/ld: cannot find -lqjson
collect2: ld returned 1 exit status
Even though the linker command was:
g++ -omyprogram main.o mainwindow.o myfile.o moc_mainwindow.o -L/usr/lib \
-L/home/myusername/local/lib/ -lqjson -lQtGui -lQtNetwork -lQtCore -lpthread
I also can get around modifying the environment variable LIBRARY_PATH. However I am looking for a solution that relies on modifying as few environment variables as possible, and after all, why are the options -L and -I there?
I works on Windows without problems using MinGW g++.
I notice that the QT's automatic include paths have no trailing slashes, and yours do. Have you tried writing the paths without trailing slashes?
linux-g++ {
INCLUDEPATH += /home/myusername/local/include
LIBS += -L/home/myusername/local/lib -lqjson
}
G++ and friends (i.e. as, ld, etc) will not directly tell you exactly where it looks for header and library files. One way to debug this is to run strace -o output.txt -eopen -s 1024 -f qmake. This will run qmake logging all open system calls of qmake and all of the child processes it forks. You will then be able to see in what directories and in what order it searches for header files (and libraries). Example output extract for stdio.h:
26069 open("/usr/lib/gcc/x86_64-redhat-linux/4.6.0/include/stdio.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
26069 open("/usr/local/include/stdio.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
26069 open("/usr/include/stdio.h", O_RDONLY|O_NOCTTY) = 4