httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Lu <chaos...@gmail.com>
Subject Building APR using cmake on Windows
Date Thu, 30 Oct 2014 17:53:22 GMT
Using Visual Studio 2013 command line tools, on Windows Server 2012 rc2.
Running everything from batch files through Cygwin. I cloned the APR repo
from here: https://github.com/apache/apr

I downloaded some prebuilt libxml2 and iconv binaries for Windows. Then, I
ran the commands:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
"C:\Program Files (x86)\CMake\bin\cmake" -G "NMake Makefiles"
-DLIBXML2_LIBRARIES=C:\lib\libxml2-2.7.8.win32\lib\libxml2.lib
-DLIBXML2_INCLUDE_DIR=C:\lib\libxml2-2.7.8.win32\include
-DLIBXML2_ICONV_INCLUDE_DIR=C:\lib\iconv-1.9.2.win32\include
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=..\built ..

That worked fine. Then, I tried running nmake on the generated makefiles,
which ran fine until it tried to link libapr-2.dll. That got me the
following errors:

Linking C shared library libapr-1.dll
   Creating library libapr-1.lib and object libapr-1.exp
apr_atomic.c.obj : error LNK2019: unresolved external symbol
__InterlockedIncrement referenced in function _apr_atomic_inc32@4
apr_atomic.c.obj : error LNK2019: unresolved external symbol
__InterlockedExchangeAdd referenced in function _apr_atomic_add32@8
apr_atomic.c.obj : error LNK2019: unresolved external symbol
__InterlockedExchange referenced in function _apr_atomic_set32@8
apr_atomic.c.obj : error LNK2019: unresolved external symbol
__InterlockedDecrement referenced in function _apr_atomic_dec32@4
apr_atomic.c.obj : error LNK2019: unresolved external symbol
__InterlockedCompareExchange referenced in function _apr_atomic_cas32@12
libapr-1.dll : fatal error LNK1120: 5 unresolved externals

After some searching, I ran across a unimrcp thread that talked about
solving this issue. I tracked down the APR patches they are using in that
project here:
https://sites.google.com/a/unimrcp.org/unimrcp/dependencies/apr-1.5.1.tar.gz?attredirects=0&d=1

Specifically, check out the patch labeled as 0002. it boils down to
removing all the typesafe casts in apr_atomic.c, which introduces a bunch
of compiler warnings. That seems to work, though I doubt it's the right
thing to do. I also tried checking out the 1.5.x branch of APR, which give
the same errors. I don't generally develop on Windows, so this one has me
stumped. Any ideas?

Mime
View raw message