Results 1 to 2 of 2

Thread: Create project release build using Qt Static and QSerialDevice as a staticlib

  1. #1
    Join Date
    Jun 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Create project release build using Qt Static and QSerialDevice as a staticlib

    During development of my project i used the shared lib version of Qt (2010.02.1/ 4.6.2) together with the QSerialDevice v0.2.0 library (build as a staticlib using a default "BuildIntegratedLibrary.pro"). I could create debug and release builds which had the QSerialDevice lib included in the .exe and only needed mingwm10.dll and various Qt dll's to run.

    My OS: Win7 x64.

    Now am trying to create a release build of my project which only depends on mingwm10.dll.

    I have successfully created a static version of Qt (2010.02.1/ 4.6.2) (When i use QtCreator to create a new Qt GUI Application project and create a release build using this static qt version a nice 9.089KB untitled.exe is built). I used this Qt configuration:
    Qt Code:
    1. cflags: -O2
    2. Qt configuration:
    3. -release -nomake examples -nomake demos -platform win32-g++
    To copy to clipboard, switch view to plain text mode 

    When i add the QSerialDevice lib to this simple test project:
    Qt Code:
    1. QT += core gui
    2.  
    3. TARGET = untitled
    4. TEMPLATE = app
    5.  
    6. CONFIG += static
    7.  
    8. win32 {
    9. QMAKE_LFLAGS += -static-libgcc
    10. }
    11.  
    12. SOURCES += main.cpp\
    13. mainwindow.cpp
    14. HEADERS += mainwindow.h
    15. FORMS += mainwindow.ui
    16.  
    17. INCLUDEPATH = D:\src\qserialdevice.git\qserialdevice D:\src\qserialdevice.git\qserialdevicewatcher
    18. QMAKE_LIBDIR += D:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release
    19.  
    20. LIBS += -lqserialdevice
    To copy to clipboard, switch view to plain text mode 

    And start using the QSerialDevice classes in my code and then create a static release build. The build will fail. QtCreator will show a Build Issue: "collect2: Id returned 1 exit status". And the compile output will show a whole lot of "undefined references":

    Snippet:
    Qt Code:
    1. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x22): undefined reference to `_imp___ZN8QMapData11shared_nullE'
    2. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x7e): undefined reference to `_imp___ZN8QMapData11shared_nullE'
    3. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x18c): undefined reference to `_imp___ZN7QString11shared_nullE'
    4. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x290): undefined reference to `_imp___ZN7QString11shared_nullE'
    5. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x394): undefined reference to `_imp___ZN7QString11shared_nullE'
    6. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x498): undefined reference to `_imp___ZN7QString11shared_nullE'
    7. d:\src\qserialdevice.git\build\lib\qintegratedserialdevice\release/libqserialdevice.a(abstractserial.o):abstractserial.cpp:(.text+0x646): undefined reference to `_imp___ZN7QString11shared_nullE'
    To copy to clipboard, switch view to plain text mode 

    Is there a configuration option i missed in my .pro file which is needed to statically build your project using a static version of qt and a third party static library?

  2. #2
    Join Date
    Jun 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Create project release build using Qt Static and QSerialDevice as a staticlib

    Gah, re-compiling QSerialDevice using my static version of Qt has fixed my undefined references.

Similar Threads

  1. Replies: 1
    Last Post: 13th January 2010, 23:35
  2. Moving from QT 4.5 shared build to QT 4.5.2 static build
    By extrakun in forum Qt Programming
    Replies: 0
    Last Post: 26th October 2009, 09:49
  3. Create a DLL with a static build of Qt 4.3
    By ucomesdag in forum Qt Programming
    Replies: 4
    Last Post: 7th May 2008, 14:12
  4. build debug with shared and release with static?
    By Thor28 in forum Qt Programming
    Replies: 4
    Last Post: 14th April 2008, 22:32
  5. Build qsqlodbc ODBC staticlib not possibel...
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2006, 07:02

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.