logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: Building Apache 2.0.63 on x64
Author
budala



Joined: 27 Aug 2010
Posts: 2

PostPosted: Fri 03 Sep '10 23:08    Post subject: Building Apache 2.0.63 on x64 Reply with quote

Hello and thank you for reading.

Background:

I work for a software company where one of our products legacy versions is packaged with Apache 2.0 among other things. Up until now we've been using the 32bit official compilation for our distribution. However, we've been running into problems running our software on Windows 2008 x64. After some digging I narrowed it down to a dependency chain of services failing to start because the Apache service was failing to start with a rather cryptic message. After some more digging and testing with various versions of Apache, I finally got the service to start up when I installed the 64bit compilation of Apache 2.2 from Blackdot. We accepted this as a our potential solution for that platform, but since there are no official 64bit compilations of Apache, I was asked to create our own.

After several days of trial and error and much reading on this forum, Blackdot, and anything else I could dig up on the web, I got 2.2.16 compiled and tested that it installs and starts up on Windows 2008 x64. However, the preferred version would be 2.0 as there are dependencies on that version in our package that would also have to be upgraded if we upgraded our Apache to 2.2. Since this is a legacy version of our software which we are only supporting and no longer doing development on, it would be preferable to change as few things as possible, so for the past few days I've been trying to compile 2.0.63 version. After messing around with zlib (and downgrading to 1.1.4 after finding out that 1.2 wasn't compatible with Apache 2.0), I finally disabled zlib and managed to compile without it. However, when trying to install the compiled Apache I ran into some errors.

Problem:

I compiled Apache 2.0.63 in x64 (or at least I think I did it in x64). I tried installing it on Windows 2008 x64 by running "Apache -k install", but was prompted me with the following error:
Code:
"The program can't start because MSVCR90.dll is missing from your computer. Try reinstalling the program to fix this problem."

Reluctantly, I found the .dll file in one of the Windows folders and copied it to apache\bin folder and tried again. Then I was prompted with a different:
Code:
"Runtime Error!

Program: C:\httpd-2.0_x64\bin\Apache.exe

R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information."

This error made me think that perhaps I didn't compile Apache correctly after all. I was hoping some of you gurus might be able to help me figure out what I'm doing wrong or what I'm missing. In the least, hopefully this thread saves some time to anyone else trying to build Apache on x64, since there is very limited information out there.

Building Prerequisites:

    Visual Studio 2008
    PHP Interpreter
    Perl Interpreter
    AWK
    Bison
    Flex
    Sed

