jeudi 28 avril 2016

fatal error LNK1104: cannot open file 'bcrypt.lib' when building for Surface RT tablet

I'm working on a test script for Windows Store apps. The script includes testing Surface RT tablet with the ARM processor.

Under the VS2012 ARM Developer Prompt, the library compiles fine during this portion of the testing:

>nmake -f cryptest.nmake
...
cl.exe /nologo /W4 /D_MBCS /Zi /TP /EHsc /MD /FI winapifamily.h /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /Yc"pch.h" /Fp"pch.pch" /c pch.cpp
pch.cpp
cl.exe /nologo /W4 /D_MBCS /Zi /TP /EHsc /MD /FI winapifamily.h /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /c cryptlib.cpp
...
lib.exe /nologo cryptlib.obj cpu.obj ... /out:cryptlib.lib

Then linking the final executable to finish this portion of the testing:

link.exe /nologo /SUBSYSTEM:CONSOLE bench1.obj bench2.obj test.obj validat1.obj
validat2.obj validat3.obj datatest.obj regtest.obj fipsalgt.obj dlltest.obj
fipstest.obj cryptlib.lib  /out:cryptest.exe

LINK : fatal error LNK1104: cannot open file 'bcrypt.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_ARM\link.exe"' : return code '0x450'

We are using BCryptOpenAlgorithmProvider, BCryptGenRandom and BCryptCloseAlgorithmProvider. According to the docs, the functions are available for Windows Store apps, and the library to link to is Bcrypt.lib. The library is called out in the source files with:

// Obviously, both evaluate to TRUE
#if defined(_MSC_VER) && defined(USE_MS_CNGAPI)
# pragma comment(lib, "bcrypt.lib")
#endif

I've been through nearly every page of Cryptography API: Next Generation on the Microsoft Dev Center, and Microsoft does not state anything special for this configuration.

What library do I have to link to for the CryptoAPI Next Generation (CNG) when building for Surface RT/ARM tablet?


Here is the environment Microsoft sets up when using the VS2012 ARM Developer Prompt and Nmake. I'm happy to tune it if necessary. However, I don't have this particular problem under other Developer Prompts.

>nmake /P

Microsoft (R) Program Maintenance Utility Version 11.00.61030.0
Copyright (C) Microsoft Corporation.  All rights reserved.


MACROS:

PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
      LIBPATH = C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Micro
soft.NET\Framework64\v3.5;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windo
ws\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 1
1.0\VC\LIB\ARM;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB
\ARM;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neut
ral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.V
CLibs\11.0\References\CommonConfiguration\neutral;
      INCLUDE = C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C
:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program
Files (x86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\
8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;
COMMONPROGRAMW6432 = C:\Program Files\Common Files
      COMSPEC = C:\Windows\system32\cmd.exe
   _NMAKE_VER = 11.00.61030.0
      PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
         MAKE = "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmak
e.exe"
COMMANDPROMPTTYPE = Cross
   SYSTEMROOT = C:\Windows
WINDOWSSDKDIR_OLD = C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\
         PATH = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft SDKs\F#\3
.0\Framework\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\I
DE\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_ARM;C:\Progra
m Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;C:\Program Files (x86)\Microso
ft Visual Studio 11.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.3031
9;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visua
l Studio 11.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program
 Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Progra
m Files (x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Win
dows\v8.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.
0A\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0
\;C:\Program Files\NASM;C:\Strawberry\perl\bin;C:\OpenSSL\bin;C:\curl-7.46.0-win
64\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Ser
ver\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Pro
gram Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Kit
s\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Too
ls\Binn\
NUMBER_OF_PROCESSORS = 2
  PROGRAMDATA = C:\ProgramData
         TEMP = C:\Users\Test\AppData\Local\Temp
FRAMEWORKVERSION32 = v4.0.30319
FRAMEWORK35VERSION = v3.5
 PROGRAMW6432 = C:\Program Files
FRAMEWORKVERSION64 = v4.0.30319
  SESSIONNAME = Console
PROCESSOR_ARCHITEW6432 = AMD64
  USERPROFILE = C:\Users\Test
COMMONPROGRAMFILES = C:\Program Files (x86)\Common Files
  LOGONSERVER = \\WINDOWS-7-X64
     HOMEPATH = \Users\Test    WINDOWS_TRACING_FLAGS = 3
  SYSTEMDRIVE = C:
     USERNAME = Test
     PLATFORM = ARM
 LOCALAPPDATA = C:\Users\Test\AppData\Local
ALLUSERSPROFILE = C:\ProgramData
EXTENSIONSDKDIR = C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSD
Ks
           CC = cl
 PROGRAMFILES = C:\Program Files (x86)
    MAKEFLAGS = P
 FRAMEWORKDIR = C:\Windows\Microsoft.NET\Framework\
PROCESSOR_REVISION = 2a07
 VCINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
 COMPUTERNAME = WINDOWS-7-X64
           AS = ml
           RC = rc
 PSMODULEPATH = C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PROCESSOR_LEVEL = 6
 VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio 11.0\
PROCESSOR_ARCHITECTURE = x86
           OS = Windows_NT
    HOMEDRIVE = C:
    DEVENVDIR = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\

MOZ_PLUGIN_PATH = C:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\
WINDOWSSDKDIR_35 = C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
FSHARPINSTALLDIR = C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\
       PUBLIC = C:\Users\Public
       WINDIR = C:\Windows
VISUALSTUDIOVERSION = 11.0
FRAMEWORKVERSION = v4.0.30319
          LIB = C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\ARM;C
:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\ARM;C:\Program
Files (x86)\Windows Kits\8.0\lib\win8\um\ARM;
       PROMPT = $P$G
          CPP = cl
WINDOWSSDKDIR = C:\Program Files (x86)\Windows Kits\8.0\
FP_NO_HOST_CHECK = NO
          TMP = C:\Users\Test\AppData\Local\Temp
FRAMEWORKDIR32 = C:\Windows\Microsoft.NET\Framework\
WINDOWS_TRACING_LOGFILE = C:\BVTBin\Tests\installpackage\csilogfile.log
          CXX = cl
   USERDOMAIN = WINDOWS-7-X64
FRAMEWORKDIR64 = C:\Windows\Microsoft.NET\Framework64
VS100COMNTOOLS = c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Too
ls\
VS110COMNTOOLS = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Too
ls\
      APPDATA = C:\Users\Test\AppData\Roaming
      MAKEDIR = C:\Users\Test\Desktop\cryptopp


INFERENCE RULES:

.asm.obj::
        commands:       $(AS) $(AFLAGS) /c $<

.asm.exe:
        commands:       $(AS) $(AFLAGS) $<

.c.obj::
        commands:       $(CC) $(CFLAGS) /c $<

.c.exe:
        commands:       $(CC) $(CFLAGS) $<

.cc.obj::
        commands:       $(CC) $(CFLAGS) /c $<

.cc.exe:
        commands:       $(CC) $(CFLAGS) $<

.cpp.obj::
        commands:       $(CPP) $(CPPFLAGS) /c $<

.cpp.exe:
        commands:       $(CPP) $(CPPFLAGS) $<

.cxx.obj::
        commands:       $(CXX) $(CXXFLAGS) /c $<

.cxx.exe:
        commands:       $(CXX) $(CXXFLAGS) $<

.rc.res:
        commands:       $(RC) $(RFLAGS) /r $<

.SUFFIXES: .obj .asm .c .cc .cpp .cxx .f .f90 .for .rc

TARGETS:

Aucun commentaire:

Enregistrer un commentaire