On Sun, Apr 19, 2020 at 5:12 AM Nathan Hartman <hartman.nat...@gmail.com> wrote: > > On Thu, Apr 16, 2020 at 2:07 PM Johan Corveleyn <jcor...@gmail.com> wrote: > > Perhaps that needs at least a mention in some "known issues" section. > > For normal users this doesn't matter much of course, and judging from > > the amount of Windows sigs for 1.14 I doubt even one single other > > person beside me is building and running tests on Windows :-). > > Would you be willing to send me whatever notes you have on the steps > to set up a Windows dev/testing environment, even if they're rough? I > know it's a frightening process. But between INSTALL, > tools/dev/windows-build, and any hints you can provide, I'll try to > get something going.
Hi Nathan, Sure! Any help on the Windows-side of things would be definitely appreciated. For context: I'm not a very experienced C developer (I do have 20+ years of java development experience). I understand the syntax and can come up with small patches, but I lose most of the time with trivial "setup" things, like bootstrapping a decent build environment, finding my way around the IDE, and solving linker problems etc. Things that might be obvious for seasoned C people, but look like a big impenetrable mess to me sometimes :-). I'm using an adapted version of the Makefile from tools/dev/windows-build. I put this in the root folder of the subversion checkout / zip-extraction. I use Visual Studio 2019 Community Edition (Version 16.5.3, or whatever the last one is). INSTALL contains a lot of info, but I've learned to ignore some of it (because it refers to "old stuff"). I know I should probably start editing / patching it to get it in a better shape, but usually I'm pretty exhausted after finally having been able to complete setting up a build (it took me 4 days this time), that I just cannot muster up the energy anymore. Building the dependencies is the hard part. I'm a bit short on time right now, so I'll just dump some rough notes here (might contain some hidden assumptions, but I'm not sure): - Get the following tools, and make sure they are in your PATH: * Perl (I've taken the last Strawberry distribution from perl.org) * Python from python.org (download both a 2.7 and a 3.x build, you'll probably need both, as there are still problems with 3.x for svn builds). * awk (from https://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe) * test.exe, from GnuWin32 (used by that Makefile from tools/dev/windows-build) For the moment, I started with a x86 (32-bit) build, mainly in Release configuration (some builds do both). Later I'll try to go for x64 build. zlib: # clean: nmake -f win32/Makefile.msc clean nmake -f win32/Makefile.msc nmake -f win32/Makefile.msc test (workaround for svn build: it looks for zlibstat.lib) nmake /nologo -f win32/Makefile.msc STATICLIB=zlibstat.lib all building DEBUG configuration: set CC_OPTS=/MDd /Gm /ZI /Od /GZ /D_DEBUG nmake /nologo -f win32/Makefile.msc STATICLIB=zlibstatD.lib all Do not try to build the assembler optimized versions, it causes headaches openssl: Need Netwide Assembler, a.k.a. NASM, available from https://www.nasm.us (after install, put in PATH) perl Configure enable-zlib --with-zlib-include=../zlib-1.2.11 --with-zlib-lib=../zlib-1.2.11/zlib.lib VC-WIN32 For openssl 1.0.2*: call ms\do_nasm nmake -f ms\ntdll.mak nmake -f ms\ntdll.mak test For openssl 1.1.x: nmake nmake test PCRE (from pcre.org, needed for httpd -- not pcre2, only pcre (version 1) works): cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DBUILD_SHARED_LIBS:BOOL=ON -DPCRE_NO_RECURSE:BOOL=ON . nmake nmake test expat (needed for httpd / apr-util): download and extract expat (https://libexpat.github.io/) (Follow instructions from cmake.README): cd expat mkdir build cd build cmake .. msbuild expat.sln (debug build) msbuild expat.sln /p:Configuration=Release >>>> This is 64-bit build!! httpd now also needs to be built 64bit >>>> or: open expat.sln > Configuration Mgr > Add x86 (win32) configuration, save & exit + edit all vcprojx files and remove " /machine:x64" httpd: download and extract httpd download and extract apr, apr-util, apr-iconv into httpd\srclib\apr ..\apr-util ..\apr-iconv Attention: Do not try to use junctions (windows symlinks), just copy the directories Attention 2: Check if the downloaded / extracted files are marked by Windows as "Blocked" (rightclick -> Properties). If so unblock them in bulk from within Powershell (Run as Administrator), with "dir -s | Unblock-File". put built pcre under httpd\srclib put built expat under httpd\srclib\apr-util\xml copy libexpat.lib into srclib/apr-util copy libexpat.lib from Release and libexpatD.pdb from Debug into expat\lib\LibR, and name them xml.lib and xml.pdb (for debug build) copy libexpatd.lib and libexpatD.pdb from Debug into expat\lib\LibD, and name them xml.lib and xml.pdb edit apr-util\Makefile.win, and unquote libexpat in XML_PARSER="libexpat" see https://www.mail-archive.com/dev@apr.apache.org/msg27347.html perl srclib\apr\build\lineends.pl perl srclib\apr\build\cvtdsp.pl -2005 (for openssl 1.1.x) perl srclib\apr\build\cvtdsp.pl -ossl11 Open Apache.dsw in VS2019 to let it be converted / upgrade to .sln with .vcxproj files (made from de .dsp files) Strip "/Yuiconv" en "Yciconv" out of srclib/apr-iconv/build/modules.mk.win (not sure if this is still needed) Insert "<PropertyGroup><GenerateManifest>false</GenerateManifest></PropertyGroup>" in support/win32/ApacheMonitor.vcxproj Insert "<PropertyGroup><TargetName>libapr-1</TargetName></PropertyGroup>" in srclib/apr/libapr.vcxproj Insert "<PropertyGroup><TargetName>apr_ldap-1</TargetName></PropertyGroup>" in srclib/aprutil/ldap/apr_ldap.vcxproj Insert "<PropertyGroup><TargetName>libapriconv-1</TargetName></PropertyGroup>" in srclib/apr-iconv/libapriconv.vcxproj Insert "<PropertyGroup><TargetName>libaprutil-1</TargetName></PropertyGroup>" in srclib/aprutil/libaprutil.vcxproj Create directory C:\Apache2.4.43 in which the httpd build can be installed. # Add XML_PARSER="libexpat" to nmake commando ( https://www.mail-archive.com/dev@apr.apache.org/msg27346.html) nmake /f Makefile.win installr INSTDIR=C:\Apache2.4.43 XML_PARSER="libexpat" # If anything fails, first try it again: nmake /f Makefile.win installr INSTDIR=C:\Apache2.4.43 XML_PARSER="libexpat" Possibly: Rerun _install like this: nmake /f Makefile.win SHORT=R LONG=Release _install INSTDIR=C:\Apache2.4.43 XML_PARSER="libexpat" Possibly: copy apr-util\xml\expat\Release\expat.dll to C:\Apache2.4.43\bin serf (the problems here below were just reported to dev@serf.a.o): Download and install latest scons version, in your Python 2.7 installation (so first make sure Python 2.7 is first in PATH, then run the installation of scons). The serf build does not work with Python 3.x. If using openssl 1.1.x, patch serf/SConstruct as follows: [[[ --- SConstruct.orig 2020-04-19 15:36:16.257450600 +0200 +++ SConstruct 2020-04-19 15:36:51.855740800 +0200 @@ -335,7 +335,7 @@ LIBPATH=['$ZLIB']) # openssl - env.Append(LIBS=['libeay32.lib', 'ssleay32.lib']) + env.Append(LIBS=['libcrypto.lib', 'libssl.lib']) if not env.get('SOURCE_LAYOUT', None): env.Append(CPPPATH=['$OPENSSL/include/openssl'], LIBPATH=['$OPENSSL/lib']) @@ -343,8 +343,8 @@ env.Append(CPPPATH=['$OPENSSL/inc32'], LIBPATH=['$OPENSSL/out32']) else: - env.Append(CPPPATH=['$OPENSSL/inc32'], - LIBPATH=['$OPENSSL/out32dll']) + env.Append(CPPPATH=['$OPENSSL/include'], + LIBPATH=['$OPENSSL']) else: if os.path.isdir(apr): apr = os.path.join(apr, 'bin', 'apr-1-config') ]]] With Python 2.7 in PATH, run: scons APR=..\httpd-2.4.43\srclib\apr APU=..\httpd-2.4.43\srclib\apr-util OPENSSL=..\openssl-1.1.1f ZLIB=..\zlib-1.2.11 If you get this error: scons: *** Invalid value for option MSVC_VERSION: 14.2. Valid values are: ('14.0', '12.0', '11.0', '10.0', '9.0', '8.0', '6.0') File "C:\research\svn\dev\deps\serf-1.3.9\SConstruct", line 157, in <module> Delete the file .saved_config, and try again. That's it :-). I'll look up the difference between the Makefile in tools/dev/windows-build and mine later ... -- Johan