(See http://www.blackdot.be/?inc=apache/knowledge/tutorials/x64 for links)

Building Procedure:

1. downloaded httpd-2.0.63-win32-src.zip from Apache website
2. downloaded openssl-0.9.8o.tar.gz
3. extracted apache source to c:\build\httpd-2.0.63 and openssl to subdirectory srclib\openssl
4. ran srclib\apr\build\lineends.pl to clean up the files
Code:
cd c:\build\httpd-2.0.63
perl srclib\apr\build\lineends.pl

5. Compiled openssl
Code:
cd srclib\openssl
perl Configure VC-WIN64A --prefix=/Apache22 --openssldir=/Apache22/conf enable-camellia disable-idea
ms\do_win64a
nmake -f ms\ntdll.mak

6. Opened the Apache project in Visual Studio (I used 2008)
Code:
cd ..\..\
devenv Apache.dsw

7. When asked to convert project, I clicked "Yes To All".
8. Once loaded, opened Configuration Manager and removed existing x64 configuration, then created a new one copying all settings from Win32. Set x64 as the active configuration for the whole project.
9. Saved all and closed VS.
10. Ran the following PHP script to clean up the Makefiles
Code:
<?php
function find_files($path, $pattern, $callback) {
   $path = rtrim(str_replace("\\", "/", $path), '/') . '/*';
                                 
   foreach (glob ($path) as $fullname) {
      if (is_dir($fullname)) {
         find_files($fullname, $pattern, $callback);
      } else if (preg_match($pattern, $fullname)) {
         call_user_func($callback, $fullname);
      }
   }
}

function my_handler($filename) {
   echo $filename . "\n";
   file_put_contents($filename,str_ireplace(" /MACHINE:X86","",file_get_contents($filename)));
   file_put_contents($filename,str_ireplace(" /MACHINE:IX86","",file_get_contents($filename)));
}

echo "Removing all instances of \"/MACHINE:X86\" or \"/MACHINE:IX86\" from .mak files\n";
find_files('c:/build/httpd-2.0.63/', '/.mak$/', 'my_handler');
echo "Finished.\n";
?>

11. Finally compiled Apache
Code:
nmake /f Makefile.win INSTDIR="C:\httpd-2.0_x64" installr



Any help would be greatly appreciated.

Thank you.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 03 Sep '10 23:21    Post subject: Reply with quote

Even with that error it might cough some info with

Apache -V

Should show the archtecture 32 or 64-bit.

Instead of copying the dll to the bin folder, try installing the redistributable for whatever arch it says it is. Of course if it shows 32-bit your back to square 1 basically.
Back to top
budala



Joined: 27 Aug 2010
Posts: 2

PostPosted: Tue 07 Sep '10 22:10    Post subject: Reply with quote

Well I've made progress. Confused Reinstalling the redistributable (vcredist_x64.exe) didn't resolve the problem, so instead I copied the .dll files from one of the Windows\winsxs subfolders (one of the amd64 ones) to system32 folder. This bypassed the error the same way just copying them to apache\bin folder did and allowed me to proceed to the second execution error.

The "Runtime Error! ... R6034 ..." I fixed by embedding the manifest files. I added the following three lines at the front of "_copybin:" target in Makefile.win.
Code:
FOR /R %a in (*.exe) DO @if exist %a.manifest mt -nologo -manifest %a.manifest -outputresource:%a;1
FOR /R %a in (*.dll) DO @if exist %a.manifest mt -nologo -manifest %a.manifest -outputresource:%a;2
FOR /R %a in (*.so)  DO @if exist %a.manifest mt -nologo -manifest %a.manifest -outputresource:%a;2

Now I'm able to execute Apache.exe -V with following output:

Code:
C:\httpd-2.0_x64\bin>Apache.exe -V
Server version: Apache/2.0.63
Server built:   Sep  3 2010 14:15:39
Server's Module Magic Number: 20020903:13
Server loaded:  APR 0.9.17, APR-UTIL 0.9.15
Compiled using: APR 0.9.17, APR-UTIL 0.9.15
Architecture:   64-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/apache"
 -D SUEXEC_BIN="/apache/bin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"


So my build looks ok!

However, now I'm running into another problem when trying to install:
Code:
C:\httpd-2.0_x64\bin>Apache.exe -k install
(20024)The given path misformatted or contained invalid characters: Invalid config file path conf/httpd.conf

Trying to override the path doesn't help either.
Code:
C:\apache\bin>Apache.exe -f ..\conf\httpd.conf -k install
(20024)The given path misformatted or contained invalid characters: Invalid config file path ..\\conf\\httpd.conf

C:\httpd-2.0_x64\conf>..\bin\Apache.exe -f httpd.conf -k install
(20024)The given path misformatted or contained invalid characters: Invalid config file path httpd.conf

I thought perhaps my httpd.conf file had invalid stuff in it, but I can't find anything (I can copy and paste the whole thing if you'd like). I'll keep googling for a solution, but if any of you have a clue, please share Smile
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 08 Sep '10 0:44    Post subject: Reply with quote

the invalid character error ... I recently ran into this and it took me an hour to realize I had a comma in a file name I believe it was, in an Include or LoadModule statement in httpd.conf.

LoadModule some_module modules/mod_some,so
Back to top


Reply to topic   Topic: Building Apache 2.0.63 on x64 View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads