Re: MSVC is broken for x86 builds on x64 hosts

Daniel Moody <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CANws3JQ6uPzLQk24rE+M+uK74Y7UYCvSymx50g_M_mgbUt47HA@mail.gmail.com>
Since VS 2015, there had been an 64 bit MSVC compiler available, along with
a 32 bit MSVC compiler:
https://docs.microsoft.com/en-us/cpp/ide/visual-cpp-tools-and-features-in-visual-studio-editions?view=vs-2017#compilers

You can cross compile using the 64 bit compiler to compile a 32 bit target,
taking advantage of larger addressable memory in the 64 bit compiler. If
you are on a 64 bit machine using VS >2015, scons defaults to using that
configuration. If you want to use a 32 bit compiler directly, you can also
set the environment var HOST_PLATFORM to 'x86' to force it.

In your case there may be an issue because you are using express edition
which doesn't have a 64 bit compiler, so scons didn't find the 64 bit to
32bit cross compiler, but neglected to check a possible valid configuration
using the 32 bit compiler directly, though that would conflict if you had
explicity specified HOST_PLATFORM as 64 bit and you didn't want a 32 bit
compiler as an option.


On Thu, Mar 28, 2019, 9:05 AM Michael Hartmann <[email protected]>
wrote:

> The code to support Visual Studio tries to construct a path to cl.exe form
> the host arch (amd64) and the target arch (x86):
>
>
>
> vc.py:get_host_target()
>
> vc.py:get_host_target() req_target_platform:x86
>
> _check_cl_exists_in_vc_dir(): host platform amd64, target platform x86
>
> _check_cl_exists_in_vc_dir(): checking for cl.exe at C:\Program Files
> (x86)\Microsoft Visual
> Studio\2017\WDExpress\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x86\cl.exe
>
> find_vc_pdir no compiler found 14.1
>
> trying to find VC 14.0
>
> find_vc_dir(): found VC in registry: C:\Program Files (x86)\Microsoft
> Visual Studio 14.0\VC\
>
> found VC 14.0
>
> vc.py:get_host_target()
>
> vc.py:get_host_target() req_target_platform:x86
>
> _check_cl_exists_in_vc_dir(): host platform amd64, target platform x86
>
> _check_cl_exists_in_vc_dir(): checking for cl.exe at C:\Program Files
> (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\cl.exe
>
> find_vc_pdir no compiler found 14.0
>
> trying to find VC 14.0Exp
>
> find_vc_dir(): no VC registry key
> 'Microsoft\\VCExpress\\14.0\\Setup\\VC\\ProductDir'
>
> find_vc_pdir return None for ver 14.0Exp
>
>
>
> The problem is: Visual Studio is always a x86 application. The compiler
> for a x86 target is not a cross compiler and is found in VC\bin, not
> VC\bin\amd64_x86.
> _______________________________________________
> Scons-users mailing list
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.