Qt static build from source: Visual Studio 2017 and x86 and openssl



  • I realise I'm by no means the first person to ask for help on this but hopefully someone might spot something I'm doing wrong with my approach in attempting a static build of Qt 5.9.2 from source (github or zip download) with a Visual Studio 2017 x86 native tools command prompt AND openssl. I have read through a lot of similar issues on this forum which have helped here and there but I'm not up to build attempt 20 and seem to be going around in circles.

    For openssl I have a static build of 1.0.2 and just to prove it's working:

    // cl /c /EHsc openssltest.cpp -IF:\deps\openssl\1.0.2\vc141-x86\include
    // link openssltest.obj /LIBPATH:F:\deps\openssl\1.0.2\vc141-x86\lib libeay32.lib ssleay32.lib gdi32.lib user32.lib wsock32.lib advapi32.lib
    
    #include <iostream>
    #include <openssl/ssl.h>
    #include <openssl/err.h>
    #include <openssl/bio.h>
    
    int main() {
    	
      BIO * bio;
      SSL * ssl;
      SSL_CTX * ctx;
      
     SSL_load_error_strings();
     ERR_load_BIO_strings();
     OpenSSL_add_all_algorithms();
    
     SSL_library_init();
    ctx = SSL_CTX_new(SSLv23_client_method());
    
    if (ctx == NULL) {
    	std::cout << "SSL context is null" << std::endl;
    }
    else {
    	std::cout << "Context successfully created." << std::endl;
    }
    	
    SSL_CTX_free(ctx);
    }
    

    And then executing the result WITHOUT copying any additional dll's:

    f:\Temp>openssltest
    Context successfully created.

    I am able to successfully build Qt 5.9.2 WITHOUT openssl using a configure command of:

    ..\configure -prefix F:\deps\qt\5.9.2\vc141-x86\release -platform win32-msvc -release -opensource -confirm-license -strip -no-shared -static -no-static-runtime -ltcg -make libs -make tools -nomake examples -no-compile-examples -no-dbus -no-qml-debug -no-icu -no-gtk -no-opengl -no-opengles3 -no-angle -no-sql-sqlite -no-sql-odbc -no-sqlite -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -recheck-all -no-openssl
    

    The problem is now that when I attempt to add the parameters to include openssl in the build it fails with unresolved openssl symbols.

    ..\configure -prefix F:\deps\qt\5.9.2-ssl\vc141-x86\release -platform win32-msvc -release -opensource -confirm-license -strip -no-shared -static -no-static-runtime -ltcg -make libs -make tools -nomake examples -no-compile-examples -no-dbus -no-qml-debug -no-icu -no-gtk -no-opengl -no-opengles3 -no-angle -no-sql-sqlite -no-sql-odbc -no-sqlite -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -recheck-all -ssl -openssl-linked -IF:\deps\openssl\1.0.2\vc141-x86\include -LF:\deps\openssl\1.0.2\vc141-x86\lib OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32 -luser32 -lwsock32 -ladvapi32"
    

    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -O2 -MD -utf-8 -D_HAS_EXCEPTIONS=0 -GL -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -DUNICODE -D_UNICODE -DWIN32 -DBROWSER_QTEXTBROWSER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_HELP_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DNDEBUG -IF:\deps\qt-src-5.9.2\qttools\src\assistant\assistant -I. -IF:\deps\qt-src-5.9.2\qttools\src\shared\fontpanel -IF:\deps\qt-src-5.9.2\qttools\include -IF:\deps\qt-src-5.9.2\qttools\include\QtHelp -I......\include -I......\include\QtHelp -IF:\deps\qt-src-5.9.2\qtbase\include -IF:\deps\qt-src-5.9.2\qtbase\include\QtPrintSupport -IF:\deps\qt-src-5.9.2\build\qtbase\include -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtPrintSupport -IF:\deps\qt-src-5.9.2\qtbase\include\QtWidgets -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtWidgets -IF:\deps\qt-src-5.9.2\qtbase\include\QtGui -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtGui -IF:\deps\qt-src-5.9.2\qtbase\include\QtNetwork -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtNetwork -IF:\deps\qt-src-5.9.2\qtbase\include\QtSql -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtSql -IF:\deps\qt-src-5.9.2\qtbase\include\QtCore -IF:\deps\qt-src-5.9.2\build\qtbase\include\QtCore -I.moc\release -I.uic -IF:\deps\openssl\1.0.2\vc141-x86\include -IF:\deps\qt-src-5.9.2\qtbase\mkspecs\win32-msvc -Fo.obj\release\ @C:\Users\Aaron\AppData\Local\Temp\nmDA9.tmp
    moc_fontpanel.cpp
    moc_aboutdialog.cpp
    moc_bookmarkdialog.cpp
    moc_bookmarkfiltermodel.cpp
    moc_bookmarkmanager.cpp
    moc_bookmarkmanagerwidget.cpp
    moc_bookmarkmodel.cpp
    moc_centralwidget.cpp
    moc_contentwindow.cpp
    moc_findwidget.cpp
    moc_filternamedialog.cpp
    moc_helpenginewrapper.cpp
    moc_helpviewer.cpp
    moc_helpviewer_p.cpp
    moc_indexwindow.cpp
    moc_mainwindow.cpp
    moc_preferencesdialog.cpp
    moc_qtdocinstaller.cpp
    moc_remotecontrol.cpp
    moc_searchwidget.cpp
    Compiling...
    moc_topicchooser.cpp
    moc_openpagesmodel.cpp
    moc_globalactions.cpp
    moc_openpageswidget.cpp
    moc_openpagesmanager.cpp
    moc_openpagesswitcher.cpp
    moc_stdinlistener_win.cpp
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /LTCG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /VERSION:5.9 /MANIFEST:embed /OUT:......\bin\assistant.exe @C:\Users\Aaron\AppData\Local\Temp\nmDD4.tmp
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ASN1_INTEGER_get
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ASN1_STRING_data
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ASN1_STRING_length
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ASN1_STRING_to_UTF8
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_ctrl
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_new_mem_buf
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_read
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_s_mem
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BIO_write
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BN_num_bits
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BN_mod_word
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_KEY_get0_group
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_GROUP_get_degree
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _CRYPTO_num_locks
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_locking_callback
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_id_callback
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _CRYPTO_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _DSA_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _DSA_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _d2i_X509
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ERR_error_string
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ERR_get_error
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ERR_free_strings
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_cleanup
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_init
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_ctrl
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_set_key_length
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CipherInit
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CipherUpdate
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_CipherFinal
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_des_cbc
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_des_ede3_cbc
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_rc2_cbc
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_assign
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_set1_RSA
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_set1_DSA
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_set1_EC_KEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_get1_DSA
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_get1_RSA
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_get1_EC_KEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_type
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _i2d_X509
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_nid2sn
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_nid2ln
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_sn2nid
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_ln2nid
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _i2t_ASN1_OBJECT
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_obj2txt
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OBJ_obj2nid
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_PrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_DSAPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_RSAPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_ECPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_DHparams
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_DSAPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_RSAPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_ECPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_DSA_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_RSA_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_EC_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_DSA_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_RSA_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_EC_PUBKEY
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _RAND_seed
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _RAND_status
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _RSA_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _RSA_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_num
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_pop_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_new_null
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_push
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _sk_value
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_accept
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_clear
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CIPHER_description
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CIPHER_get_bits
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_connect
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_check_private_key
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_ctrl
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_cipher_list
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_default_verify_paths
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_verify
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_verify_depth
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_certificate
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_certificate_file
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_PrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_RSAPrivateKey
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_PrivateKey_file
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_get_cert_store
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_ciphers
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_current_cipher
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_version
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_error
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_peer_cert_chain
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_peer_certificate
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_verify_result
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_library_init
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_load_error_strings
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_ctrl
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_read
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_bio
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_accept_state
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_connect_state
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_shutdown
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_session
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_SESSION_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get1_session
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_session
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_ex_new_index
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_ex_data
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get_ex_data
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_psk_client_callback
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_psk_server_callback
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_use_psk_identity_hint
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLv3_client_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLv23_client_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_client_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_1_client_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_2_client_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLv3_server_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLv23_server_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_server_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_1_server_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _TLSv1_2_server_method
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_write
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_cmp
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_dup
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_print
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_EXTENSION_get_object
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_get_ext
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_get_ext_count
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_get_ext_d2i
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509V3_EXT_get
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509V3_EXT_d2i
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_EXTENSION_get_critical
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_EXTENSION_get_data
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BASIC_CONSTRAINTS_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _AUTHORITY_KEYID_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _ASN1_STRING_print
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_check_issued
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_get_issuer_name
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_get_subject_name
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_verify_cert
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_NAME_entry_count
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_NAME_get_entry
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_NAME_ENTRY_get_data
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_NAME_ENTRY_get_object
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_PUBKEY_get
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_add_cert
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_init
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_set_purpose
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_get_error
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_get_error_depth
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_get_current_cert
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_get_chain
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _X509_STORE_CTX_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OPENSSL_add_all_algorithms_noconf
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _OPENSSL_add_all_algorithms_conf
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_load_verify_locations
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLeay
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSLeay_version
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _i2d_SSL_SESSION
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _d2i_SSL_SESSION
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_select_next_proto
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_next_proto_select_cb
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get0_next_proto_negotiated
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_set_alpn_protos
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_CTX_set_alpn_select_cb
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _SSL_get0_alpn_selected
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _DH_new
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _DH_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _d2i_DHparams
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _i2d_DHparams
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _DH_check
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _BN_bin2bn
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_KEY_dup
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_KEY_new_by_curve_name
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_KEY_free
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_get_builtin_curves
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _EC_curve_nist2nid
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PKCS12_parse
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _d2i_PKCS12_bio
    Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2001: unresolved external symbol _PKCS12_free
    ......\bin\assistant.exe : fatal error LNK1120: 197 unresolved externals
    NMAKE : fatal error U1077: '"f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\link.EXE"' : return code '0x460'
    Stop.
    NMAKE : fatal error U1077: '"f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.

    I have tried different permutations of configure parameters and different openssl builds. I do occasionally get different build errors but most of the time it's an unresolved openssl related symbol.



  • And of course as soon as I finally give up and post in the forum my build works. Mind you it's been 4 solid days and be my 23rd or 24th attempt...

    In the end I think it was a combination of getting the right version of a static openssl build and the OPENSSL_LIBS config parameter set correctly (I also had the OPENSSL_LIBS environment variable set which seemed to conflict with the config parameter).

    Below are my steps (you'll need to modify the build paths as required). All builds were performed from the "Visual Studio 2017 x86 Native Tools Command Prompt".

    OpenSSL 1.0.2 Static Build

    (note needs to be version 1.0.x, Qt does not yet support 1.1.x)

    • git clone https://github.com/openssl/openssl.git
    • git checkout OpenSSL_1_0_2-stable
    • perl configure VC-WIN32 no-shared enable-static-engine --prefix=f:\deps\openssl\1.0.2\vc141-x86
    • ms\do_nasm
    • nmake -f ms\nt.mak (DOUBLE CHECK that you type ms\nt.mak NOT ms\ntdll.mak)
    • nmake -f ms\nt.mak install

    Qt 5.9.2 Static Build

    • git clone https://code.qt.io/qt/qt5.git (an alternative is to use the qt-everywhere-opensource-src-5.9.2.zip file)
    • git checkout 5.9.2
    • cd qt5 && mkdir build && cd build
    • ..\configure -prefix F:\deps\qt\5.9.2-git-ssl\vc141-x86\release -platform win32-msvc -release -opensource -confirm-license -strip -no-shared -static -no-static-runtime -ltcg -make libs -make tools -nomake examples -no-compile-examples -no-dbus -no-qml-debug -no-icu -no-gtk -no-opengl -no-opengles3 -no-angle -no-sql-sqlite -no-sql-odbc -no-sqlite -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -recheck-all -ssl -openssl-linked -IF:\deps\openssl\1.0.2\vc141-x86\include -LF:\deps\openssl\1.0.2\vc141-x86\lib OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32 -luser32 -lwsock32 -ladvapi32"
    • nmake
    • nmake install

    Pay particular attention to the include, library and OPENSSL_LIBS paths in the configure.bat parameters. Getting those right is what eventually got my build working.


Log in to reply
 

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