c++ - Static build of Qt Qt5Network linking error -


i trying make static build of qt (version 5.4.1) openssl support. configured follows:

configure -opensource -release -c++11 -static -platform win32-msvc2013  -openssl-linked  -i c:\openssl-win32\include  -l c:\openssl-win32\lib\vc\static -nomake examples -nomake tests 

the include , lib directories valid. getting loads of linking errors in qt5network.lib.

qt5network.lib(qhttpnetworkconnectionchannel.obj) : error lnk2019: unresolved ex ternal symbol "public: static class qsharedpointer<class qsslcontext> __cdecl qs slsocketprivate::sslcontext(class qsslsocket *)" (?sslcontext@qsslsocketprivate@ @sa?av?$qsharedpointer@vqsslcontext@@@@pavqsslsocket@@@z) referenced in function  "protected: void __thiscall qhttpnetworkconnectionchannel::_q_connected(void)" (?_q_connected@qhttpnetworkconnectionchannel@@iaexxz) qt5network.lib(qhttpprotocolhandler.obj) : error lnk2019: unresolved external sy mbol "public: __int64 __thiscall qsslsocket::encryptedbytestowrite(void)const " (?encryptedbytestowrite@qsslsocket@@qbe_jxz) referenced in function "private: vi rtual bool __thiscall qhttpprotocolhandler::sendrequest(void)" (?sendrequest@qht tpprotocolhandler@@eae_nxz) c:\qt\5.4\qtbase\bin\xmlpatterns.exe : fatal error lnk1120: 31 unresolved extern als jom: c:\qt\5.4\qtxmlpatterns\tools\xmlpatterns\makefile [release] error 2 jom: c:\qt\5.4\qtxmlpatterns\tools\makefile [sub-xmlpatterns-make_first] error 2  jom: c:\qt\5.4\qtxmlpatterns\makefile [sub-tools-make_first] error 2 jom: c:\qt\5.4\makefile [module-qtxmlpatterns-make_first] error 2 

i able create static build before without openssl support. error messages suggest, problem associated openssl.

does has idea resolve this?

update

these configurations producing same error:

configuration 1:

configure -opensource -release -c++11 -static -platform win32-msvc2013  -openssl-linked  -i c:\openssl-win32\include -l c:\openssl-win32\lib\vc\static  openssl_libs="-llibeay32mt -lssleay32mt" -nomake examples -nomake tests 

configuration 2:

configure -opensource -release -c++11 -static -platform win32-msvc2013  -openssl  -i c:\openssl-win32\include -l c:\openssl-win32 -nomake examples -nomake tests 

update 2

i tried follow great tutorial in qbittorrent wiki, , got same errors.

if indeed qt bug, frank suggested in his comment, useful if suggest last version of qt, should work.

update 3

on bugreports.qt.io have received opinion, not bug:

you haven't told build link openssl libraries. http://doc.qt.io/qt-5/ssl.html gives following example:

openssl_libs='-l/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked

you'll need tweak compiler , library locations of course.

on referred documentation page example given:

openssl_libs='-l/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked 

i not find ssl or crypto libraries in openssl build compiled, nor in binary distribution. have headers though. have ssleay32 , libeay32 libraries.

the configure command hint set these libraries mentioned variable:

note: when linking against openssl, can override default library names through openssl_libs , optionally openssl_libs_debug/openssl_libs_release example:     configure -openssl-linked openssl_libs="-lssleay32 -llibeay32" 

by setting variable still same errors.

update 5

not wanted, step forward:

i have downloaded sources (4 days ago) released qt 5.4.2, , able create static build dynamicly linked openssl (-openssl switch).

i still looking solution staticly link openssl. still have same linking errors.

this how build qt 5.7.1 ssl , mysql support on windows using msvc 2013:

make sure perl, python , ruby can found in path environment variable.

download qt github repository:

cd c:\qt git clone https://github.com/qt/qt5.git cd c:\qt\qt5  git checkout 5.7  

make sure checkout commit 36e7cff94fbb4af5d8de6739e66164c6e6873586. @ time, checking out 5.7 that.

place contents below in qt5vars.bat located @ c:\qt\qt5. make adjustments if need to:

@echo off  rem set \microsoft visual studio 2015, <arch> \c amd64, \c x86, etc. call "c:\program files (x86)\microsoft visual studio 12.0\vc\vcvarsall.bat" x86  rem edit location point source code of qt set _root=c:\qt\qt5  set path=%_root%\qtbase\bin;%_root%\gnuwin32\bin;%path%  rem uncomment below line when using git checkout of source repository set path=%_root%\qtrepotools\bin;%path%  rem uncomment below line when building openssl enabled. if so, make sure directory points rem correct location (binaries openssl). set path=c:\openssl-win32\bin;%path%  rem when compiling icu, uncomment lines below , change <icupath> appropriately: rem set include=<icupath>\include;%include% rem set lib=<icupath>\lib;%lib% rem set path=<icupath>\lib;%path%  rem contrary earlier recommendations, not set qmakespec.  set _root=  rem keeps command line open when script run. cmd /k 

after that, execute file , initiate repository:

qt5vars.bat  perl init-repository 

finally, configure , compile library (with debug , release versions), make sure paths referenced configure valid on system:

configure -static -static-runtime -debug-and-release -ssl -openssl -openssl-linked -qt-sql-mysql -opengl dynamic -platform win32-msvc2013 -prefix c:\qt\qt5.7-msvc2013-static -nomake tests -nomake examples -i "c:\program files (x86)\mysql\mysql connector.c 6.1\include" -i "c:\openssl-win32\include" -l "c:\program files (x86)\mysql\mysql connector.c 6.1\lib" -l "c:\openssl-win32\lib\vc\static" openssl_libs="-luser32 -ladvapi32 -lgdi32 -lcrypt32" openssl_libs_debug="-lssleay32mtd -llibeay32mtd" openssl_libs_release="-lssleay32mt -llibeay32mt" nmake nmake install 

everything far should have run smoothly , beautifully. it's matter of configuring qt creator detect new qt version , create new kit use on projects:


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -