httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Build-Warnings httpd 2.4.x Visual Studio 10, 32 Bit
Date Wed, 04 Jan 2012 17:01:00 GMT
Hi Eric,

On 04.01.2012 16:07, Eric Covener wrote:
> Any fresh hints/pointers about setting up a windows sandbox so I can
> try to look at the LDAP stuff?

Here's what I did. Some of it is a bit complex, because I used Visual 
Studio 10 and the Windows build files are not really optimal for that 
(more precisely: the automatic migration of Visual Studio Files to 
version 10 is kind of broken).

I was using a mix of Windows SDK 7.1 (especially to build OpenSSL, PCRE, 
ZLib, PCRE) and Visual Studio 10 (to build httpd and AP[RUI]).

The rough plan is similar to

or the slightly more outdated

I was building for 32 bits.

1) Prerequisites

- Windows SDK 7.1, Visual Studio 10 (earlier Version might be easier to use)

- awk for Windows
- perl
- cmake for Windows (to build PCRE)
- nasm for Windows (Assembler, to build OpenSSL)

2) Sources

- OpenSSL 1.0.1e
- ZLIB 1.2.5
- PCRE 8.21
- APR 1.4.5 (copy of tag)
- APU 1.4.1 (copy of tag)
- API 1.2.1 (copy of tag)
- httpd 2.4.x (copy of branch)

3) Preparing Build Environment

Path and parameters might differ for older SDKs. Options can be seen 
using "setenv /?".

 > cd C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin
 > setenv /win7 /RELEASE /x86
 > rem BUILD is the main directory under which we build everything
 > set BUILD=D:\path\to\build
 > rem INSTALL is the main directory to which we install everything
 > set INSTALL=D:\path\to\install

4) Building dependencies

a) ZLib

 > cd %BUILD%
 > rem Extract zlib-1.2.5 sources here
 > cd zlib-1.2.5
 > nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
     OBJA="inffas32.obj match686.obj"

(Command is given as a comment at the start of that Makefile;
  Note that the command for 64Bits is wrong)

 > nmake -f win32/Makefile.msc test
 > nmake -f win32/Makefile.msc testdll

b) OpenSSL

 > cd %BUILD%
 > rem Extract openssl-1.0.0e sources here
 > cd openssl-1.0.0e
 > perl Configure no-idea no-mdc2 enable-zlib VC-WIN32 \
     --with-zlib-include=%BUILD%\zlib-1.2.5 \
     --with-zlib-lib=%BUILD%\zlib-1.2.5\zlib.lib \
 > ms\do_nasm.bat
 > nmake -f ms\ntdll.mak
 > nmake -f ms\ntdll.mak test
 > nmake -f ms\ntdll.mak install


 > cd %BUILD%
 > rem Extract pcre-8.21 sources here
 > cd pcre-8.21
 > mkdir build
 > cmake-gui

A GUI will pop up.

Enter your %BUILD%\pcre-8.21 as "Where is the source code" and 
%BUILD%\pcre-8.21\build as "Where to build the binaries"  (not using the 

Click "Configure"

Choose "NMake makefiles"

Check "BUILD_SHARED_LIBS", the three options "PCRE_BUILD_*", and 
PCRE_SUPPORT_UTF8. Keep the other checkboxes as-is.

%INSTALL%\pcre-8.21 (not using the variable).

Click "Configure" again.

Click "Generate"

Leave the cmake gui tool.

 > cd build
 > nmake -f Makefile
 > nmake -f Makefile test
 > nmake -f Makefile install

5) Prepare for httpd building

a) Copying stuff

 > cd %BUILD%
 > rem Copy the sources from the 2.4.x branch to directory 2.4.x
 > cd 2.4.x\srclib
 > rem Copy the apr tag 1.4.5 sources as folder "apr" here
 > rem Copy the apu tag 1.4.1 sources as folder "apr-util" here
 > rem Copy the apr tag 1.2.1 sources as folder "apr-iconv" here
 > rem Copy the ZLib build directory as folder "zlib" here
 > rem Copy the OpenSSL build directory as folder "openssl" here
 > rem Copy the PCRE build directory as folder "pcre" here
 > rem Copy pcre.* from the subdirectory pcre\build directly to pcre
 > cd ..

b) Preparing the build system

 > rem Edit and replace "httpd.vcproj" by "httpd.vcxproj"
 > rem This is needed for Visual Studio 10
 > start Apache.dsw

Visual Studio starts up and asks, whether it should migrate all 
solution/project files. Let it do so. After it is done save and exit. 
You will now find a new file Apache.sln and many new files *.vxproj*.

Now disable parallel building. Otherwise the build will break, because 
the parallel builds used by default try to concurrently use some Visual 
Studio log files and err out (some of the independent projects are build 
in the same directories, e.g. support binaries).

 > start Apache.sln

In the Visual Studio Menues go to "Tools - Options". In the Popup choose 
"Projects and Solutions" and then "Build and Run". Set "maximum number 
of parallel project builds" to "1".

Click OK, and exit Visual Studio.

Another crucial step is adding project references for each project 
dependency. The migration to Visual Studio 10 unfirtunately doesn't do 
it automatically. I wrote a perl script for that task, which I started like:

 > perl Apache.sln

It will save the *.vcxproj files and add the dependencies to them. When 
run again later, it will not overwrite the saved files, but instead use 
the originally saved ones.

The script as it is uses a cp command in backtics, which works here, 
because I have cygwin installed. If it doesn't work for you try with a 
DOS "copy" command.

Script content is Appendix A.

Now I applied two more fixes to the *.vcxproj files to reduce the number 
of warnings and to ensure, that the pdb-files needed by the installer 
get the right names. Fix 1 changes the TargetName for the projects, 
where the dll-files contains a "-1" as in libapr-1.dll. Without the fix, 
the pdb files will not contain the "-1" and make install will fail. Fix 
2 changes the TargetExt for module builds from .ddl to .so. I think this 
only reduces warnings.

 > perl

Script content is Appendix B

OK, ready to go:

 > nmake -f PORT=8000 SSLPORT=8443 
INSTDIR=D:\\path\\to\install\\httpd-%MYVERSION% installr

Not sure here, whether I actually needed the double backslashes.

I actually redirected the output of nmake to some file using

 > nmake -f ... > nmake.out

The build will run twice for mod_ssl, mod_deflate and abs. That's 
something I haven't yet fixed.



Appendix A:


use strict;

my %name; my %path; my %deps;
my ($name, $path, $id, $deps),
my ($k, $d);

while (<>) {
     $_ =~ s/^\s+//;
     $_ =~ s/\s+$//;
# XXX The "if" is only one line !!! XXX
     if ($_ =~ 
         ($name, $path, $id) = ($1, $2, $3);
         if (exists($name{$id})) {
             print STDERR "Duplicate project id $id in $_\n";
             print STDERR "Aborting!";
             exit 1;
         $deps = 0;
# XXX The "elsif" is only one line !!! XXX
     } elsif ($_ =~ 
/^ProjectSection\(ProjectDependencies\)\s*=\s*postProject$/) {
#print STDERR "Starting dependencies for $name\n";
         $deps = 1;
     } elsif ($_ =~ /^EndProjectSection$/) {
#print STDERR "Stopping dependencies for $name\n";
         $deps = 0;
     } elsif ($deps &&
          $_ =~ /^(\{[A-Za-z0-9\-]+\})\s*=\s*(\{[A-Za-z0-9\-]+\})$/) {
          my ($id1, $id2) = ($1, $2);
#print STDERR "Found dependency $id1\n";
          if ($id1 ne $id2) {
              print STDERR "Inconsistent dependency id $id1 in $_\n";
              print STDERR "Aborting!";
              exit 1;
          push(@{$deps{$id}}, $id1);

sub byname {
     return $name{$a} cmp $name{$b};

#for $k (sort byname keys %name) {
#    printf("%s\t%s\t%s\n", $k, $name{$k}, $path{$k});
#    printf("\t%s\n", join("\t", @{$deps{$k}}));

for $k (sort byname keys %name) {
     next if $#{$deps{$k}} < 0;
     my ($file, $saved, $depth, $prefix, @s);
      $name = $name{$k};
      $path = $path{$k};
      $file = $path;
      $file =~ s/\\/\//g;
      $saved = "$file.refs_orig";
      if (! -e $saved) {
          print "Saving $file\n";
          `cp -p $file $saved`
     @s = split(/\//, $file);
     $depth = $#s;
     $prefix = "..\\" x $depth;
     print "Fixing $name in $file (depth $depth)\n";
     open(IN, "<$saved");
     open(OUT, ">$file");
     while(<IN>) {
         if ($_ =~ /Import Project\s*=.*Microsoft\.Cpp\.targets/) {
             print OUT "  <ItemGroup>\n";
             for $d (sort byname @{$deps{$k}}) {
                 print OUT "    <ProjectReference 
                 print OUT "      <Project>$d</Project>\n";
                 print OUT "    </ProjectReference>\n";
             print OUT "  </ItemGroup>\n";
         print OUT $_;

Appendix B:


use strict;
use File::Find;

find(\&wanted, '.');

sub wanted {
     my ($targetExt, $targetName);
     my ($insertExt, $insertName);
     my ($fullFile, $file, $saved);
     return if ($_ !~ /\.vcxproj$/);
     if ($_ =~ /^mod_/ || $_ =~ /^libapriconv_.*modules\./) {
         $targetExt = 1;
     if (($File::Find::dir =~ /.*\/srclib\/apr[^\/]*$/ ||
         $File::Find::dir =~ /.*\/srclib\/apr-util/) &&
          $_ =~ /apr/) {
         $targetName = 1;
     return unless $targetExt + $targetName;
     $fullFile = $File::Find::dir . '/' . $_;
     $file = $_;
      $saved = "$file.fixes_orig";
      if (! -e $saved) {
          print "Saving $file\n";
          `cp -p $file $saved`
     print "Fixing $fullFile: ",
         $targetExt ? "TargetExt" : "-" , "/",
         $targetName ? "TargetName" : "-" , "\n";
     open(IN, "<$saved");
     open(OUT, ">$file");
     while(<IN>) {
         if ($_ =~ /\s*<PropertyGroup Label="Globals">/ && $targetName) {
             $insertName = 1;
         } elsif ($insertName && $_ =~ /\s*<\/PropertyGroup>/) {
             $insertName = 0;
# XXX The print line is only one line !!!
             print OUT " 
# XXX The elsif line is only one line !!!
         } elsif ($_ =~ /\s*<Import Project\s*=.*Microsoft.Cpp.props".*\/>/
             && $targetExt) {
             $insertExt = 1;
         } elsif ($insertExt) {
             $insertExt = 0;
             print OUT "  <PropertyGroup Label=\"Configuration\">\n";
             print OUT "    <TargetExt>.so</TargetExt>\n";
             print OUT "  </PropertyGroup>\n";
         print OUT $_;

View raw message