fongoses / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

Static linking should be possible, especially given liblept-static-mtdll.lib #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to write a program using liblept that links statically to C RTL
2.
3.

What is the expected output? What do you see instead?
A nice program with no dynamic runtime library dependencies.  Instead there are 
linker errors about library conflicts.

What version of the product are you using? On what operating system?
168

Please provide any additional information below.
The "static-mtdll" versions of giflib, libjpeg, etc. and perhaps consequently 
leptonica show dumpbin /DIRECTIVES of MSVCRT (IIRC) which implies /MD (linking 
to dynamic C RTL) rather than /MT (linking to static LIBCMT).  This prevents 
programs using the library from linking statically to C.  I think that the 
problem starts with underlying libraries with the possibly deceptive names or 
bad code generation options.

Original issue reported on code.google.com by kwalc...@gmail.com on 1 Feb 2014 at 6:55

GoogleCodeExporter commented 9 years ago
Oh, using VS 2008 on Windows 7

Original comment by kwalc...@gmail.com on 1 Feb 2014 at 6:57

GoogleCodeExporter commented 9 years ago
No more downloads are possible on code.google.com.

There is a new version, 1.70, available at leptonica.org.  Suggest that you use 
it.

MS builds are handled by Tom Powers.  I'll make sure he sees your issue.  He 
can likely advise you on static linking.

Original comment by dan.bloo...@gmail.com on 1 Feb 2014 at 6:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
By design. Won't Fix. 

<someImageLibrary>-static-mtdll.lib is a static library that liblept will be 
statically linked to. However, the image libraries (and liblept) always link to 
the MultiTheaded C RunTime DLL.

See [1] for rationale.

liblept168-static-mtdll.lib is a static library that you can link STATICALLY to 
your program (along with all the other required static image libraries). 
However, it still links to the MultiTheaded C RunTime DLL, thus the -mtdll part 
of the name.

This is opposed to liblept168.lib which is an IMPORT library which you use to 
link to the liblept168.dll (no additional linking to image libraries required).

If you want something different, you'll have to build the libraries & leptonica 
yourself.

[1] 
http://tpgit.github.io/UnOfficialLeptDocs/vs2008/building-image-libraries.html#u
sing-the-same-runtime-library

Original comment by tomp2...@gmail.com on 1 Feb 2014 at 7:04

GoogleCodeExporter commented 9 years ago

Original comment by dan.bloo...@gmail.com on 6 Feb 2014 at 3:56