You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Edward Lu <ch...@gmail.com> on 2014/10/30 18:53:22 UTC

Building APR using cmake on Windows

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?

Re: Building APR using cmake on Windows

Posted by Edward Lu <ch...@gmail.com>.
Thanks Jeff. Will move further discussion to the bug/proper mailing list.

On Thu, Nov 6, 2014 at 10:15 AM, Jeff Trawick <tr...@gmail.com> wrote:

> On Thu, Oct 30, 2014 at 1:53 PM, Edward Lu <ch...@gmail.com> wrote:
>
>> 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?
>>
>
> I just filed this APR bug to track this:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=57191
>
> Note that dev@apr is the proper mailing list for this issue.  And I'm
> pretty sure that if I had the mail setup I had 15 years ago I would have
> noticed that a lot sooner :(
>
> --
> Born in Roswell... married an alien...
> http://emptyhammock.com/
>
>

Re: Building APR using cmake on Windows

Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, Oct 30, 2014 at 1:53 PM, Edward Lu <ch...@gmail.com> wrote:

> 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?
>

I just filed this APR bug to track this:
https://issues.apache.org/bugzilla/show_bug.cgi?id=57191

Note that dev@apr is the proper mailing list for this issue.  And I'm
pretty sure that if I had the mail setup I had 15 years ago I would have
noticed that a lot sooner :(

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: Building APR using cmake on Windows

Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, Oct 30, 2014 at 1:53 PM, Edward Lu <ch...@gmail.com> wrote:

> 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
>

I guess this is actually the right tarball:

https://sites.google.com/a/unimrcp.org/unimrcp/dependencies/apr-1.5.1-patches.zip?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?
>

See
http://mail-archives.apache.org/mod_mbox/apr-dev/201404.mbox/%3C535ACDE0.6050608@gmail.com%3E

I haven't built with 2013 yet or looked at his patch in detail.

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/