[Solved] QtSerialPort building problem



  • Hi,

    im currently try to build qtserialport for my project but i have some troubles to do so.
    Actually i don't know if my problem results from the building process.

    I started cloning the "users" git repository mentioned on the qtserialport wiki page.
    Afterwards i went down the directory tree into src/serialport folder.
    There i found the serialport.pro file which i opened with qt creator.
    As build options i used Qt 4.8.1 with MinGW which i got from the original Nokia SDK.
    The operating system i used was Win 7.
    The next step is building the library. Therefor i start compiling the project with debug configuration.
    During compilation there occour some warning:
    @cp: cannot create regular file `/include/QtAddOnSerialPort': No such file or directory@
    But all in all there are some files built during the process.

    After that i use the command line to navigate to the folder contaning the .pro file mentioned above.
    Now i run the command mingw32-make install with the following output:

    @
    C:\Users\N\Downloads\qtserialport\src\serialport>mingw32-make install
    mingw32-make -f Makefile.Debug install
    mingw32-make[1]: Entering directory C:/Users/N/Downloads/qtserialport/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 "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[1]: Leaving directoryC:/Users/N/Downloads/qtserialport/src/serialport'
    @

    Now i repeat the whole precedure with the release configuration with nearly the same result (same warnings cp: cannot create regular file `/include/QtAddOnSerialPort': No such file or directory).

    The next step was to add
    @CONFIG += serialport@
    to my project where i tried to use the library.
    Now i added the example code lines provided by the qtserialport wiki page.

    Now my actual problem occurs.
    During compilation i get many of these errors all with different references:
    @C:\Users\N\Documents\I\Desktop_Software\interfacechooser.cpp:-1: error:undefined reference to `_imp___ZN7QtAddOn10SerialPort14SerialPortInfo14availablePortsEv'@
    Finally it aborts with:
    @:-1: error:collect2: ld returned 1 exit status@

    Hopefully someone can help me.
    Thanks!

    Paul



  • bq. There i found the serialport.pro

    Need qtserialport.pro in root directory



  • [quote author="kuzulis" date="1354105305"]bq. There i found the serialport.pro

    Need qtserialport.pro in root directory[/quote]

    In this case the compilation process aborts with:
    @C:\Users\N\Downloads\serialport-build-release>qmake ..\qtserialport\qtserialport.pro CONFIG+=release
    C:\Users\N\Downloads\serialport-build-release>mingw32-make
    cd src/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/src.pro CONFIG+=release -o Makefile
    cd src/ && mingw32-make -f Makefile
    mingw32-make[1]: Entering directory c:/Users/N/Downloads/serialport-build-release/src' cd serialport/ && c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/qmake.exe c:/Users/N/Downloads/qtserialport/src/serialport/serialport.pro CONFIG+=release -o Makefile Syntaxerror. cp: cannot create regular fileC:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory
    cp: cannot create regular file C:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular fileC:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory
    Syntaxerror.
    cp: cannot create regular file C:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular fileC:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory
    cp: cannot create regular file C:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory Syntaxerror. cp: cannot create regular fileC:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory
    cp: cannot create regular file C:/Users/N/Downloads/serialport-build-release/include/QtAddOnSerialPort': No such file or directory cp: cannot create regular fileC:/Users/N/Downloads/serialport-build-release/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/serialport-build-release/src'
    mingw32-make: *** [sub-src-make_default-ordered] Error 2@



  • Perhaps you need clear and delete all previous trash from your release dir (after previous building), and trash from paths

    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/include/QtAddOnSerialPort/"

    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/bin/SerialPortd1.dll"
    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/SerialPortd.prl"
    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/libSerialPortd1.a"
    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/lib/SerialPortd1.dll"

    and

    "c:/QtSDK/Desktop/Qt/4.8.1/mingw/mkspecs/features/"

    and try rebuild again.



  • [quote author="kuzulis" date="1354107234"]Perhaps you need clear and delete all previous trash from your release dir[/quote]

    Now i cleaned these directories up you mentioned, deleted the source tree and build directories.
    Cloned the repository one more time, created the build directories and started the build process agin.
    But mingw32-make still stops with error code 2 and all these errors previously posted.



  • But, i don't know cause of problem, try update Qt to 4.8.3.
    Or try build library via QtCreator.



  • [quote author="kuzulis" date="1354108910"]Or try build library via QtCreator.[/quote]

    Even this fails with the same error like in the command window. Supprisingly it just compiles fine when i use MSVC 2010 in QtCreator but this isn't a solution cause i'am using MinGW for my project i wanna use qtserialport for.



  • I just checked, everything is compiled fine.

    QtSdk-offline-win-x86-v1_2_1.exe & MinGW4.4 (from SDK) & Win7x64pro.

    Maybe it's some kind of your-specific problem.



  • Why not follow the instructions outlined on the wiki page? http://qt-project.org/wiki/QtSerialPort

    1. Open a command prompt which has the MinGW environment setup.

    2. Navigate to a convenient temporary location to build the library and create "debug" and "release" folders
      @cd ...
      mkdir debug
      mkdir release@

    3. Build and install the Debug version of the library: (use C:\path\to\qmake if qmake isn't part of your PATH environment variable)
      @cd debug
      qmake C:\Users\N\Downloads\qtserialport\qtserialport.pro
      mingw32-make
      mingw32-make install@

    4. Navigate to the release folder, build, and install the Release version of the library:
      @cd ..\release
      qmake C:\Users\N\Downloads\qtserialport\qtserialport.pro CONFIG+=release
      mingw32-make
      mingw32-make install@

    After this, you should be able to include a reference to the QtSerialPort library by adding CONFIG += serialport to your project's .pro file, and including the headers <QtAddOnSerialPort/serialport.h> and so forth.



  • [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.pro

    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 directory c:/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 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 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
    cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile
    mingw32-make[2]: Entering directory c:/Users/N/Downloads/qtserialport/debug/src/serialport' c:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug mingw32-make[3]: Entering directoryc:/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 directory c:/Users/N/Downloads/qtserialport/debu g/src/serialport' mingw32-make[2]: Leaving directoryc:/Users/N/Downloads/qtserialport/debu
    g/src/serialport'
    mingw32-make[1]: Leaving directory c:/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 directoryc:/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 2

    C:\Users\N\Downloads\qtserialport\debug>mingw32-make install
    cd src/ && mingw32-make -f Makefile install
    mingw32-make[1]: Entering directory c:/Users/N/Downloads/qtserialport/debug/src' cd serialport/ && c:/QtSDK/mingw/bin/mingw32-make -f Makefile install mingw32-make[2]: Entering directoryc:/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 directory c:/Users/N/Downloads/qtserialport/debug/src/serialport' mingw32-make[2]: Leaving directoryc:/Users/N/Downloads/qtserialport/debug/src/serialport'
    mingw32-make[1]: Leaving directory c:/Users/N/Downloads/qtserialport/debug/src' cd examples/ && mingw32-make -f Makefile install mingw32-make[1]: Entering directoryc:/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



  • 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 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 = subdirs

    SUBDIRS = src examples tests

    SUBDIRS = src tests
    CONFIG += ordered
    
    !infile&#40;$$OUT_PWD/.qmake.cache, SERIALPORT_PROJECT_ROOT&#41; {
        system("echo SERIALPORT_PROJECT_ROOT = $$PWD >> $$OUT_PWD/.qmake.cache"&#41;
        system("echo SERIALPORT_BUILD_ROOT = $$OUT_PWD >> $$OUT_PWD/.qmake.cache"&#41;
    }
    

    } 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 directory c:/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 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 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
    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 directory c:/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 directoryc:/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 file c:/Users/N/Downloads/qtserialport/src/serialport/serialport_unix_p.h'. No need to remake targetc:/Users/N/Downloads/qtserialport/src/serialport/serialport_unix_p.h'.
    Finished prerequisites of target file serialport.o'. Must remake targetserialport.o'.
    mingw32-make[2]: Entering directory c:/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 directoryc:/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/lib

    The 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



    1. 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!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.