You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Stefan Hett <st...@egosoft.com> on 2016/01/04 11:41:15 UTC

Re: Compiling ZLIB for svn 1.9.3 on Windows 7 using MSVC 2008

On 12/31/2015 10:31 AM, Cooke, Mark wrote:
>> -----Original Message-----
>> From: Ivan Zhakov [mailto:ivan@visualsvn.com]
>> Sent: 30 December 2015 18:59
>>
>> On 30 December 2015 at 19:06, Cooke, Mark <ma...@siemens.com> wrote:
>>> [Updates below]
>>>
>>>> -----Original Message-----
>>>> From: Cooke, Mark [mailto:mark.cooke@siemens.com]
>>>> Sent: 30 December 2015 15:56
>>>>
>>>> Folks,
>>>>
>>>> I was having issues compiling httpd and svn for use with Trac (via the
>>>> python 2.7 bindings).  I have compiled httpd 2.4.18 (with apr 1.5.1,
>>>> apr-util 1.5.4, apr-iconv 1.2.1, openssl 1.0.2e, pcre 1.3.8 and
>>>> mod_wsgi 4.4.21) and am now trying to compile svn.
>>>>
>>>> I noted the comments about zlibstat and ZLIB_WINAPI [1][2], so I edited:
>>>> - zconf.h (added #define ZLIB_WINAPI)
>>>> - bld_ml32.bat (added the /safeseh switch to both lines)
>>>> ...and ran:
>>>> - vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
>>>>
>>>> This seems to compile OK so I copied the zlibstat.lib up to the zlib root.
>>>>
>>>> [1] http://svn.apache.org/repos/asf/subversion/trunk/INSTALL (section E4
>>>> ZLib)
>>>> [2] http://www.tannerhelland.com/5076/compile-zlib-winapi-wapi-stdcall/
>>>>
>>>> Next I built SERF 1.3.8:
>>>>
>>>> [...]
>>>>
>>>> In the end I got it running by _removing_ all the ZLIB_WINAPI 
>>>> defines in the Visual Studio project files and _not_ defining 
>>>> ZLIB_WINAPI in the main config file: this is the opposite of the 
>>>> advice in [1]! Does this sound correct? If so I think the INSTALL 
>>>> file needs updating. 
>>> I get one test failure but it looks bad:-
>>>
>>> START: checksum-test.exe
>>> PASS:  checksum-test 1: checksum parse
>>> PASS:  checksum-test 2: checksum emptiness
>>> PASS:  checksum-test 3: zero checksum matching
>>> svn_tests: E200006: Decompressed data doesn't match expected size or crc
>>> with blocksize 17: Found crc32=0x3a74e3ee, size=241883.
>>> Verify your ZLib installation, as this should never happen
>>> FAIL:  checksum-test 4: zlib expansion test (zlib regression)
>> Zlib has known bug in assembly optimized code. Just disable assembly
>> optimized code in zlib and everything should be fine.
> Thanks, Ivan, that makes sense.  For the record this is how I got ZLib working for me:
>
> Unpack archive to \svn\zlib
> Search/Remove all instances of ZLIB_WINAPI from *.vcproj
Are you sure this is required? My current build environment suggests 
it's just building/working fine and as intended by adding the 
ZLIB_WINAPI define. That's how it should also work.
I've to admit that I didn't test it using VS 2008 (but rather 2010 and 
2015), but I would not expect that having an impact on the reported 
linker error you got.
Might it be that you compiled another lib which pulled in zlib without 
defining ZLIB_WINAPI? Then that would explain the linker error you are 
reporting.

-- 
Regards,
Stefan Hett


RE: Compiling ZLIB for svn 1.9.3 on Windows 7 using MSVC 2008

