Bug 59698

Summary: "The system cannot find the path specified." when building apr using nmake on Windows
Product: APR Reporter: Stefan <luke1410>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: NEW ---    
Severity: normal CC: luke1410
Priority: P2 Keywords: PatchAvailable
Version: HEAD   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: patch for Makefile.win
patch to correct test/makefile.win

Description Stefan 2016-06-13 23:14:59 UTC
running nmake -f Makefile.win (OS: Win10 64-bit, VS 2015 CE Update 2) raises the following error:
"The system cannot find the path specified."

and incorrectly sets the ARCH to Win32 Release instead of x64 Release.

As far as I can tell the issue is in Makefile.win ln 49 where $(SystemRoot) is specified, while according to the nmake documentation, environment variables are converted to uppercase letters. [1]

Replacing $(SystemRoot) with $(SYSTEMROOT) resolves the issue for me here.

[1] https://msdn.microsoft.com/en-us/library/99at5bh3.aspx
Comment 1 Stefan 2016-06-13 23:22:32 UTC
Note: This issue then results in the following linker error due to the target and source platform mismatch:

.\Release\apr_atomic.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
NMAKE : fatal error U1077: '"E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe"' : return code '0x458'
NMAKE : fatal error U1077: '"E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Comment 2 Stefan 2016-06-13 23:30:55 UTC
Created attachment 33947 [details]
patch for Makefile.win
Comment 3 Stefan 2016-06-26 23:09:40 UTC
Created attachment 33988 [details]
patch to correct test/makefile.win

There's another part of the issue. Trying to run the Makefile.win in test directly (rather than indirectly through the main Makefile.win) will trigger the same error, and if only the first patch is applied, would fail with some error (since it then points to the incorrect directory for the library file).

Hence, the second patch corrects the same issue in test/Makefile.win.