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: VS: missing expat with apr-util 1.6
Author
mec4



Joined: 20 Nov 2017
Posts: 5
Location: UK

PostPosted: Mon 20 Nov '17 14:07    Post subject: VS: missing expat with apr-util 1.6 Reply with quote

I am trying to build apache 2.4.29 and subversion with VS2008 to support python 2.7 and am having trouble with apr-util 1.6. In [thread=35509]another thread[/thread] I read about copying the expat source into the apr-util tree but now I have issues with the library not linking.
"glsmith" said
Quote:
Once I added the expat source it built fine in x86
but I cannot find how to do this.

Can anyone point me to any docs to explain how to get the build to work? It looks like I am missing two environment variables (XML_PARSER and XML_OPTIONS) but am not sure what these need to be nor if I need to build expat first.

I have already fixed the line endings and built openssl and pcre. Then I ran
Code:
cvtdsp -2005 -ossl11
before opening the DSW and letting VS2008 convert the projects.

Thanks for any help!
Back to top
mec4



Joined: 20 Nov 2017
Posts: 5
Location: UK

PostPosted: Tue 21 Nov '17 10:37    Post subject: Some progress... Reply with quote

Looks like expat no longer provides a VS2008 compatible project file (and the VS2013 files cannot be downgraded). Instead I made a new VS2008 solution and include just the `expat` project files to build into the "srclib\expat\win32\release" folder.
Code:
set XML_PARSER=libexpat
in the command prompt before starting the solution file then linked libaprutil OK.

I still get a warning about missing "XML_OPTIONS" but I do not know what I should set these to, can anyone help?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Tue 21 Nov '17 22:26    Post subject: Re: Some progress... Reply with quote

mec4 wrote:
Looks like expat no longer provides a VS2008 compatible project file (and the VS2013 files cannot be downgraded).

Actually, the project files can be downgraded. Just replace every 'v141' in the *.vcxproj files with 'v90'. Open the expat.sln in VC14 or VC15 and it will compile OK.

mec4 wrote:
I still get a warning about missing "XML_OPTIONS" but I do not know what I should set these to, can anyone help?

I was wondering the same. In the end I removed the XML_OPTIONS from the preprocessor definitions of libaprutil.
Back to top
mec4



Joined: 20 Nov 2017
Posts: 5
Location: UK

PostPosted: Wed 22 Nov '17 10:39    Post subject: Reply with quote

I know I can downgrade the toolset but the project files will not open in VC2008, the structure of the files has changed too much.

Thanks for the info ref XML_OPTIONS. I have left it for now as it is "only" a warning and does not stop compilation.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Wed 22 Nov '17 10:47    Post subject: Reply with quote

mec4 wrote:
I know I can downgrade the toolset but the project files will not open in VC2008, the structure of the files has changed too much.

True. Apart from OpenSSL and PCRE you have to build Expat now separately as well. Or make you own *.vcproj.
Back to top
mec4



Joined: 20 Nov 2017
Posts: 5
Location: UK

PostPosted: Wed 22 Nov '17 11:33    Post subject: Reply with quote

Do you know where in the httpd tree I should copy the built libexpat files? At the moment I am editing the httpd projects to add the expat\win32\Release folder to the search paths but I would rather copy files than edit projects!

I tried running `cvtdsp.pl -apr16` but that only updated one file and the text displayed referenced openssl 1.1.0!
Back to top
glsmith
Moderator


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

PostPosted: Fri 24 Nov '17 21:18    Post subject: Reply with quote

cvtdsp.pl -apr16 was created before this which is why it doesn't help and who did this new expat mess didn't think to fix, even though he was told about it.

In Theory:

Expat can be anywhere. But they've really complicated things. Here's how I understand it but haven't tested it.

Open a VCx x86 command line console in httpd-x.x.x (source root).
Type in these commands.

set XML_PARCER=libexpat
set LIB=%LIB%;/path/to/expat/win32/bin
set INCLUDE=%INCLUDE%;/path/to/expat/lib

devenv /useenv apache.dsw

convert
build Win32 target

One problem with this however is that free versions of Visual Studio do not have devenv, at least VC9 & 10 don't.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Fri 24 Nov '17 22:50    Post subject: Reply with quote

glsmith wrote:
One problem with this however is that free versions of Visual Studio do not have devenv, at least VC9 & 10 don't.

VC11 does not have devenv either.

For x64:
Code:
wdexpress Apache.sln /Build "Release|x64" /useenv

Disadvantage: wdexpress on the command line does not show any output.

For Win32 try:
Code:
msbuild Apache.sln /p:configuration=Release /p:platform=Win32

msbuild does not have a /useenv parameter. I do not know if it uses the environment, because I entered all the settings in the vcxproj files.

Edit: VC10 has vcexpress and msbuild. I do not know the equivalent for VC9
Back to top
glsmith
Moderator


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

PostPosted: Sat 25 Nov '17 0:34    Post subject: Reply with quote

Or,

Just put it all back the way it was in 1.6.0 mostly. With this no need to use cvtdsp.pl -apr16.

Get Apache24 source with the apr, apr-util & apr-iconv sources in srclib set up.

Put other dependencies like pcre in the srclib folder.

Put the "expat" folder from inside the libexpat-R_2_2_5.zip download in srclib/apr-util/xml

Download patch at https://www.apachehaus.net/patches/aprutilx4h.patch and put in httpd's top source folder.

Open a command window and type: patch -p0 -b -i aprutilx4h.patch

then: perl srclib/apr/build/cvtdsp -2005

