我正在尝试编译TrueCrypt。我使用的是https://github.com/syglug/truecrypt的说明。
我设置了3个环境变量(pkcs
,ddk
,MSVC16_ROOT
)并在msvc2008中打开了项目。这不在说明书中,但我需要安装NASM,所以我安装它并将NASM放入PATH。现在,当我建立时,我得到了以下内容。即使IDE具有取消构建可选择,编译器没有做任何事情并且系统空闲,它也会结束。
此步骤后确实存在Crypto.lib
1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
2>Performing Makefile project actions
3>Performing Makefile project actions
1>Performing Custom Build Step
3>------ Building truecrypt.sys: Release x86 ------
1>Aes_hw_cpu.asm
2>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c
2>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
3>The syntax of the command is incorrect.
3>Project : error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'.
3>Build log was saved at "file://c:\unzipped\tc\Driver\Release\BuildLog.htm"
3>Driver - 1 error(s), 0 warning(s)
1>Performing Custom Build Step
1>Aes_x86.asm
1>Compiling...
1>Whirlpool.c
1>Twofish.c
1>Sha2.c
1>Sha1.c
1>Serpent.c
1>Rmd160.c
1>Des.c
1>Cast.c
1>Blowfish.c
1>Aestab.c
1>Aeskey.c
1>Generating Code...
1>Creating library...
1>Build log was saved at "file://c:\unzipped\tc\Crypto\Release\BuildLog.htm"
1>Crypto - 0 error(s), 0 warning(s)
它只是挂起。它没有使用任何CPU,IDE似乎不知道它失败或停止。再次运行时,我得到了这个
1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
1>Performing Makefile project actions
2>Performing Makefile project actions
2>------ Building truecrypt.sys: Release x86 ------
1>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c
1>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>The syntax of the command is incorrect.
我安装了msvc2012,所以我也试过了。我遇到了同样的问题
1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
1> Performing Custom Build Tools
1> Aes_hw_cpu.asm
3> ------ Building truecrypt.sys: Release x86 ------
2> Microsoft (R) C/C++ Optimizing Compiler Version 8.00c
2> Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>
3> The syntax of the command is incorrect.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1> Performing Custom Build Tools
1> Aes_x86.asm
1> Aeskey.c
1> Aestab.c
1> Blowfish.c
1> Cast.c
1> Des.c
1> Rmd160.c
1> Serpent.c
1> Sha1.c
1> Sha2.c
1> Twofish.c
1> Whirlpool.c
1> Generating Code...
1> Crypto.vcxproj -> C:\unzipped\tc\Crypto\Release\Crypto.lib
当我再次取消/建立时,我得到以下
1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
2> ------ Building truecrypt.sys: Release x86 ------
2> The syntax of the command is incorrect.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1> Microsoft (R) C/C++ Optimizing Compiler Version 8.00c
1> Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
1>
这里有什么问题?我如何构建TrueCrypt?我正在运行Windows 7 64位
答案 0 :(得分:30)
我可以从https://github.com/syglug/truecrypt成功构建所有项目。我主要遵循readme.txt的指示。由于指令不够详细,我在下面描述了我所做的所有步骤。如果您对某些步骤有其他问题,我会提供其他详细信息。
我使用的是Windows 7 X64上安装的Visual Studio 2008。如果需要,我可以使用Visual Studio 2010或2012重现相同的内容。
MSVC15
中直接提取C:\
的目录名中没有空格。所以我在C:\MSVC15\BIN
中使用了16位VC编译器的旧二进制文件。C:\PKCS-11
目录中。与所有相关文件一样,文件C:\PKCS-11\pkcs11.h
将位于同一目录C:\PKCS-11
C:\nasm-2.10.05
目录中提取了nasm-2.10.05-win32.zip。因此nasm.exe
可以找到C:\nasm-2.10.05
。gzip-1.3.12-1-bin.zip
提取为C:\gzip-1.3.12-1-bin
。因此C:\gzip-1.3.12-1-bin\bin
包含gzip.exe
。C:\WinDDK\7600.16385.1
中安装了Windows DDK。C:\truecrypt-master
目录中解压缩了它。因此Crypto.vcproj
可以在C:\truecrypt-master\Crypto
目录中找到。因为我不想修改全局环境变量,所以我创建了以下批处理文件:
SET MSVC16_ROOT=C:\MSVC15
SET PKCS11_INC=C:\PKCS-11
PATH=C:\nasm-2.10.05;C:\gzip-1.3.12-1-bin\bin;%PATH%
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
在批处理文件的最后一行中,将启动Visual Studio 2008(devenv.exe
)。它继承了CMD.EXE(启动Visual Studio 2008的父进程)中设置的所有环境变量。
readme中描述的解决方案文件'TrueCrypt.sln'未包含在github上找到的来源中。所以我打开了我在C:\truecrypt-master
的子目录中找到的每个Project文件并编译它。它是Crypto.vcproj
(来自C:\truecrypt-master\Crypto
),Boot.vcproj
(来自C:\truecrypt-master\Boot\Windows
),Driver.vcproj
(来自C:\truecrypt-master\Driver
),Format.vcproj
(来自C:\truecrypt-master\Format
)和Mount.vcproj
(来自C:\truecrypt-master\Mount
)。
我可以成功编译所有项目。唯一的小问题是在Format.vcproj
和Mount.sln
的构建过程中。文件Format.tlb
和Mount.tlb
存在于子目录中。所以我修复了在C:\truecrypt-master\Format\Format.rc
和C:\truecrypt-master\Mount\Mount.rc
到
IDR_FORMAT_TLB TYPELIB ".\\Format\\Format.tlb"
和
IDR_MOUNT_TLB TYPELIB ".\\Mount\\Mount.tlb"
我稍后会以Pull Request的形式将相应的修正发布到https://github.com/syglug/truecrypt。
更新:必须更改文件BuildDriver.cmd
行
set TC_BUILD_ARCH=x64 WNET
到
set TC_BUILD_ARCH=x64
能够构建驱动程序。
此外,构建行应使用正确的pathes,如"$(SolutionDir)..\Crypto"
和"$(SolutionDir)..\Common"
(请参阅Visual Studio中的nmake选项)。如果一个人使用TrueCrypt.sln
来自C:\TrueCrypt7.1a
则不需要。
更新2 :编译项目后,您会在C:\TrueCrypt7.1a\Release\Setup Files
或C:\truecrypt-master\Release\Setup Files
文件中看到
文件TrueCrypt Setup.exe
仅存在于C:\TrueCrypt7.1a
中(从您稍后在评论中发布的链接www.truecrypt.org下载)。正如我在评论中提到的,您需要将Visual Studio 2008配置为使用Windows SDK 7而不是默认的6.0a才能成功编译安装项目。
将编译的驱动程序未使用Microsoft签名进行数字签名。因此,默认情况下,Windows 7不会信任驱动程序。因此,要验证驱动程序是否正常工作,您必须在启动计算机时按 F8 并禁用驱动程序签名:
之后,您将能够执行TrueCrypt.exe
(例如,从C:\TrueCrypt7.1a\Release\Setup Files
目录)。你会收到警告
但是TrueCrypt.exe
会起作用,你会看到
答案 1 :(得分:2)
看起来您修改了PATH环境变量,而某些文件夹路径包含引号(“”)标记。 Windows不再需要引号以避免与空格混淆。错误PRJ0002:从“C:\ Windows \ SysWow64 \ cmd.exe”返回的错误结果255“一旦解决此问题就会消失。
答案 2 :(得分:1)
对于陷入此PKEY_AppUserModel_ID问题的所有人:它通过在第一个函数()之前在Setup.c中定义以下内容来工作:
EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY PKEY_AppUserModel_ID =
{ { 0x9F4C2855, 0x9F79, 0x4B39,
{ 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };
亲切的问候