Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

windows - Chocolatey generated VS 2015 Compiler not found on docker image

I tried to install visual studio 2015 build tools on a Docker Container using the chocolatey packet manager. I need it for a Matlab code gen build operation. The chocolatey steps works fine. But my docker container can't find the compiler. Any Hints?

Docker

RUN powershell -command choco install -y vcredist140
RUN powershell -command choco install -y vcbuildtools -ia "/Full"

Using mex -v -setup I have:

Host(WIN10):

... Looking for compiler 'Microsoft Visual C++ 2015 (C)' ...
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7' 14.0 ...Yes ('C:Program Files (x86)Microsoft Visual Studio 14.0VC').
... Looking for file 'C:Program Files (x86)Microsoft Visual Studio 14.0VCinamd64cl.exe' ...Yes.
... Looking for folder 'C:Program Files (x86)Microsoft Visual Studio 14.0VC' ...Yes.
... Looking for registry setting 'HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...Yes ('C:Program Files (x86)Windows Kits8.1').
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7' 14.0 ...Yes ('C:Program Files (x86)Microsoft Visual Studio 14.0').
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7' 14.0 ...Yes ('C:Program Files (x86)Microsoft Visual Studio 14.0VC').
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVC7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7' 14.0 ...Yes ('C:Program Files (x86)Microsoft Visual Studio 14.0VC').
... Looking for file 'C:Program Files (x86)Microsoft Visual Studio 14.0VCvcvarsall.bat' ...Yes.
... Looking for folder 'C:Program Files (x86)Microsoft Visual Studio 14.0VC' ...Yes.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftWindows KitsInstalled Roots' KitsRoot10 ...Yes ('C:Program Files (x86)Windows Kits10').
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftWindows KitsInstalled Roots' KitsRoot10 ...Yes ('C:Program Files (x86)Windows Kits10').
... Executing command 'echo off&set "sdkversion="&(for /f %a IN ('dir "C:Program Files (x86)Windows Kits10include" /b /ad-h /on') do ( @if exist "C:Program Files (x86)Windows Kits10include\%aucrt" set "sdkversion=%a" ))&call echo %sdkversion%' ...Yes ('10.0.17763.0').
Found installed compiler 'Microsoft Visual C++ 2015 (C)'.

Docker(WINSERV2016):

... Looking for file 'C:Program Files (x86)Microsoft Visual Studio 14.0VCinamd64cl.exe' ...Yes.
... Looking for folder 'C:Program Files (x86)Microsoft Visual Studio 14.0VC' ...Yes.
... Looking for registry setting 'HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv8.1' InstallationFolder ...Yes ('C:Program Files (x86)Windows Kits8.1').
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7' 14.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREMicrosoftVisualStudioSxSVS7' 15.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREMicrosoftVisualStudioSxSVS7' 15.0 ...No.
... Looking for registry setting 'HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7' 15.0 ...No.
... Looking for registry setting 'HKCUSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7' 15.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015 (C)'.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After some exploration, I found that:

  1. mex -v -setup lookup table is in C:Program FilesMATLABR2017binwin64mexoptsmsvcpp2015.xml

  2. Matlab needs specifics VS7 registry values to say that a VS 2015 compiler is installed.

  3. Chocolatey only Install VC7 registry values.

If you add this to a docker file or run line in CLI container:

RUN reg add  HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftVisualStudioSxSVS7 /v 14.0 /t REG_SZ /d "C:Program Files (x86)Microsoft Visual Studio 14.0VC"

It fixes the issue.

msvcpp2015.xml

        <VSINSTALLDIR>
            <or>
                <hklmExists path="SOFTWAREMicrosoftVisualStudioSxSVS7" name="14.0" />
                <hkcuExists path="SOFTWAREMicrosoftVisualStudioSxSVS7" name="14.0" />
                <hklmExists path="SOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7" name="14.0" />
                <hkcuExists path="SOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7" name="14.0" />
                <hklmExists path="SOFTWAREMicrosoftVisualStudioSxSVS7" name="15.0" />
                <hkcuExists path="SOFTWAREMicrosoftVisualStudioSxSVS7" name="15.0" />
                <hklmExists path="SOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7" name="15.0" />
                <hkcuExists path="SOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7" name="15.0" />
            </or>
        </VSINSTALLDIR>

Ref: https://www.mathworks.com/matlabcentral/answers/412396-how-to-setup-matlab-compiler-to-use-msvc2017-build-tools


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...