libHaru 2.3.0RC2 and Visual Studio 2010

2,861 views
Skip to first unread message

Felix Maier

unread,
Feb 20, 2012, 7:17:02 AM2/20/12
to libHaru
dear all,

I'm trying to build the DLL of libHaru 2.3.0RC2 on Visual Studio 2010.
I did the following steps:

1) Extracted the tar.gz file to c:\libharu

2) Using Visual studio command prompt: nmake -f script/
Makefile.msvc_dll
-> Getting a error message that 'zlib.h' and 'zconf.h' is missing

3) Get zlib-1.2.6 and extract 'zlib.h' and 'zconf.h' to 'c:\libharu
\include'

4) Run nmake again, getting a error message that 'png.h' and
'pngconf.h' is missing

5) Get libpng-1.2.47

6) Extract 'png.h' and 'pngconf.h' to 'c:\libharu\include'

7) Run nmake again, resulting in the following error:

=================================================================
C:\libharu>nmake -f script/Makefile.msvc_dll

Microsoft (R) Program Maintenance Utility, Version 10.00.30319.01
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.


cl -Fosrc\hpdf_image_ccitt.obj /MD -nologo -O2 -Iinclude -
Iwin32\include
-I"../../libpng"\include -I"../../zlib"\include -DHPDF_DLL_MAKE -c
src\hpdf_i
mage_ccitt.c
hpdf_image_ccitt.c
src\hpdf_image_ccitt.c(761) : error C2373:
'HPDF_Image_LoadRaw1BitImageFromMem':
Neudefinition; unterschiedliche Modifizierer
include\hpdf.h(769): Siehe Deklaration von
'HPDF_Image_LoadRaw1BitImageF
romMem'
NMAKE : fatal error U1077: ""c:\Programme\Microsoft Visual Studio
10.0\VC\BIN\cl
.EXE"": Rückgabe-Code "0x2"
Stop.

C:\libharu>

===================================================================

It tells me that HPDF_Image_LoadRaw1BitImageFromMem is redefinied and
has different modifieres. I hope thats the right translation from
german to english.

What went wrong?

best regards,
Felix

Marten Feldtmann

unread,
Feb 20, 2012, 7:38:54 AM2/20/12
to lib...@googlegroups.com
I saw this too - its a pretty mess under Windows.

Am 20.02.2012 13:17, schrieb Felix Maier:

>
> cl -Fosrc\hpdf_image_ccitt.obj /MD -nologo -O2 -Iinclude -
> Iwin32\include
> -I"../../libpng"\include -I"../../zlib"\include -DHPDF_DLL_MAKE -c
> src\hpdf_i
> mage_ccitt.c
> hpdf_image_ccitt.c
> src\hpdf_image_ccitt.c(761) : error C2373:
> 'HPDF_Image_LoadRaw1BitImageFromMem':
> Neudefinition; unterschiedliche Modifizierer
> include\hpdf.h(769): Siehe Deklaration von
> 'HPDF_Image_LoadRaw1BitImageF
> romMem'
> NMAKE : fatal error U1077: ""c:\Programme\Microsoft Visual Studio
> 10.0\VC\BIN\cl

> .EXE"": R�ckgabe-Code "0x2"
> Stop.

Felix Maier

unread,
Feb 20, 2012, 8:33:25 AM2/20/12
to lib...@googlegroups.com
any idea how to solve the problem?

CarlosRPEvertsz

unread,
Aug 31, 2012, 10:07:50 AM8/31/12
to lib...@googlegroups.com
Compiling this with MS VC++ is a real nightmare.
Where did you find all the header files beginning with z*.h and *png*.h ?  I found some of them in google, but has different references than the creator ones.

>> .EXE"": R�ckgabe-Code "0x2"
>> Stop.
>

Antony Dovgal

unread,
Sep 1, 2012, 1:45:47 PM9/1/12
to lib...@googlegroups.com
On 2012-08-31 18:07, CarlosRPEvertsz wrote:
> Compiling this with MS VC++ is a real nightmare.
> Where did you find all the header files beginning with z*.h and *png*.h ? I found some of them in google, but has different references than the creator ones.

Come on, ZLib and libpng are probably two the most widely used open source libraries ever and you're saying you can't find them in Google?
http://www.zlib.net
http://www.libpng.org

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

Paul Harris

unread,
Sep 1, 2012, 7:59:50 PM9/1/12
to lib...@googlegroups.com
On 2 September 2012 01:45, Antony Dovgal <to...@daylessday.org> wrote:
On 2012-08-31 18:07, CarlosRPEvertsz wrote:
Compiling this with MS VC++ is a real nightmare.
Where did you find all the header files beginning with z*.h and *png*.h ?  I found some of them in google, but has different references than the creator ones.

