Notes about the Lua/APR binding
The [online API documentation for APR] api_docs has been my most useful resource while working on the Lua/APR binding but it leaves something to be desired when you're looking for a high level overview. The following online resources help in this regard:
- [God's gift to C] gift_to_c is an introductory article to the functionality of APR by [The Register] register.
- The [libapr tutorial by Inoue Seiichiro] tutorial is a useful starting point for writing code.
Building APR on Windows
Building APR on Windows can be a pain in the ass. It is meant to be done with Microsoft tools but fortunately these are freely available. Here are some notes I made in the process:
Install [Microsoft Visual C++ Express] msvc. You only need the command line tools, the GUI isn't needed.
Install the [Microsoft Platform SDK] sdk. The full SDK is over 1 GB but you only need the following:
- Microsoft Windows Core SDK
- Build environment (x86 32-bit)
- Microsoft Web Workshop (IE) SDK
- Build environment
- Microsoft Windows Core SDK
Download the APR, APR-util, APR-iconv and libapreq2 archives (I used
libapreq2-2.13.tar.gz) from [apr.apache.org] apr_homepage (you can [get libapreq2 here] apreq_downloads). Unpack all archives to the same directory and rename the subdirectories to
apr-iconv(those three are build at the same time while libapreq2 is build separately).
The instructions about [building APR on Windows] compile_hints don't work for me so this is where things get sketchy: Open a Windows SDK command prompt and navigate to the
apr-utildirectory. Inside this directory execute
nmake -f Makefile.win buildall. This doesn't work for me out of the box because of what's probably a bug in the APR-util makefile; I needed to replace
aprappon lines 176 and 177 of
Makefile.win. After this change
nmakestill exits with errors but nevertheless seems to build
You also have to build APREQ, last I tried this was a mess on Windows, I collected some notes at the bottom of this page.
Building the SQlite3 database driver on Windows
The SQLite 3 driver is included in the [Windows binaries] win32_binaries but for the benefit of those who want to build the Apache Portable Runtime on Windows here are the steps involved:
Download the [precompiled SQLite 3 binaries For Windows] sqlite_binaries (273.98 KiB) and unpack the files somewhere.
sqlite3.def(included in the precompiled binaries) using the command
lib /machine:i386 /def:sqlite3.defand copy
Download the corresponding [source code distribution] sqlite_sources (1.20 MiB) and copy
Build the driver in the Windows SDK command prompt using the command
nmake /f apr_dbd_sqlite3.mak.
To install the driver you can copy
apr_dbd_sqlite3-1.dllto Lua's installation directory.
libapreq2 on Windows
I wasted a few hours getting
libapreq2 version 2.13 to build on Windows because of the following issues:
- The included makefile
libapreq2.makis full of syntax errors.
- The makefile unconditionally includes the Apache module and consequently doesn't link without a full Apache build.
- The build environment requires a specific flavor of Perl which I haven't gotten to work.
Eventually I decided to just rewrite the damned makefile and be done with it, enabling me to finally test the HTTP request parsing module on Windows (all tests passed the first time). I've included the [customized makefile] apreq_makefile in the Lua/APR git repository.