Windows 64bit shared dll Tesseract? - c++

I think it is possible but I just can’t get the following libs to build as 64 bit as they are built as part of the project but don't take on the bitness of the project (they are built using cppan/cmake):
C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.leptonica-master.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.gif-5.1.4.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.jpeg-9.2.0.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.openjpeg.openjp2-2.1.2.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.png-1.6.23.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.tiff-4.0.6.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.zlib-1.2.8.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.webp-0.5.1.lib
: warning LNK4272: library machine type 'X86' conflicts with target
machine type 'x64'
To build as 64 bit:
Download and install Git, CMake and put them in PATH.
Download the latest CPPAN (C++ Archive Network https://cppan.org/) client from https://cppan.org/client/. CPPAN is a source package distribution system. Add CPPAN client in PATH too. (VS2015 redist is required.)
If you have a release archive, unpack it to tesseract dir. If you're using master branch run
git clone https://github.com/tesseract-ocr/tesseract tesseract
Run
cd tesseract
cppan
mkdir build && cd build
cmake .. -DSTATIC=1
Build a solution (tesseract.sln) in your Visual Studio version.
But I omit the –DSTATIC=1 to get shared.
And I add a new configuration to the solution x64 then I removed the hard coded /machine:X86 from the tesseract and tesseractmain Additional Options in the Linker section.. but the libs built via the cppan-dummy project are still 32 bit.
Ideas?
Regards
Bruce

After a lot of digging and learning about the MSVC build system, if you want a 64 bit shared .dll and .lib import library do this:
goto: https://github.com/peirick/VS2015_Tesseract
Clone the repo.
Change build_tesseract.bat to 64 bit Debug, don't forget to change call "%programfiles% (x86)\Microsoft Visual Studio
14.0\VC\vcvarsall.bat" amd64. Run build_tesseract.bat.
Specify TESS_EXPORTS in Preprocessors definitions of libtesseract project and also change it to .dll from .lib
This might be blindingly obvious to someone in the know, the difficult bit was working out the TESS_EXPORTS bit, only mentioned in code as far as I can tell and also using the above repo as it has all the dependencies. Props to peirick for setting up the repo and getting it all sorted.

Related

library machine type 'x86' conflicts with target machine type 'X64'

I'm using CUDA 9.2 to simulate ray tracing with OpenGL.
I just found out that since my version of CUDA does not support x86 build, so I should use x64 library.
But there's still probrem.
All glut functions that require opengl32.lib make "unresolved external symbol error".
I thought the linker link the opengl32.lib file from x86 folder, but
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\OPENGL32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'X64'
as you can see, my opengl32.lib was definitely in x64 folder.
How can I fix this problem?
How can I use openGL with CUDA?
Maybe you may have a targeting machine platform setting in your CUDA project.
Try see in your project settings -> CUDA -> Common targeting machine platform and change it to 32-bit.
But after CUDA 9.0 version the 86 platform is not supported much
details.
The solution are using old CUDA or new libraries your project depends on.

rocketmq-cpp fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

I am generating rocketmq dll from rocketmq-cpp opensource github Project.I have used folling Prequisite
boost 1.56.0,--> have build using this jam.exe msvc architecture=x86 address-model=64 link=static runtime-link=static stage(which is 64 bit builded)
Cmake 3.9.3
so,i have build rocketmq-cpp using cmake -G "Visual Studio 15 2017" it will generate Project but whenEver i am building project it always shows Error
libboost_thread-vc140-mt-s-1_56.lib(thread.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
But when i have changed boost 1.56.0 to build using 32 bit after that i am getting Error
fatal error LNK1112 libboost_atomic-vc120-mt-1_58 not found .i am not able to find how visual studio searching for libboost_atomic-vc120-mt-1_58 which is not there in boost 1.56.0/stage/lib.i have used
Considering that you have boost 1.56.0 built as a 64-bit library, when building rocketmq-cpp, you have to make sure to also use the 64-bit generator for Visual Studio. After clearing you existing build directory, try using cmake -G "Visual Studio 15 2017 Win64" (note the Win64 prefix)
See https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html

How could I migrate a win32 application to a x64 one?

Recently I worked on a facial recognition application in Visual Stuido 2015. In order to apply cuda libraries to the app, this app needs to migrate from win32 type to x64. I carefully change the configuration manager and moderate everything involved with x86 when making sure every extern dll or lib has its x64 version.
But after compiled in release mode, there is always a error message: "LNK1112 module computer type 'x86' conflicts target computer type 'x64'". The error file is CameraDS.obj which is written by directshow. And I checked the producing .obj files with dumpbin /headers, then discovered the header file values of every .obj is machine (x86). Delete these .obj files or just clean solution doesn't work, and the IDE just throws the same error message. I don't konw why.
Is there any solution?
Is it the source of the lib CameraDS.obj?
https://github.com/souseiki/Stereo-Vision
Just recompile it for x64 as well.
Also check that you haven't left x86 anywhere, look at the answers of fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Module machine type and target machine type Visual Studio 2013

I am running a project with platform WIN32 but my laptop is 64bit. So if I choose the target machine type x64 it will announce :
error LNK1112: module machine type 'X86' conflicts with target machine 'x64' File opencv_ts300.lib
Then when I change the target machine type X86 it will announce
error LNK1112: module machine type 'x64' conflicts with target machine 'X86' File Assemblyinfo.obj.
So what should I do? Please help me. Thank you
Your solution configuration isn't correct. Looks like you mismatched builds in VS "Configuration Manager". Also, it looks like your opencv_ts300.lib is built for x64, so if you don't have x86 built of opencv then you'll have to switch all your projects to x64 as well.
You can't use inline assembly in Visual Studio x64 mode. The assemblyfile.obj is most likely written for x64 anf can't be linked to a x86-compiled c program thereby, causing the second error.

Failing to build Boost 1.60.0 on Windows 10

I've used the Getting Started Guide that is provided from Boost.
Many of the existing problems with somewhat related nature seem to occur within Visual Studio and be due to faulty project settings and linking in particular.
My problems lies in actually getting Boost to build using the Developer Command Prompt for VS2015 and running it as admin.
First I just extracted the folder and ran the VS2015 command prompt from the root folder with
bootstrap.bat
which gave me the following output
C:\Program Files (x86)\boost\boost_1_60_0>bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.
According to the bootstrap.log a lot of required header files were not found. According to the Visual C++ Team Blog the headers, sources and librares is now distributed on a different location on the user machines. This happend to me! I had to move a ton of headers and lib files from for it to find them.
However..... I can't figure out how to go on from this point.
Looking at your output at the end there are 4 suspicious warnings:
..\kernel32.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\advapi32.lib: warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\user32.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\uuid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
Note the machine type, i.e. it probably related to which platform this is running for. Visual Studio Command Prompts come in different forms, make sure that you are running the correct one - In your case the correct one seems to be the VS2015 x64 Native Tools Command Prompt