Posted by "Cooke, Mark" <ma...@siemens.com>.
> -----Original Message-----
> From: Bert Huijben [mailto:bert@qqmail.nl]
> Sent: 04 January 2016 12:29
> 
> > -----Original Message-----
> > From: Stefan Hett [mailto:stefan@egosoft.com]
> > Sent: maandag 4 januari 2016 11:41
> >
> > On 12/31/2015 10:31 AM, Cooke, Mark wrote:
> > >> -----Original Message-----
> > >> From: Ivan Zhakov [mailto:ivan@visualsvn.com]
> > >> Sent: 30 December 2015 18:59
> > >>
> > >> On 30 December 2015 at 19:06, Cooke, Mark wrote:
> > >>> [Updates below]
> > >>>
> > >>>> -----Original Message-----
> > >>>> From: Cooke, Mark [mailto:mark.cooke@siemens.com]
> > >>>> Sent: 30 December 2015 15:56
> > >>>>
> > >>>> Folks,
> > >>>>
> > >>>> I was having issues compiling httpd and svn for use with Trac (via the
> > >>>> python 2.7 bindings).  I have compiled httpd 2.4.18 (with apr 1.5.1,
> > >>>> apr-util 1.5.4, apr-iconv 1.2.1, openssl 1.0.2e, pcre 1.3.8 and
> > >>>> mod_wsgi 4.4.21) and am now trying to compile svn.
> > >>>>
> > >>>> I noted the comments about zlibstat and ZLIB_WINAPI [1][2], so I
> > edited:
> > >>>> - zconf.h (added #define ZLIB_WINAPI)
> > >>>> - bld_ml32.bat (added the /safeseh switch to both lines)
> > >>>> ...and ran:
> > >>>> - vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
> > >>>>
> > >>>> This seems to compile OK so I copied the zlibstat.lib up to the zlib
> root.
> > >>>>
> > >>>> [1] http://svn.apache.org/repos/asf/subversion/trunk/INSTALL
> > (section E4
> > >>>> ZLib)
> > >>>> [2] http://www.tannerhelland.com/5076/compile-zlib-winapi-wapi-
> > stdcall/
> > >>>>
> > >>>> Next I built SERF 1.3.8:
> > >>>>
> > >>>> [...]
> > >>>>
> > >>>> In the end I got it running by _removing_ all the ZLIB_WINAPI
> > >>>> defines in the Visual Studio project files and _not_ defining
> > >>>> ZLIB_WINAPI in the main config file: this is the opposite of the
> > >>>> advice in [1]! Does this sound correct? If so I think the INSTALL
> > >>>> file needs updating.
> > >>> I get one test failure but it looks bad:-
> > >>>
> > >>> START: checksum-test.exe
> > >>> PASS:  checksum-test 1: checksum parse
> > >>> PASS:  checksum-test 2: checksum emptiness
> > >>> PASS:  checksum-test 3: zero checksum matching
> > >>> svn_tests: E200006: Decompressed data doesn't match expected size or
> > crc
> > >>> with blocksize 17: Found crc32=0x3a74e3ee, size=241883.
> > >>> Verify your ZLib installation, as this should never happen
> > >>> FAIL:  checksum-test 4: zlib expansion test (zlib regression)
> > >> Zlib has known bug in assembly optimized code. Just disable assembly
> > >> optimized code in zlib and everything should be fine.
> > > Thanks, Ivan, that makes sense.  For the record this is how I got ZLib
> > working for me:
> > >
> > > Unpack archive to \svn\zlib
> > > Search/Remove all instances of ZLIB_WINAPI from *.vcproj
> > >
> > Are you sure this is required? My current build environment suggests
> > it's just building/working fine and as intended by adding the
> > ZLIB_WINAPI define. That's how it should also work.
> > I've to admit that I didn't test it using VS 2008 (but rather 2010 and
> > 2015), but I would not expect that having an impact on the reported
> > linker error you got.
> > Might it be that you compiled another lib which pulled in zlib without
> > defining ZLIB_WINAPI? Then that would explain the linker error you are
> > reporting.

To be honest I am not sure, I am not vastly experienced in compiling so many independent projects to work together.  It appears to be working at the moment and all the svn tests pass.  I will try to investigate but work priorities are now elsewhere...

> The ZLIB_WINAPI patch changes the calling convention of the library.
> That is not necessary for Subversion's usage, but it might be necessary if
> you use the same ZLIB dll file from something else. Just make sure both the
> headers and the actual libraries use the same convention or you see huge
> problems in edge scenarios.
> 
> In general I would recommend using a normal static compilation of ZLIB for
> Subversion or otherwise one with LTCG enabled, to allow completely inlining
> things in the linker step. That allows even further optimizations than just
> changing the calling convention.
> 
> 	Bert

I am trying to compile with minimal changes to anything (I was hoping not to have to make these sorts of changes at all).  I will collate my notes and would welcome suggestions for improvements to the process.

BTW I am using VC2008 for compatibility with the Python 2.x libraries as we use subversion with Trac (trac.edgewall.org).

~ Mark C


RE: Compiling ZLIB for svn 1.9.3 on Windows 7 using MSVC 2008

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Stefan Hett [mailto:stefan@egosoft.com]
> Sent: maandag 4 januari 2016 11:41
> To: users@subversion.apache.org
> Subject: Re: Compiling ZLIB for svn 1.9.3 on Windows 7 using MSVC 2008
> 
> On 12/31/2015 10:31 AM, Cooke, Mark wrote:
> >> -----Original Message-----
> >> From: Ivan Zhakov [mailto:ivan@visualsvn.com]
> >> Sent: 30 December 2015 18:59
> >>
> >> On 30 December 2015 at 19:06, Cooke, Mark
> <ma...@siemens.com> wrote:
> >>> [Updates below]
> >>>
> >>>> -----Original Message-----
> >>>> From: Cooke, Mark [mailto:mark.cooke@siemens.com]
> >>>> Sent: 30 December 2015 15:56
> >>>>
> >>>> Folks,
> >>>>
> >>>> I was having issues compiling httpd and svn for use with Trac (via the
> >>>> python 2.7 bindings).  I have compiled httpd 2.4.18 (with apr 1.5.1,
> >>>> apr-util 1.5.4, apr-iconv 1.2.1, openssl 1.0.2e, pcre 1.3.8 and
> >>>> mod_wsgi 4.4.21) and am now trying to compile svn.
> >>>>
> >>>> I noted the comments about zlibstat and ZLIB_WINAPI [1][2], so I
> edited:
> >>>> - zconf.h (added #define ZLIB_WINAPI)
> >>>> - bld_ml32.bat (added the /safeseh switch to both lines)
> >>>> ...and ran:
> >>>> - vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
> >>>>
> >>>> This seems to compile OK so I copied the zlibstat.lib up to the zlib root.
> >>>>
> >>>> [1] http://svn.apache.org/repos/asf/subversion/trunk/INSTALL
> (section E4
> >>>> ZLib)
> >>>> [2] http://www.tannerhelland.com/5076/compile-zlib-winapi-wapi-
> stdcall/
> >>>>
> >>>> Next I built SERF 1.3.8:
> >>>>
> >>>> [...]
> >>>>
> >>>> In the end I got it running by _removing_ all the ZLIB_WINAPI
> >>>> defines in the Visual Studio project files and _not_ defining
> >>>> ZLIB_WINAPI in the main config file: this is the opposite of the
> >>>> advice in [1]! Does this sound correct? If so I think the INSTALL
> >>>> file needs updating.
> >>> I get one test failure but it looks bad:-
> >>>
> >>> START: checksum-test.exe
> >>> PASS:  checksum-test 1: checksum parse
> >>> PASS:  checksum-test 2: checksum emptiness
> >>> PASS:  checksum-test 3: zero checksum matching
> >>> svn_tests: E200006: Decompressed data doesn't match expected size or
> crc
> >>> with blocksize 17: Found crc32=0x3a74e3ee, size=241883.
> >>> Verify your ZLib installation, as this should never happen
> >>> FAIL:  checksum-test 4: zlib expansion test (zlib regression)
> >> Zlib has known bug in assembly optimized code. Just disable assembly
> >> optimized code in zlib and everything should be fine.
> > Thanks, Ivan, that makes sense.  For the record this is how I got ZLib
> working for me:
> >
> > Unpack archive to \svn\zlib
> > Search/Remove all instances of ZLIB_WINAPI from *.vcproj
> Are you sure this is required? My current build environment suggests
> it's just building/working fine and as intended by adding the
> ZLIB_WINAPI define. That's how it should also work.
> I've to admit that I didn't test it using VS 2008 (but rather 2010 and
> 2015), but I would not expect that having an impact on the reported
> linker error you got.
> Might it be that you compiled another lib which pulled in zlib without
> defining ZLIB_WINAPI? Then that would explain the linker error you are
> reporting.

The ZLIB_WINAPI patch changes the calling convention of the library. 
That is not necessary for Subversion's usage, but it might be necessary if you use the same ZLIB dll file from something else. Just make sure both the headers and the actual libraries use the same convention or you see huge problems in edge scenarios.

In general I would recommend using a normal static compilation of ZLIB for Subversion or otherwise one with LTCG enabled, to allow completely inlining things in the linker step. That allows even further optimizations than just changing the calling convention.

	Bert