Re: MSVC is broken for x86 builds on x64 hosts

Bill Deegan <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAEyG4CEwutQwiPDojfjCOp8wg=jDLtNoSPCPivp_ZOMWzXkYKQ@mail.gmail.com>
Do you see it finding cl.exe for 12.1 with your HOST and TARGET Archs?
Or just find the 12.1 install?
Can you pastebin the whole ms debug log?

On Fri, Mar 29, 2019 at 12:04 AM Michael Hartmann <
[email protected]> wrote:

> Hi Bill,
>
>
>
> I’m using SCons 3.5 on Python 2.7.14.
>
>
>
> Daniel,
>
>
>
> You’re right, I’m using Express edition.
>
>
>
> For Visual Studio 12 I have:
>
> VC\bin\cl.exe
>
> VC\bin\x86_amd64\cl.exe
>
>
>
> VS 14.0:
>
> VC\bin\cl.exe
>
> VC\bin\x86_amd64\cl.exe
>
>
>
> VS 2017:
>
> bin\Hostx86\x86\cl.exe
>
> bin\Hostx86\x64\cl.exe
>
>
>
> So if I set HOST_ARCH (I guess that’s what you meant by HOST_PLATFORM?) to
> x86, I can get a build with 2017/14.1 to work, but not any earlier versions.
>
>
>
> I guess the fix would be in _check_cl_exists_in_vc_dir():
>
>
>
> if not host_trgt_dir:
>
>
>
> “not host_trgt_dir” evaluates to True. A simple change to “if
> host_trgt_dir is None” should fix this.
>
>
>
> After that change, cl.exe is found for older Visual Studio versions.
> However, Scons still doesn’t use the correct compiler. My SConstruct looks
> like this:
>
>
>
> Env = Environment(TARGET_ARCH = 'x86',
>
>     HOST_ARCH = 'x86',
>
>     MSVC_VERSION = '12.0')
>
>
>
> env.Object(“test.obj”, “test.c”)
>
>
>
> SCons still insists on using VS 14.1, even after succesfully finding
> cl.exe for 12.0:
>
> ...
>
> 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'
>
>
>
> msvc_setup_env: using specified MSVC version '14.1'
>
> ...
>
>
>
> Michael
>
>
>
> *Von:* Scons-users <[email protected]> *Im Auftrag von *Bill
> Deegan
> *Gesendet:* Donnerstag, 28. März 2019 17:53
> *An:* SCons users mailing list <[email protected]>
> *Betreff:* Re: [Scons-users] MSVC is broken for x86 builds on x64 hosts
>
>
>
> Michael,
>
>
>
> Which version of SCons, which python?
>
> Is something broken for you?
>
> Or are you just asserting that the current logic is not correct?
>
>
>
> -Bill
>
>
>
> On Thu, Mar 28, 2019 at 7:04 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
>

_______________________________________________
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.