<solved> Compiling error -leay32 -lssleay32



  • Hi!

    Im trying to build an old project that was compiled using qt 4.4. Im currently running that version of Qt, with the latest qt creator.

    Right now, if i try to compile I get the following error:

    @
    cannot find -leay32
    cannot find -lssleay32
    error: ld returned 1 exit status@

    Theres a line in my Pro file that says

    @
    LIBS += $$LIBSDIR/iaxclient.dll $$LIBSDIR/sqlite3.dll $$CORELIBDIR/release/libkiax2core.a $$LIBSDIR/libjson.a $$LIBSDIR/libcurl-4.dll -leay32 -lssleay32
    @

    Thats actually the only part in my project where these files are mentioned. If i comment the -leay32 -lssleay32 part, i start getting thousands of "undefined reference to 'function name'" So that wont help.

    Any idea how to solve this?
    Thanks in advance!


  • Lifetime Qt Champion

    Hi,

    You need to add the path where these two libraries can be found. eay32 and ssleay32 are not standard libraries on windows. You have to install them with the correct OpenSSL package (meaning 32 or 64 bit) and then just:

    @LIBS+= -LC:/OpenSSL-Win32/libs@



  • Any guideline on which to install and how? There are thousands, and its not specified if its either 32 or 64 bits, or how to install them...
    https://www.openssl.org/source/


  • Lifetime Qt Champion

    Follow the link for windows "here":https://www.openssl.org/related/binaries.html



  • Wow, thanks for your help on that one!

    So, i have managed to succesfully install openssl, I have checked on C:\OpenSSL-Win32\lib I have both libeay32.lib and ssleay32.lib. I have also added

    @LIBS+= -LC:/OpenSSL-Win32/libs@

    to my PRO file, but im still having the same errors... Do I have to manually copy the libraries and place them on the project directory? What am i missing?


  • Lifetime Qt Champion

    Are you building your application in 32 or 64 bit ?



  • 32 bit. What im trying to build, for a long time now, is the kiax2 softphone, which can be downloaded at this link

    http://sourceforge.net/p/kiax/code/HEAD/tree/trunk/

    I had to edit some parts, and install a 4.4 version of Qt in order for them to be compatible, and now im stuck with this error, the -leay32 -lssleay32


  • Lifetime Qt Champion

    Can you show your pro file ? What compiler are you using ?



  • @

    template = app
    CONFIG += qt
    CORELIBDIR = ../kiax2core
    INCLUDEPATH += $$CORELIBDIR $$CORELIBDIR/includes $$CORELIBDIR/includes/json $$CORELIBDIR/dottelutils

    set USEWEBKIT to true if you want to link to webkit shared library

    USEWEBKIT = false

    win32 {
    LIBSDIR += $$CORELIBDIR/libs-windows

    LIBS+= -LC:/OpenSSL-Win32/libs
    LIBS += $$LIBSDIR/iaxclient.dll $$LIBSDIR/sqlite3.dll $$CORELIBDIR/release/libkiax2core.a $$LIBSDIR/libjson.a $$LIBSDIR/libcurl-4.dll -leay32 -lssleay32
    DEFINES += WIN32DEP
    }

    KIAXOPT += dottel

    contains( KIAXOPT, dottel ): {
    message("Enabling dottel support..")
    DEFINES += USE_DOTTEL
    HEADERS += Kiax2DotTelDialog.h
    ../kiax2core/dottelutils/dottelutils.h
    ../kiax2core/dottelutils/CppDotTelutils.h
    SOURCES += Kiax2DotTelDialog.cpp

    FORMS += dotteldialog.ui

    INCLUDEPATH += voip/ldns-1.4.0

      #  linux-g++ {
    #            LIBS += $$LIBSDIR/libldns.a -lcrypto
     #   }
        win32 {
                LIBS += $$LIBSDIR/libldns.a -lwsock32 -liphlpapi
        }
    

    }

    comment if you don't have hold() in your iaxclient

    DEFINES += IAXCLIENT_HOLD_HACK

    QT += network
    contains( KIAXOPT, webforms ): {
    message("Using Webforms + WebKit..")
    QT += webkit
    DEFINES += USE_WEBFORMS
    HEADERS += Kiax2ChangePassDialog.cpp
    Kiax2RegisterDialog.h
    SOURCES += Kiax2ChangePassDialog.cpp
    Kiax2RegisterDialog.cpp
    }

    contains( KIAXOPT, webfeed ): {
    message("Using Webfeed + WebKit..")
    QT += webkit
    DEFINES += USE_WEBFEED
    }

    FORMS += kiax2windowAlt.ui
    accountdialog.ui
    aboutdialog.ui
    calldialog.ui
    contactdialog.ui
    contactlistitemwidget.ui
    settingsdialog.ui
    registerdialog.ui
    loginscreen.ui

    HEADERS += Kiax2MainWindow.h
    Kiax2AboutDialog.h
    Kiax2AccountDialog.h
    Kiax2CallDialog.h
    Kiax2ContactDialog.h
    Kiax2ListWidgetItem.h
    Kiax2ContactListItemWidget.h
    Kiax2SettingsDialog.h
    IAX2CallbackHandlerQt.h
    Kiax2ConnectionMeter.h
    Kiax2JSONBalance.h
    Kiax2LoginScreen.h
    Kiax2Application.h
    Kiax2JSONUsersOnline.h
    kiax2JSONNotification.h
    Kiax2JSONServers.h
    Kiax2DispatcherServer.h
    Kiax2DispatcherThread.h
    Kiax2Servers.h
    Kiax2JSONSupernode.h
    Kiax2CallAppearance.h
    Kiax2CallDialogView.h
    Kiax2CallButton.h
    ../kiax2core/PConfiguration.h

    SOURCES += Kiax2MainWindow.cpp
    Kiax2AboutDialog.cpp
    Kiax2AccountDialog.cpp
    Kiax2CallDialog.cpp
    Kiax2ContactDialog.cpp
    Kiax2ListWidgetItem.cpp
    Kiax2ContactListItemWidget.cpp
    Kiax2SettingsDialog.cpp
    IAX2CallbackHandlerQt.cpp
    Kiax2ConnectionMeter.cpp
    Kiax2JSONBalance.cpp
    Kiax2LoginScreen.cpp
    Kiax2Application.cpp
    Kiax2JSONUsersOnline.cpp
    Kiax2JSONNotification.cpp
    Kiax2JSONServers.cpp
    Kiax2DispatcherServer.cpp
    Kiax2DispatcherThread.cpp
    Kiax2Servers.cpp
    Kiax2JSONSupernode.cpp
    Kiax2CallAppearance.cpp
    Kiax2CallDialogView.cpp
    Kiax2CallButton.cpp

    RC_FILE = kiax2.rc

    TRANSLATIONS = kiax2_fr.ts
    kiax2_de.ts
    kiax2_es.ts

    build_all:!build_pass {
    CONFIG -= build_all
    CONFIG += release windows
    }

    install

    target.path = .
    sources.files = $$SOURCES $$HEADERS $$FORMS *.pro
    sources.path = .
    INSTALLS += target
    @

    Im using a custom kit, with minGW 4.8.2 32bit and Qt version 4.8.6
    Qt creator 3.2.1


  • Lifetime Qt Champion

    Strange, it looks fine, did you check that the lib files can indeed be found in C:/OpenSSL-Win32/libs ?

    Another thing, why are you trying to link against these libs ? They are not used directly by kiax2core



  • First of all, I have to appologize, I just followed your instruction without paying a lot of atention, my bad. The folder

    @
    LIBS+= -LC:/OpenSSL-Win32/libs
    @

    doesnt exist, its actually

    @
    LIBS+= -LC:/OpenSSL-Win32/lib
    @

    Stupid mistake, but well, i should have realized.
    Nevertheless, it still doesnt work (but im closer)

    Now i Have only one error, instead of 2, I still have the "cannot find -leay32" (the lssleay32 was fixed!). I dont know exactly what library that one is. Im going to list everything looking "similar" that I can find on my OpenSSL-Win 32 folder.

    On C:\OpenSSL-Win32 i have:
    libeay32.dll
    libssl32.dll
    ssleay32.dll

    On C:\OpenSSL-Win32\lib i have:
    libeay32.lib
    ssleay32.lib

    On C:\OpenSSL-Win32\lib\MinGW I have:
    libeay32.a
    libeay32.def
    ssleay32.a
    ssleay32.def

    On C:\OpenSSL-Win32\lib\VC and on C:\OpenSSL-Win32\lib\VC\static I have:
    libeay32MD.lib
    libeay32MDd.lib
    libeay32MT.lib
    libeay32MTd.lib
    ssleay32MD.lib
    ssleay32MDd.lib
    ssleay32MT.lib
    ssleay32MTd.lib

    On C:\OpenSSL-Win32\exp I have:
    libeay32.exp
    ssleay32.exp

    C:\OpenSSL-Win32\bin I have:
    libeay32.dll
    ssleay32.dll

    bq. Another thing, why are you trying to link against these libs ? They are not used directly by kiax2core

    Im sorry, but i dont understand exaclty what you are asking here. The project as it is, was downloaded from internet, If i comment or exclude anything on the line

    @LIBS += $$LIBSDIR/iaxclient.dll $$LIBSDIR/sqlite3.dll $$CORELIBDIR/release/libkiax2core.a $$LIBSDIR/libjson.a $$LIBSDIR/libcurl-4.dll -leay32 -lssleay32@

    It will start giving hundreds of errors of the type

    @undefined reference to 'function name'@

    Im sorry im not giving much information, I know how to program, but I suck when linking/compiling errors start to appear, when they dont refer to the code itself, but im always open to learning new stuff :D


  • Lifetime Qt Champion

    So since you are using MinGW use C:/OpenSSL-Win32/lib/MinGW

    Don't worry, we're making progress ;)



  • Wow! Thanks for this awesome support. Ive never expected that someone would spend so much time trying to help me. I really appreciate it!

    Well, Ive managed to remove that error. Ive got 28 new ones, but as far as im concerned, they seem to be about something else.

    I changed

    @LIBS+= -LC:/OpenSSL-Win32/lib@

    with

    @LIBS+= -LC:/OpenSSL-Win32/lib/MinGW@

    to include the MinGW libraries, and this brought an unexpected error, now, I have the "cannot find -lssleay32"
    So, if I use the lib folder, im missing -leay32, if I use the MinGW folder, im missing -lssleay32, so my common sense thought "Lets include both!"

    Ive managed to remove this error, now im having these missing functions

    undefined reference to "json_tokener_parse"
    undefined reference to "json_object_object_get"
    undefined reference to "json_object_get_int"
    undefined reference to "json_object_get_string"

    and one last weird error (that I suspect has nothing to do with this issue) that says:

    bq. ./release\Kiax2JSONBalance.o: bad reloc addres 0x5 in section '.text$_ZN13TiXmlDocumentD1EV[__ZN13TiXmlDocumentD1Ev]

    But as I said before, this seems to be something completly different. Im going to google what this json crap is, lets hope I can get this up and running. Im marking this thread as solved, as the -leay32 -lssleay32 errors have finally disappeared

    Thanks for being patient with me, really apreciate it!


Log in to reply
 

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