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: Compiling httpd with Visual C++ amd64 compiler
Author
root_op



Joined: 02 Dec 2010
Posts: 3

PostPosted: Thu 02 Dec '10 0:58    Post subject: Compiling httpd with Visual C++ amd64 compiler Reply with quote

Hello fellow httpd users, I've been using this wonderful http server for quite some years. Now the inevitable has occured, I've been asked to set it up on a Windows machine.
Usually this wouldn't be any problem, if it weren't for that they explicitly asked for 64-bit binaries.

I have found x64 binaries to download, although I've found myself wanting to learn a bit more about the build process on Windows since this is completely new to me.

Now I just have this one small request, since I've already successfully compiled zlib and openssl already I see myself stuck at the actual httpd.

All I do is run
Code:
nmake -f Makefile.win installr INSTALLDIR=dest


Although this gives me an error regarding missmatching machine types.
I've been told that this can be resolved by converting the solution file to x64 instead, although I don't have Visual Studio 2008 installed and I really don't want it either. I'm happily satisfied with just Windows SDK 6.1.

Could someone be a sweatheart and provide either the lines that are being replaced during this conversion, or the entire converted source tree for VC9-x64?

Best regards, Pontus Carlsson
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Dec '10 12:23    Post subject: Reply with quote

I remove the /MACHINE:X86 from the make files. Than it works for me.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Dec '10 18:17    Post subject: Reply with quote

You might also read

http://www.apachelounge.com/viewtopic.php?p=11343
Back to top
root_op



Joined: 02 Dec 2010
Posts: 3

PostPosted: Thu 02 Dec '10 19:32    Post subject: Reply with quote

Yes that was the solution I ultimately fell back to.

I've written together a page on http://wiki.apache.org/httpd/Win64Compilation regarding the compile procedure.

Hope someone finds it useful! Also, if you see any errors or such please let me know or fix the mistake yourselves.

~
Back to top
glsmith
Moderator


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

PostPosted: Thu 02 Dec '10 20:10    Post subject: Reply with quote

The only thing with /machine left in it is APR/APU/API. They have x64 build targets though unlike httpd. But you cannot use them since you are fooling the compiler into x64 yet using the x86 targets.

I'm in a way stunned they opted to remove these from the httpd build. It's just as easy to swap X86 for X64 as it is to strip, and listen to the compiler complain on every project.

In the instructions on the wiki you have linked to,

"s/\/MACHINE:X[0-9]*/\/MACHINE:X64/g"

would do just that, swap X86 for X64.

These instruction are incomplete in one tiny aspect, there is a little, very little, x64 optimized code in some files that will not get utilized by those instructions. It deals with memory and the file system.

\srclib\apr\include\apr.hw(379):#ifdef WIN64
\srclib\apr\shmem\win32\shm.c(85):#ifdef WIN64
\server\mpm\winnt\child.c(671):#ifdef _WIN64

The one in child.c will get used as the compiler automatically will define "_WIN64", but it will not define "WIN64".

The real fun begins when you add in mod_fcgid to the build. At that point, that will not work because it is really behind the times and using the vc<=6 /MACHINE:I386, not the vc>=6 /MACHINE:X86. Getting this changed is on my list of things to-beg-for.

As someone who has built Apache hundreds of times (at least a dozen alone on Tuesday) I prefer the IDE, in the long run it is easier and quite frankly seems faster and there is no need to wait till the ASF gets Win32 sources up. It really becomes invaluable when you want to target a single project in the what, 103 I think it is in 2.2? Also saves from all the typing at the command line, read: less carpel tunnel problems in the long run.

Of course, this is just my opinion, for what little it's worth.
Back to top
root_op



Joined: 02 Dec 2010
Posts: 3

PostPosted: Thu 02 Dec '10 22:40    Post subject: Reply with quote

Oh your opinion is worth everything, just as everybody else!
That was an old BRE string I used before, although I swapped it with
Code:
FOR /R %F IN (*.mak *.mk.win) DO perl -p -i -e "s/\/MACHINE:X[0-9]*//gi" %F

Although I did that update early this morning so I'm surprised you still see that.

Actually I did a complete search through the entire source for /MACHINE: and I couldn't find anything other than the .dsp project files.

I will see on to how I'll append -DWIN64 to the build process and update the Wiki for it, thanks for that comment. I had no idea there were any 64-bit optimization at all in HTTPd!

Yes, I've heard that most people actually prefer the IDE, but as Apache is open source many people I doubt would want to spend money on an IDE when all they want is the binary. Might just be my opinion though, and as we all know the Express version works just as well.

If you have any other comments on my work please let me know, I'm very new to compilation on Windows and I learn tons from this actually![/code]

Edit: For you who have built httpd before on Windows, are you aware of any MSI generation script to use?

Edit: I rewrote my FOR ... perl to also replace WIN32 with WIN64 in .mak files. I'm doing a test build as we speak.
Code:
FOR /R %F IN (*.mak *.mk.win) DO perl -p -i -e "s/\/MACHINE:X[0-9]*//gi" -e "s/(WIN)([0-9]*)/\1\x36\x34/gi" %F


Edit: After actually attempting this I realized that this isn't the way to do it. APR crashes without the WIN32 definition, thus the only way I see it is to replace '/D "WIN32"' with '/D "WIN32" /D "WIN64"'

Any feedback on this? Will it still optimize for Windows x64?


Last edited by root_op on Sat 04 Dec '10 18:49; edited 2 times in total
Back to top


Reply to topic   Topic: Compiling httpd with Visual C++ amd64 compiler View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads