Results 1 to 3 of 3

Thread: How to use OpenSSL in subdirs project

  1. #1
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default How to use OpenSSL in subdirs project

    Hi,

    I'm using a subdirs project to build my project together with some required libraries like ChrisW67 suggested in this thread:
    http://www.qtcentre.org/threads/5740...e-project-file

    Now I also need to use OpenSSL (lcrypto).
    On Linux I just installed the OpenSSL package provided by the distribution.

    My problem is related to Windows. There I built OpenSSL on my own with mingw. If I want to use it in my project I have the same problem as I described in this post of the last thread:
    http://www.qtcentre.org/threads/5740...409#post256409

    I can't use the same solution with the subdirs project since OpenSSL is no qmake-project (at least I think it is not possible, correct me if I'm wrong!).
    To work around the problem I tried to copy the OpenSSL libraries (*.dll and *.a files) in the corresponding system directories (System32 for 64-bit version and SysWOW64 for 32-bit version) hoping the linker is able to find them there. It isn't.
    I noticed that ChrisW67 added a solution for determining the target architecture on Windows in the old thread, but I think the best solution would still be to put the libraries in appropriate system directories that the linker will find them and will use the right version (32-/64-bit).
    So the question is, where do I have to install the libraries (especially the *.a files) on Windows that the linker is able to find them?

    Thanks for helping.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use OpenSSL in subdirs project

    You leave the OpenSSL libraries where they were and you tell the project that needs to use them where to find them. Something like:
    Qt Code:
    1. INCLUDEPATH += C:/OpenSSL/include
    2. LIBS += -LC:/OpenSSL/lib -lcrypt
    To copy to clipboard, switch view to plain text mode 
    In the relevant PRO file.

    In the IDE project settings add the C:/OpenSSL/bin directory (the one with the Dll files) to the run time PATH.
    You may need to adjust the paths to suit where you have things.

  3. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to use OpenSSL in subdirs project

    I have been using the suggested solution - providing the full location in the pro file - yet.
    The problem is that I have to distinguish between the 64-bit and the 32-bit versions then. To avoid that I was using the subdirs project (according to ChrisW67 suggestion in the last thread) which works very well for my own libraries.

    I think there is no other way then using the code to determine the target architecture he added later in the last thread (I'm using the Linux version on Windows because I'm using MinGW instead of msvc):
    Qt Code:
    1. win32 {
    2. win32-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
    3. win32-g++-32:QMAKE_TARGET.arch = x86
    4. win32-g++-64:QMAKE_TARGET.arch = x86_64
    5. contains(QMAKE_TARGET.arch, x86_64):{
    6. LIBS += -L../../openssl-mingw_amd64/lib/ -lcrypto
    7. } else {
    8. LIBS += -L../../openssl-mingw_i386/lib/ -lcrypto
    9. }
    10. } else
    11. # ...
    To copy to clipboard, switch view to plain text mode 
    Of course this works, but now I'm needing the target architecture again which ChrisW67 advised me to avoid (that's why I was asking for a global place to install the libs like it is possible on Linux).
    I think the problem is solved, but if there's a better solution I'm still interested.
    Last edited by Infinity; 11th January 2014 at 00:49.

Similar Threads

  1. QtCreator subdirs - Dependencies of project
    By folibis in forum Qt Tools
    Replies: 1
    Last Post: 13th September 2013, 09:03
  2. QMake Call a pre-written makefile from a SUBDIRS project
    By Mookie in forum Qt Tools
    Replies: 0
    Last Post: 12th December 2011, 15:05
  3. Help with qmake's SUBDIRS template
    By danielperaza in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2011, 10:12
  4. using the subdirs Template
    By bhs-ittech in forum Newbie
    Replies: 2
    Last Post: 23rd November 2007, 11:45
  5. Templates vcapp and subdirs together
    By xgoan in forum Newbie
    Replies: 1
    Last Post: 24th August 2006, 11:46

Tags for this Thread

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.