Open Apache.dsw in the Visual Studio 9 IDE, convert and build InstallBin.

Works for me, command line too which I use for every version other than VC9.

Patch will probably NOT work in 2.4.30 and up, I expect change here for the command line build as it's still looking for apr 1.6.0 files which have been removed.
Back to top
mec4



Joined: 20 Nov 2017
Posts: 5
Location: UK

PostPosted: Mon 27 Nov '17 10:30    Post subject: Reply with quote

glsmith wrote:
Or,

Just put it all back the way it was in 1.6.0 mostly. With this no need to use cvtdsp.pl -apr16.
...

Thanks very much for this, will give it a go and report back (may take a day or two now).
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Mon 27 Nov '17 11:47    Post subject: Reply with quote

That should have been:
Quote:
VC11 Express does not have devenv either.
Back to top
deltamind106



Joined: 22 Aug 2012
Posts: 9
Location: Boston, USA

PostPosted: Thu 23 Aug '18 22:38    Post subject: Reply with quote

Is there any decent solution to this yet? The people at apache have really screwed up this expat thing in their half-witted effort to have a pluggable XML parsing library. I'm just trying to build httpd 2.4.34 from the command line using nmake.

I've put the expat folder from the libexpat-R_2_2_6.tar.gz archive into the srclib/apr-util/xml folder. Then I kkkkrun "nmake -f Makefile.win" from the top level and it won't build:
cd srclib\apr-util\xml\expat\lib
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\nmake.exe" -nologo -f xml.mak CFG="xml - Win32 Release" RECURSE=0
NMAKE : fatal error U1052: file 'xml.mak' not found

Someone removed the xml.mak file from the apr-util sources, so this whole thing is completely broken.
Back to top
deltamind106



Joined: 22 Aug 2012
Posts: 9
Location: Boston, USA

PostPosted: Fri 24 Aug '18 20:01    Post subject: Reply with quote

After some searching, I could not find much decent information on this issue other than some people complaining that the guy at Apache who removed xml.mak is a hack (for both putting it there in first place and then removing it prematurely), and you're pretty much on your own fixing this problem for now, at least until Apache 2.5 comes out.

So in case anyone needs to actually build Apache 2.4.34 for Windows, here's what Apache should have done before they released Httpd 2.4.34 and Apr-Util 1.6.1:

1. Copy the expat sub-folder from the expat distribution in the usual place (srclib/apr-util/xml/expat).

2. Build expat separately using the CMake system that's included with expat:
Quote:
cd srclib/apr-util/xml/expat
cmake -G "NMake Makefiles" -D BUILD_shared=OFF -D CMAKE_BUILD_TYPE=Release .
nmake

It probably makes sense to just build a static version of the expat library, so you don't have to worry about including expat.dll in the Apache bin folder.

3. Fix the httpd Makefile.win so it doesn't reference the non-existent xml.mak file. Around line 452 of this file, you will see 3 commands to build expat with "xml.mak":
Quote:
cd srclib\apr-util\$(EXPAT)
$(MAKE) $(MAKEOPT) -f xml.mak CFG="xml - Win32 $(LONG)" RECURSE=0 $(CTARGET)
cd $(EXPBCK)

Remove the above 3 lines, and replace with this line:
Quote:
cd srclib\apr-util

Now you have an httpd Makefile.win that doesn't look for a file that they removed from the apr-util distribution. I wonder why they didn't do this simple fix before releasing Apache 2.4.34? Does anyone test the Windows makefiles? I guess probably not.

4. Now fix the httpd Makefile.win so it knows where to find the expat.lib library file that you compiled above in step 2. Around line 1262 of Makefile.win, you will see 2 lines that stage the expat library:
Quote:
copy srclib\apr-util\$(EXPAT)\Lib$(SHORT)\xml.lib "$(INSTDIR)\lib" <.y
copy srclib\apr-util\$(EXPAT)\Lib$(SHORT)\xml.pdb "$(INSTDIR)\lib" <.y

Remove the above 2 lines and replace with the following line:
Quote:
copy srclib\apr-util\xml\expat\expat.lib "$(INSTDIR)\lib" <.y

Note that the expat release build does not create an expat.pdb, so you have to remove this unless you built a debug version of expat.

5. Now modify the apr-util Makefile so it knows where to find the expat.lib library file that you compiled above in step 2. Edit the file libaprutil.mak, and around line 160, 358, 556, and 754 (4 separate locations) you will see a reference to $(XML_PARSER).lib. I guess their idea was to define XML_PARSER somewhere, but nobody bothered to actually do it. So replace all 4 occurrences of "$(XML_PARSER).lib" with "xml/expat/expat.lib".

I guess you could make a patch encompassing all these changes, but probably the file locations will move around as time goes by, and a machine patch will eventually stop working. Or, maybe they'll fix httpd and apr-util before that happens. In the meantime, this is generally what you need to do.
Back to top
glsmith
Moderator


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

PostPosted: Fri 24 Aug '18 20:43    Post subject: Reply with quote

I use this patch and put the lib folder from the expat source in the httpd-2.4.x/srclib/apr-util/xml/expat folder I create and build like before that change.

Edit: fixed the httpd-2.4.x source path for expat.


Last edited by glsmith on Fri 24 Aug '18 22:02; edited 1 time in total
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3094
Location: Hilversum, NL, EU

PostPosted: Fri 24 Aug '18 21:05    Post subject: Reply with quote

I too here back to old behavior.
Back to top


Reply to topic   Topic: VS: missing expat with apr-util 1.6 View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads