[Solved] QtSerialPort building problem
-
[quote author="Twinky" date="1354172276"]Why not follow the instructions outlined on the wiki page? http://qt-project.org/wiki/QtSerialPort[/quote]
I allready tried this approach 7 post above i think, but just in case i tried it again.
At first i removed the whole Qt installation and coninced myself that every file is deleted.
Downloaded the offline installer QtSdk-offline-win-x86-v1_2_1.exe.
Installed Qt framwork again with MinGW 4.4.
Cloned the repository again.
changed into the root folder of the repo.
@
mkdir debug
mkdir release
@
added
C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
C:\QtSDK\mingw\bin
to my Path environment, reboot.
Changed into debug folder inside repo root dir.
Execute:
@
C:\Users\N\Downloads\qtserialport\debug>qmake ..\qtserialport.proC:\Users\N\Downloads\qtserialport\debug>mingw32-make
cd src/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/src.pro -o Makefile
cd src/ && mingw32-make -f Makefile
mingw32-make[1]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src' cd serialport/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/serialport/serialport.pro -o Makefile syntaxerror. cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
syntaxerror.
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory syntaxerror. cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src/serialport' c:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug mingw32-make[3]: Entering directory
c:/Users/N/Downloads/qtserialport/debug/src/serialport'
C:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/moc.exe ...
g++ ...
@
... (some more g++ lines)
@
Creating library file: debug/libSerialPortd1.a
mingw32-make[3]: Leaving directoryc:/Users/N/Downloads/qtserialport/debu g/src/serialport' mingw32-make[2]: Leaving directory
c:/Users/N/Downloads/qtserialport/debu
g/src/serialport'
mingw32-make[1]: Leaving directoryc:/Users/N/Downloads/qtserialport/debu g/src' cd examples/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/examples/examples.pro -o Makefile cd examples/ && mingw32-make -f Makefile mingw32-make[1]: Entering directory
c:/Users/N/Downloads/qtserialport/debug/examples'
cd cenumerator/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/examples/cenumerator/cenumerator.pro -o Makefile
cd cenumerator/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile/usr/bin/sh: c:/QtSDK/mingw/bin/mingw32-make: Invalid argument
mingw32-make[1]: *** [sub-cenumerator-make_default-ordered] Error 126
mingw32-make[1]: Leaving directory `c:/Users/N/Downloads/qtserialport/debug/examples'
mingw32-make: *** [sub-examples-make_default-ordered] Error 2C:\Users\N\Downloads\qtserialport\debug>mingw32-make install
cd src/ && mingw32-make -f Makefile install
mingw32-make[1]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src' cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile install mingw32-make[2]: Entering directory
c:/Users/N/Downloads/qtserialport/debug/src/serialport'
c:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug install
mingw32-make[3]: Entering directory `c:/Users/N/Downloads/qtserialport/debug/src/serialport'
cp c:/Users/N/Downloads/qtserialport/src/serialport/serialport-global.h c:/QtSDK/Desktop/Qt/4.8.1/mingw/include/QtAddOnSerialPort/
cp c:/Users/N/Downloads/qtserialport/src/serialport/serialport.h c:/QtSDK/Desktop/Qt/4.8.1/mingw/include/QtAddOnSerialPort/
cp c:/Users/N/Downloads/qtserialport/src/serialport/serialportinfo.h c:/QtSDK/Desktop/Qt/4.8.1/mingw/include/QtAddOnSerialPort/
cp c:/Users/N/Downloads/qtserialport/src/serialport/qt4support/serialport.prf c:/QtSDK/Desktop/Qt/4.8.1/mingw//mkspecs/features/
cp "debug/SerialPortd1.dll" "c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/SerialPortd1.dll"
cp "debug/SerialPortd.prl" "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/SerialPortd.prl"cp "debug/libSerialPortd1.a" "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/libSerialPortd1.a"
cp "debug/SerialPortd1.dll" "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/SerialPortd1.dll"
mingw32-make[3]: Leaving directoryc:/Users/N/Downloads/qtserialport/debug/src/serialport' mingw32-make[2]: Leaving directory
c:/Users/N/Downloads/qtserialport/debug/src/serialport'
mingw32-make[1]: Leaving directoryc:/Users/N/Downloads/qtserialport/debug/src' cd examples/ && mingw32-make -f Makefile install mingw32-make[1]: Entering directory
c:/Users/N/Downloads/qtserialport/debug/examples'
cd cenumerator/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile install
/usr/bin/sh: c:/QtSDK/mingw/bin/mingw32-make: Invalid argument
mingw32-make[1]: *** [sub-cenumerator-install_subtargets-ordered] Error 126
mingw32-make[1]: Leaving directory `c:/Users/N/Downloads/qtserialport/debug/examples'
mingw32-make: *** [sub-examples-install_subtargets-ordered] Error 2
@At this point i stoped cause of the errors during installation
-
[quote author="Twinky" date="1354194076"]Hummm perhaps your command prompt doesn't have permissions. Can you try typing "cmd" from the start menu's search feature, then when the program shows up on the list, right click it and select "Run as administrator".
[/quote]This doesn't change anything, same errors like before.
-
Then try comment in SUBDIRS build for examples and tests from qtserialport.pro,
i.e. make only library assembly. -
Ok right my new qtserialport.pro in the root folder of the repo is now
@
include(doc/doc.pri)lessThan(QT_MAJOR_VERSION, 5) {
TEMPLATE = subdirsSUBDIRS = src examples tests
SUBDIRS = src tests CONFIG += ordered !infile($$OUT_PWD/.qmake.cache, SERIALPORT_PROJECT_ROOT) { system("echo SERIALPORT_PROJECT_ROOT = $$PWD >> $$OUT_PWD/.qmake.cache") system("echo SERIALPORT_BUILD_ROOT = $$OUT_PWD >> $$OUT_PWD/.qmake.cache") }
} else {
load(qt_parts)
}
@This cause an error while building the library in the src folder:
@
c:\Users\N\Downloads\qtserialport\debug>mingw32-make
cd src/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/src.pro -o Makefile
cd src/ && mingw32-make -f Makefile
mingw32-make[1]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src' cd serialport/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/serialport/serialport.pro -o Makefile syntaxerror. cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
syntaxerror.
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory syntaxerror. cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cp: cannot create regular fileC:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular file
C:/Users/N/Downloads/qtserialport/debug/include/QtAddOnSerialPort': No such file or directory
cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile
/usr/bin/sh: c:/QtSDK/mingw/bin/mingw32-make: Invalid argument
mingw32-make[1]: *** [sub-serialport-make_default] Error 126
mingw32-make[1]: Leaving directory `c:/Users/N/Downloads/qtserialport/debug/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2
@the next attempt was to create an include dir containing an QtAddOnSerialPort dir inside the debug folder by hand, which solves a couple of issues.
@
c:\Users\N\Downloads\qtserialport\debug>mingw32-make
cd src/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/src.pro -o Makefile
cd src/ && mingw32-make -f Makefile
mingw32-make[1]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src' cd serialport/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/serialport/serialport.pro -o Makefile syntaxerror. syntaxerror. syntaxerror. cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile /usr/bin/sh: c:/QtSDK/mingw/bin/mingw32-make: Invalid argument mingw32-make[1]: *** [sub-serialport-make_default] Error 126 mingw32-make[1]: Leaving directory
c:/Users/N/Downloads/qtserialport/debug/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2
@
after the make command this dir contains following header files:
serialport.h
serialport-global.h
serialportinfo.h
which i have seen before while compiling the project with MSVC2010. -
What info contains in /build-release-dir/.qmake.cache after first run qmake ...?
-
[quote author="kuzulis" date="1354209844"]What info contains in /build-release-dir/.qmake.cache after first run qmake ...?
[/quote]content of .qmake.cache in release dir:
@
SERIALPORT_PROJECT_ROOT = C:/Users/N/Downloads/qtserialport
SERIALPORT_BUILD_ROOT = C:/Users/N/Downloads/qtserialport/release
@content of .qmake.cache in debug dir:
@
SERIALPORT_PROJECT_ROOT = C:/Users/N/Downloads/qtserialport
SERIALPORT_BUILD_ROOT = C:/Users/N/Downloads/qtserialport/debug
@ -
Hmm.. In principle, all right. But I Do not know the cause of errors, sorry. :(
-
anyway many thanks for your advice.
it's obviously an error just occours on my machine at work. i tried the whole procedure at my home pc and it works fine. -
Also I was notified about this problem from another person.
It turns out that qmake generates various Makefiles.For "normal" Makefile, used "" separator, and del, mkdir, copy /y, xcopy /s /q /y /i, move utilities.
But for "bad" Makefile used "/" separator, and rm, mkdir -p, cp, cp -r, mv utilities.
Most likely this is problem.
-
i made some further investigations to track the error down.
For this i executed mingw32-make with the -d option.
The result is quit interresting.
The last couple of output lines before the make process aborts are:@
...
Finished prerequisites of target filec:/Users/N/Downloads/qtserialport/src/serialport/serialport_unix_p.h'. No need to remake target
c:/Users/N/Downloads/qtserialport/src/serialport/serialport_unix_p.h'.
Finished prerequisites of target fileserialport.o'. Must remake target
serialport.o'.
mingw32-make[2]: Entering directoryc:/Users/N/Downloads/qtserialport/debug/src/serialport' g++ -c -O2 -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_SERIALPORT_LIB -I'c:/Users/N/Downloads/qtserialport/src/serialport' -I'.' -I'c:/QtSDK/Desktop/Qt/4.8.1/mingw/mkspecs/default' -o serialport.o c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp CreateProcess(c:\QtSDK\mingw\bin\g++.exe,g++ -c -O2 -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_SERIALPORT_LIB -Ic:/Users/N/Downloads/qtserialport/src/serialport -I. -Ic:/QtSDK/Desktop/Qt/4.8.1/mingw/mkspecs/default -o serialport.o c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp,...) Putting child 0x0068c230 (serialport.o) PID 31241344 on the chain. Live child 0x0068c230 (serialport.o) PID 31241344 Main thread handle = 0x00000084 In file included from c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:45: c:/Users/N/Downloads/qtserialport/src/serialport/serialport.h:45:30: error: QtCore/qiodevice.h: No such file or directory In file included from c:/Users/N/Downloads/qtserialport/src/serialport/serialport.h:47, from c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:45: c:/Users/N/Downloads/qtserialport/src/serialport/serialport-global.h:45:21: error: qglobal.h: No such file or directory In file included from c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:46: c:/Users/N/Downloads/qtserialport/src/serialport/serialportinfo.h:46:26: error: QtCore/qlist.h: No such file or directory c:/Users/N/Downloads/qtserialport/src/serialport/serialportinfo.h:47:35: error: QtCore/qscopedpointer.h: No such file or directory c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:55:2: error: #error Unsupported OS c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:1085:30: error: moc_serialport.cpp: No such file or directory In file included from c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:45: c:/Users/N/Downloads/qtserialport/src/serialport/serialport.h:54: error: expected initializer before ':' token c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:1087: error: expected '}' at end of input c:/Users/N/Downloads/qtserialport/src/serialport/serialport.cpp:1087: error: expected '}' at end of input Reaping losing child 0x0068c230 PID 31241344 mingw32-make[2]: *** [serialport.o] Error 1 Removing child 0x0068c230 PID 31241344 from chain. mingw32-make[2]: Leaving directory
c:/Users/N/Downloads/qtserialport/debug/src/serialport'
Reaping losing child 0x0045c4c8 PID 4481488
mingw32-make[1]: *** [sub-serialport-make_default] Error 2
Removing child 0x0045c4c8 PID 4481488 from chain.
mingw32-make[1]: Leaving directory `c:/Users/N/Downloads/qtserialport/debug/src'
Reaping losing child 0x01d18200 PID 30538208
mingw32-make: *** [sub-src-make_default-ordered] Error 2
Removing child 0x01d18200 PID 30538208 from chain.
@It seems like the compiler can't find the Qt header files, but im currently unable to solve this.
-
I recently had a similar problem, where the compiler will say it can't find the header files.
This error occurred when trying to compile and install the library. I was able to resolve this with the following steps:
Follow the build steps from the wiki. You will encounter errors saying that the header files are missing, but ignore them and proceed with make install.
Copy the file c:/Users/N/Downloads/qtserialport/src/serialport/q4tsupport/serialport.prf to c:/QtSDK/Desktop/Qt/4.8.1/mingw/mkspecs/features/serialport.prf for some reason, this step is supposed to be automatic but didn't occur on my system.
At this point Qt Creator should be able to detect the header files and properly link your projects
-
ok i tried the suggestion of the last post.
Before building the library i created following dirs inside the debug and release folder include/QtAddOnSerialPort to minimize the occouring errors.
Now i followed the step by step building instruction from the wiki.
Ignoring all the occouring errors.
Checked the content of c:/QtSDK/Desktop/Qt/4.8.1/mingw/mkspecs/features/ an suprisingly noticed that serialport.prf was allready copied to this directory. It can't be there due to an previous attempt of building this because i reinstalled the whole qt installation before building the library again.
Now building my project where i wanna use this lib.
It aborts with
@
cannot find -lSerialPort
@
I'm not sure if there are some files missing now in the Qt installation. From my point of view the make install process copied all files properly.Edit: The error occurs just with release build configuration, with debug configuration everything is built fine :)
Edit2: mingw32-make -d inside the release folder of lib itself aborts due to:
@
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lSerialPort
@ -
You can compile and run projects in debug? If so, nice!
Can you check your lib folder for the existance of these files?
c:/QtSDK/Desktop/Qt/4.8.1/mingw/libThe ones below are for the release version:
- SerialPort.prl
- SerialPort1.dll
- SerialPort1.lib
And these are for debug:
- SerialPortd.prl
- SerialPortd1.dll
- SerialPortd1.lib
- SerialPortd1.pdb
If none of these are present, it might be due to a difference in how mingw and visual c++ store libraries, try looking for libSerialPort.so.1.0.0
-
- Success way:
On Wiki says, that should be building and installation in current order: 1. Build release or/and debug version (in any order) 2. Install release or/and debug version (in any order) 2) Bad way: ~~~~~~~~~ The main observation is that you can not do: 1. Build release 2. Install release 3. Build debug 4. Install debug Or conversely with 1,2 and 3,4. This will build error like: cannot find -lSerialPort. Reason this bad building because into the Qt already been installed some files, e.g.: /mkspecs/features/serialport.prf ~~~~~~~~~ In resulting, after success building and installing, Qt should be exists files: "<qt/path>/bin/": SerialPort1.dll and SerialPortd1.dll "<qt/path>/lib/": libSerialPort1.a and libSerialPortd1.a, SerialPort.prl and SerialPortd.prl, SerialPort1.dll and SerialPortd1.dll "<qt/path>/include/QtAddOnSerialPort": serialport.h, serialportinfo.h, serialport-global.h "<qt/path>/mkspecs/features": serialport.prf
-
Allright all the files which should be there for the release build are missing in my qt installation.
@kurzulis: I followed the way discribed on the wiki page, yeah and i tried to build my lib exactly in the order you mentioned.
Finally i figured out what the problem for my special case is. I found a path to the Atmel AVR toolchain in my path variable. That was the case because i also do some 8-bit microcontroller development. Therefore i accidantely used the mingw32 binaries of the AVR toolchain for building my lib and that cause all these errors. Now everything works fine. Many Thanks guys!