[Scons-users] MSVC is broken for x86 builds on x64 hosts
Mats Wichmann
mats at wichmann.us
Wed May 22 12:15:32 EDT 2019
On 5/22/19 9:26 AM, Michael Hartmann wrote:
> Actually it’s even worse:
>
>
>
> While the correct cl.exe is used for compilation, the INCLUDE and LIB
> paths are set for a VS 2017 runtime.
>
>
>
> *Von:* Scons-users <scons-users-bounces at scons.org> *Im Auftrag von
> *Michael Hartmann
> *Gesendet:* Mittwoch, 22. Mai 2019 16:34
> *An:* SCons users mailing list <scons-users at scons.org>
> *Betreff:* Re: [Scons-users] MSVC is broken for x86 builds on x64 hosts
>
>
>
> There still is an issue that is preventing me from building my target
> with Visual Studio 9.0 Express. The SConstruct looks kind of like this:
>
>
>
> some_environment = Environment(
>
> LINKFLAGS = '/MANIFEST /INCREMENTAL:NO /DEBUG',
>
> CFLAGS = '/Od /MD /EHsc /MP /Zi /Zl /Zp8',
>
> MSVC_VERSION = '9.0Exp',
>
> MSVC_BATCH = True,
>
> HOST_ARCH = 'x86',
>
> TARGET_ARCH = 'x86'
>
> )
>
>
>
> some_environment.SharedLibrary('output.dll', ["test1.c", "test2.c"])
>
>
>
> The sources are compiled using the correct cl.exe. After the compile
> step and before the link step the environment gets reset, so the wrong
> linker is invoked and the wrong standard library is linked (Both from
> Visual Studio 2017 for amd64).
So it looks like things are fine through line 152, with scons doing the
compilation to objects just after saying:
vc.py:msvc_setup_env() env:LIBPATH -> ['C:\\Program Files
(x86)\\Microsoft Visual Studio 9.0\\VC\\LIB']
and then it goes wrong when the mslink tool initializes, as it says:
msvc_setup_env_once CALLED FROM mslink.py
msvc_setup_env()
get_default_version()
get_default_version(): msvc_version:None msvs_version:None
installed_vcs:['14.1', '14.0', '12.0', '12.0Exp', '10.0', '10.0Exp',
'9.0Exp']
msvc_setup_env: using default installed MSVC version '14.1'
It shouldn't be doing what it's doing, the earlier calls to
msvc_setup_env_once should have caused MSVC_SETUP_RUN to be set in the
environment, and so the function should just return, not go on and call
msvc_setup_env and come up with new answers. So presumably it must be
using a new environment?
What a mess that stuff all is. I can't figure why the mslink tool is
being initialized a second time, as it already ran to do the first batch
of setup, the time it knew about MSVC_VERSION - line 86 of your paste.
Needs one of the wizards to explain, I guess.
More information about the Scons-users
mailing list