Results 1 to 4 of 4

Thread: Qt 4.5.3 openssl 0.9.8k windows static mingw32

  1. #1
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt 4.5.3 openssl 0.9.8k windows static mingw32

    Thank you in advance for your assistance. I am not quite sure if this is an issue with openssl or with my Qt configuration.

    I built openssl using the following command from the openssl directory:

    Qt Code:
    1. ms/mingw32
    To copy to clipboard, switch view to plain text mode 

    This worked fine, and the test came out ok.

    I then built Qt static using the following command:


    configure -release -opensource -static -openssl-linked -I "D:/openssl-0.9.8k/outinc"
    -L "D:/openssl-0.9.8k/out" -webkit -nomake examples -nomake demos
    -no-qt3support -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde
    -no-style-windowsce -no-style-windowsmobile -platform win32-g++
    This process was successful.

    I then tried to compile an application that I had working in an older version of Qt4, but was using shared libraries in the old build.

    The result was this error:
    mingw32\bin\ld.exe: cannot find -Lssleay32
    I checked my openssl 0.9.8K build, and there is no such file in the out folder, however my old environment had such a file. When I copied libssleay32.a from my old build environment to the D:\openssl-0.9.8k\out folder, and I renamed "libeay32.a" to "liblibeay32.a" then my program would build however there are still the following 2 issues:

    1) the libeay32.a that I used was from an older version of openssl from 2007. This could in theory cause problems, and I would like to be able to use the latest version if possible (however the latest version does not contain this file).

    2) the compiled program asks for "libeay32.dll" rather than that functionality being statically compiled into the program.

    Here also is my .pro file in case there is something within that is wrong.
    Qt Code:
    1. #########################
    2. # Custom for automatic updater
    3. #########################
    4.  
    5. TEMPLATE = app
    6. unix: TARGET = release_linux/updater
    7. win32: TARGET = release_windows/updater
    8. DEPENDPATH += maingui ssl fab_varlib
    9. INCLUDEPATH += maingui ssl fab_varlib
    10.  
    11. win32 {
    12. LIBS += -L D:/openssl-0.9.8k/out
    13. }
    14.  
    15. # Input
    16. HEADERS += maingui/calculatorform.h maingui/dialog_login.h \
    17. ssl/client.h ssl/dialog_common.h \
    18. fab_varlib/fab_var.h
    19.  
    20. FORMS += maingui/calculatorform.ui maingui/dialog_login.ui
    21.  
    22. SOURCES += maingui/calculatorform.cpp maingui/dialog_login.cpp \
    23. maingui/main.cpp \
    24. ssl/client.cpp ssl/dialog_common.cpp
    25.  
    26. QT += core \
    27. gui \
    28. sql \
    29. network
    30. CONFIG += static
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.5.3 openssl 0.9.8k windows static mingw32

    after a bit of toiling and experimentation I finally fixed the issue. here is how I solved it in case someone else had the same problem, or in case someone else has a better suggestion to fix it:

    1) I copied libcrypto.a and libssl.a to my <qtdir>\lib
    2) i copied the openssl directory from outinc to <qtdir>\include

    3) I noticed that the OPENSSL_LIBS option would not work. It would always error out if I added this option to the configure command when reconfiguring Qt. Upon further investigation, I found that this line was hard coded in <qtdir>\tools\configure\configureapp.cpp:

    Qt Code:
    1. \\line 2400
    2. else if (dictionary[ "OPENSSL" ] == "linked")
    3. qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
    To copy to clipboard, switch view to plain text mode 

    I changed it to this:

    Qt Code:
    1. \\line 2400
    2. else if (dictionary[ "OPENSSL" ] == "linked")
    3. qmakeVars += QString("OPENSSL_LIBS = -lssl -lcrypto");
    To copy to clipboard, switch view to plain text mode 

    I then ran the command to configure Qt for what I needed:
    configure -release -opensource -static -openssl-linked -webkit
    -nomake examples -nomake demos -no-qt3support
    -no-style-plastique -no-style-cleanlooks -no-style-motif
    -no-style-cde -no-style-windowsce -no-style-windowsmobile
    -no-phonon -no-dsp -no-vcproj -no-incredibuild-xge
    -no-opengl -no-scripttools -no-sql-sqlite -platform win32-g++
    and then:
    make sub-src
    After this was done, I was able to compile my apps like normal with Qt and openssl static as long as I followed the following steps:

    1: run qmake
    2: go in the make file it generates and alter the "Libs =" entry by changing
    "-lssleay32 -llibeay32" to "-lssl -lcrypto" . Also it is a must that -lgdi32 is moved
    to be after "-lssl -lcrypto" in the list.
    3: run make, and everything works as it should, the only DLL needed now is mingwm10.dll


    My only questions now are:
    Is there a way to achieve this without editing configureapp.cpp?
    Is there a way for qmake to put the "-lssl -lcrypto" by itself instead of "-lssleay32 -llibeay32" (and making sure that gdi32 is after them)?

  3. The following user says thank you to tpf80 for this useful post:

    manekineko (26th February 2010)

  4. #3
    Join Date
    Nov 2009
    Posts
    31
    Thanks
    5

    Default Re: Qt 4.5.3 openssl 0.9.8k windows static mingw32

    I don't know if you'll see this, but if you do, I'm trying to do the same thing as you, and really having some terrible difficulty.
    http://www.qtcentre.org/threads/2545...static+mingw32

    What made you decide to modify the files that QT looks for instead of just renaming your files like you did for the old build?
    Also, why did you say that lgdi32 must be after?

    I've only managed to get a successful compile of QT when using a pre-built version of OpenSSL, but that one unfortunately is acting like your first post and requiring external dll's for compiled programs.
    When I compiled OpenSSL using Cygwin configured to compile for mingw, it's erroring out during QT compile.
    When I try to compile OpenSSL it's not working, and I'm getting tons of errors.

  5. #4
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.5.3 openssl 0.9.8k windows static mingw32

    The reason I had to change the files that Qt looks for, is that the static openssl libraries are named different. The static ones are actually libssl and libcrypto. The configureapp.cpp file was hard coded to use the dynamic library.

    As for the reason I had to change the order for -lgdi32 to be after -lssl -lcrypto, it is because openssl has gdi32 as one of its dependencies.

Similar Threads

  1. Qt for Windows CE with OpenSSL support
    By Jonas in forum Installation and Deployment
    Replies: 2
    Last Post: 4th February 2010, 07:36
  2. Error when compiling for static version in windows
    By que in forum Installation and Deployment
    Replies: 4
    Last Post: 28th October 2008, 20:41
  3. Replies: 16
    Last Post: 23rd May 2008, 10:12
  4. Replies: 4
    Last Post: 20th February 2006, 09:11

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.