The Right Way for Building Latest OpenCV for Python 2 x86
I've been building and using OpenCV with Java, Python,... bindings for more than a year without any problem. I've recently started working on a project where I need to build OpenCV for Python 2.7 x86 due to some old dependencies. I have Windows 10 with Visual Studio 2017. Where can I exactly make the switch to x86? I should make a new folder called build86 for example and use another compiler? Or create the Visual Studio solutions as usual and add x86/Win32 configuration?
What about other dependencies that I build before OpenCV (QT, VTK, Tesseract and Leptonica)? Should I build x86 versions before building OpenCV?
And last: how do you propose having DLL's for both 32 and 64 bit versions side by side?
About 32 bits exe with 64 bits dll answer is here : you need to compile everything in 32 bits.
To compile opencv in 32 bits
select VS 15 2017
(Not VS 15 2017 win64)
I have always selected VS 15 2017, without the Win64 part and it has always produced a 64bit version
I can see that in the build configuration in Visual Studio, in the generated pyd file name,
and when I try installing and running the file with a 32bit version of Python.
It would simply give me an error about incompatible packages.
I try and result is
in vs2017 python3 project check if platform is x86 in linker option. I think you will need a 32 bits version of python when you run cmake
You are right it did show x86. I added Python 2 paths to the configuration but for sum reason it did not appear in the summary of the CMake GUI. https://pastebin.com/81LCkTBm
And when I try to compile with Visual Studio I get the following errors: 14>opencv_core400.lib(persistence_cpp.obj) : error LNK2019: unresolved external symbol "public: void __thiscall cv::DefaultDeleter<struct cvfilestorage="">::operator()(struct CvFileStorage *)const " (??R?$DefaultDeleter@UCvFileStorage@@@cv@@QBEXPAUCvFileStorage@@@Z) referenced in function __catch$??$_Setpd@PAUCvFileStorage@@U?$DefaultDeleter@UCvFileStorage@@@cv@@@?$shared_ptr@UCvFileStorage@@@std@@AAEXPAUCvFileStorage@@U?$DefaultDeleter@UCvFileStorage@@@cv@@@Z$0 14>opencv_core400.lib(persistence_cpp.obj) : error LNK2019: unresolved external symbol
@berak can you read comments ? edit button for the question are on the right side
@LBerger, lol, you broke it !
buggy layout is buggy.
already the title "hangs over"
and here is a related issue (to the question): https://github.com/opencv/opencv/issu...
I could compile it and run it sucessfully after the latest updates The biggest problem I faced was picking up the right version of Python since I had both 32bit and 64bit versions of Python 2 and 3 It looks like implicitly specifying the paths for include and lib was not enough as it was still looking for the paths in the PATH variable. I kept only one Python version in the PATH and everything worked as exptected Now I tried compiling with Intel performance libraries, specifically MKL, but I can't seem to find the 32bit version of the libraries. Do they exist?
So I reinstalled both the 32 and 64-bit version of Intel performance libraries and they were detected successfully and compiled without any problem thanks a lot!