Come on, ZLib and libpng are probably two the most widely used open source libraries ever and you're saying you can't find them in Google?
http://www.zlib.net
http://www.libpng.org


I had to fix a bunch of cmake issues,

procedure:

 ---------------

(WINDOWS ONLY)
zlib (zlib library)
from release tarballs
build with cmake, both static and dynamic in same target
CMAKE
   adjust both CMAKE_INSTALL_PREFIX and INSTALL_* flags
EXTRA for msvc 2010-x64 (as of cmake 2.8.8)
   Set the "Target Machine" for zlibstatic (see instruction-module below)

WINDOWS: copy pdb files into bin dir
(cygwin)
cd build_zlib
find -name "zlib*.pdb" -exec cp -v '{}' install/bin/ \;


-------------

(WINDOWS ONLY)
libpng (png library)
build with cmake, static and dynamic in SEPERATE build folders
as we need to link each to the zlib static/dynamic lib

GIT branch:
   git checkout -b libpng15 origin/libpng15
CMAKE
   adjust CMAKE_INSTALL_PREFIX
   set ZLIB_*
   win: set zlib library to zlibstatic.lib (for static) and zlib.lib (for shared)
   Turn off PNG_STATIC / PNG_SHARED as appropriate.
   Build RelWithDebInfo + Debug
after build + install, copy the BUILD/RelWithDebInfo/libpng15.pdb file into BUILD/install/bin

-------------

libharu (PDF writer library)
source from: git clone g...@github.com:paulharris/libharu.git libharu
build with cmake, separate static/dynamic due to static/dynamic zlib/png.
   (NOTE - all builds can share same source folder)
WINDOWS CMAKE:
   set CMAKE_INSTALL_PREFIX
   set ZLIB_*
   cycle 2: set PNG_*
   NOTE set zlib library to zlibstatic.lib (for static) and zlib.lib (for shared).  ditto for libpng.
   Turn off LIBHPDF_STATIC / LIBHPDF_SHARED as appropriate.
LINUX cmake:
   set CMAKE_INSTALL_PREFIX
   Turn off LIBHPDF_STATIC / LIBHPDF_SHARED as appropriate.
   enable LIBHPDF_ENABLE_EXCEPTIONS (add -fexceptions to CMAKE_C_FLAGS)

make
make install

Bill Horger

unread,
Sep 1, 2012, 11:40:32 PM9/1/12
to lib...@googlegroups.com
I have (but not available to me until Tuesday) a VC 2008 implementation of Libharu and Zlib (and mayne PNG as well).

Once I gain access again, I'll get the details on the project definitions and re-construct how I got the libraries installed and placed appropriately.

And yes, VC is kind of a nightmare to get all this up.

Hopefully, on Tuesday, I'll get the data that can help.

--
---
libHaru.org development mailing list
To unsubscribe, send email to libharu-u...@googlegroups.com

Bill Horger

unread,
Sep 6, 2012, 11:34:37 PM9/6/12
to lib...@googlegroups.com
1.       I compile the Libharu as a library, not DLL. I do this for a specific reason; the code has to run on any machine where it gets installed, so I limit the DLL’s (to zero) that have to get delivered.

a.       The hpdf_config.h file is set so that I will build the library with both PNG as ZLIB functionality.
#define LIBHPDF_HAVE_LIBZ  1
#define LIBHPDF_HAVE_LIBPNG  1

b.      The .h files are referenced in the LibHaru code as system .h files (i.e. #include <zlib.h>).

c.       The .h files for ZLIB appear in the following directories on my machine:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
C:\Program Files\Microsoft Visual Studio 9.0\VC\include

2.       I have an additional layer of code that allows me to separate the LibHaru calls by one additional level from the library. This is also built as a library.

3.       The application layer calls out the zlib and the png libraries as an additional dependency (Properties::Linker::Input::Additional Dependencies) for the Link step. In addition, I specifically call out my LibHaru library and my abstraction layer specifically (Properties::Linker::General::Additional Library Directories). I had added the ZLIB and PNGLIB libraries to the System library folder in the following two folders:
The directory for the .lib files are:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
These also appear in several other folders as well, but they are all the same file.
I could have just added the reference to the libraries to where I had unzipped the library initially, telling VC where these specific library files are located.


Hope this helps.

Bill



On Fri, Aug 31, 2012 at 8:07 AM, CarlosRPEvertsz <crp...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages