我正在尝试使用cl
Visual Studio 2010 构建 32 位版本的Mixxx。Mixxx 使用 SCons 来构建。我的电脑是 Windows 7 64 位,安装了太多版本的 Visual Studio。
按照这些说明,我尝试了各种组合和变体setenv
,vsvars
但无论我做什么,在这种情况下,我最终都会使用命令行:
> cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
好的,所以cl
指向“版本 16,x86”——太好了。
> scons toolchain=msvs force32=1 winlib=%cd%\winlib\x86 sqlitedll=0 staticlibs=1 asmlib=0
[... bunch of output truncated, until we start using the compiler ...]
cl /Fores\qrc_mixxx.obj /c res\qrc_mixxx.cc /TP /Zc:wchar_t- /GL /MP /fp:fast /G
[truncated]
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
(注意——我破解了 SCons 以删除/nologo
)什么?现在如何cl
表示“版本 18,x64”?它改变了我的环境吗?让我们来了解一下:
Terminate batch job (Y/N)? y
>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
所以cl
对终端来说仍然意味着“版本 16,x86”。但 SCons 总是使用“最新版本,x64”。
(根据我对Windows shell的理解,这应该是不可能的。我杀了脚本,所以它没有做任何清理。cl
改变的意思怎么会这样?)
我发现了一些提示:
- http://scons.1086193.n5.nabble.com/Using-32-bit-MSVC-compiler-on-64-bit-Windows-td28062.html
- http://www.scons.org/wiki/MsvsMultipleVersions
- 强制 scons 使用较旧的编译器?
基于此,我添加了
Environment(MSVC_VERSION = '10.0')
Environment(TARGET_ARCH = 'x86')
print 'hello world'
到 SConstruct。我不知道 SCons,而且构建脚本很重要,所以很可能我做错了。无论如何,SCons 仍然总是使用“最新版本,x64”。