Comments (10)
I receive linker warnings and errors when trying to build Leptonica and Tesseract with Visual Studio 2017.
-
How do you build them?
Please provide commands. -
What are you trying to achieve in the end?
Link lept and tess into your app?
I suspect bad build type somewhere.
from sw.
Egor, thanks for your quick response. Below are my answers to your questions, but I only posted the linker commands for Leptonica. Please let me know if you need anything else.
1.)
mkdir win64 && cd win64
cmake -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=1 -DSW_BUILD_SHARED_LIBS=0 ..
Then I use Visual Studio 2017 to build a release version of the DLL. The linker command line is as follows:
/OUT:"E:\src\repo\leptonica\win64\bin\Release\leptonica-1.80.0.dll" /MANIFEST /NXCOMPAT /PDB:"E:/src/repo/leptonica/win64/bin/Release/leptonica-1.80.0.pdb" /DYNAMICBASE "C:.sw\storage\pkg\89\dc\64e7\obj\bld\135497\lib\org.sw.demo.gif-5.2.1.lib" "C:.sw\storage\pkg\a9\0c\280b\obj\bld\135497\lib\org.sw.demo.jpeg-9.4.0.lib" "C:.sw\storage\pkg\28\39\9564\obj\bld\135497\lib\org.sw.demo.glennrp.png-1.6.37.lib" "C:.sw\storage\pkg\f5\fe\083c\obj\bld\135497\lib\org.sw.demo.tiff-4.1.0.lib" "C:.sw\storage\pkg\79\7b\0892\obj\bld\135497\lib\org.sw.demo.webmproject.webp-1.0.3.lib" "C:.sw\storage\pkg\f7\91\f458\obj\bld\135497\lib\org.sw.demo.uclouvain.openjpeg.openjp2-2.3.1.lib" "C:.sw\storage\pkg\ce\99\b2f8\obj\bld\135497\lib\org.sw.demo.madler.zlib-1.2.11.lib" "C:.sw\storage\pkg\76\c7\435a\obj\bld\135497\lib\org.sw.demo.facebook.zstd.zstd-1.4.4.lib" "C:.sw\storage\pkg\25\78\4a4d\obj\bld\135497\lib\org.sw.demo.mgk25.jbig.jbig-2.1.0.lib" "C:.sw\storage\pkg\60\89\7ba0\obj\bld\135497\lib\org.sw.demo.mgk25.jbig.ar-2.1.0.lib" "kernel32.lib" "oldnames.lib" "concrtd.lib" "msvcprtd.lib" "vcruntimed.lib" "msvcrtd.lib" "ucrtd.lib" "C:.sw\storage\pkg\2a\68\57cb\obj\bld\135497\lib\org.sw.demo.xz_utils.lzma-5.2.4.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib" /IMPLIB:"E:/src/repo/leptonica/win64/src/Release/leptonica-1.80.0.lib" /DLL /MACHINE:X64 /INCREMENTAL:NO /PGD:"E:\src\repo\leptonica\win64\bin\Release\leptonica-1.80.0.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"leptonica.dir\Release\leptonica-1.80.0.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
Additional Options:
%(AdditionalOptions) /machine:x64
I receive the following warning/error for both Leptonica & Tesseract:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
2.) I use Leptonica and Tesseract for OCR in my application. I've been building the DLLs for a few years with CPPAN and now SW.
from sw.
-
Try to update sw (
sw --self-upgrade
or manually), runsw setup
.
This will update cmake integration script in the system.
Run your commands again. -
What is your build system? If it is cmake, then it is easy to integrate lept/tess there like in this example: https://github.com/SoftwareNetwork/sw/blob/master/test/integrations/cmake/tess/CMakeLists.txt
from sw.
Also I've tested your workflow with leptonica, everything works fine as expected. I assume you have old sw/sw cmake integration.
I've added cmake integration version check, so it will notice users automatically in the future.
dae1dfe#diff-6f4bb1c6a0597a0398b5992992cbed92R157
from sw.
I wiped my SW folders, downloaded the current SW, did sw setup, downloaded the Leptonica source again, recompiled with Visual Studio and got the same LNK4098 link warning.
I also tried the following:
cmake -DBUILD_SHARED_LIBS=1 -DSW_BUILD_SHARED_LIBS=0 ..
cmake --build .
The build outputs a debug DLL when I'm expecting a release version. I also tried adding -DCMAKE_BUILD_TYPE=Release, but still get a debug DLL when building with cmake; below is the output.
Creating library R:/leptonica-master/win64/src/Debug/leptonica-1.80.0d.lib and object R:/leptonica-master/win64/src/Debug/leptonica-1.80.0d.exp
leptonica.vcxproj -> R:\leptonica-master\win64\bin\Debug\leptonica-1.80.0d.dll
Building Custom Rule R:/leptonica-master/CMakeLists.txt
In researching the LNK4098 issue I saw trying to link release and debug libs can cause this issue. If you have any other suggestions please let me know. Thank you!
from sw.
cmake --build . --config Release
to build release binaries.
from sw.
Run cmake -DBUILD_SHARED_LIBS=1 -DSW_BUILD_SHARED_LIBS=0 .. -DSW_DEBUG=1
, it will show sw command.
Run that command manually with -trace
argument. Post results.
from sw.
Below is a text document with the output. Thank you!
from sw.
Of note I tried to compile Tesseract with cmake using the --config Release flag and the failure is noted below. tesseract.txt shows the full verbose output. Hope this is helpful to you.
R:\tesseract-master\Win64>cmake -DBUILD_SHARED_LIBS=1 -DSW_BUILD_SHARED_LIBS=0 ..
R:\tesseract-master\Win64>cmake --build . --config Release
Auto build dll exports
msvcprtd.lib(locale0_implib.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in adaptions.obj [R:\tesseract-master\Win64\libtesseract.vcxproj]
Creating library R:/tesseract-master/Win64/Release/tesseract50.lib and object R:/tesseract-master/Win64/Release/tesseract50.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library [R:\tesseract-master\Win64\libtesseract.vcxproj]
R:\tesseract-master\Win64\bin\Release\tesseract50.dll : fatal error LNK1319: 1 mismatches detected [R:\tesseract-master\Win64\libtesseract.vcxproj]
tessopt.vcxproj -> R:\tesseract-master\Win64\bin\Release\tessopt.dll
from sw.
Ok, confirmed, reproduced and fixed. Thank you.
sw --self-upgrade
and try again.
from sw.
Related Issues (20)
- Error compiling for iOS arm64 from macOS arm64 HOT 55
- Exception when executing: sw build org.sw.demo.google.tesseract.tesseract HOT 1
- Can't build podofo HOT 2
- i don't know why, HOT 3
- when I run sw build org.sw.demo.googke.tesseract -trace HOT 1
- Trying to Build tesseract - Errors from SW HOT 13
- SW is needed to build SW, server down HOT 1
- "Cannot find compiler" error in leptonica Windows build HOT 6
- No target resolved: pub.egorpugin.primitives.hash-master HOT 26
- ABSL file not found HOT 2
- swgui for Windows deprecated HOT 2
- Unknown CMake command "sw_add_package". HOT 7
- SSL connect error HOT 1
- windows tesseract build error (the error is on the SW side) HOT 2
- Tesseact 5.3.3 build issue HOT 6
- sw stuck while building tesseract HOT 2
- lua not built when adding sol2 dependency HOT 3
- CMake Error for SW: Non-zero exit code HOT 10
- sw setup failed HOT 2
- Leptonica Build error for dynamic Library HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sw.