Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

Matlab code gen build issue & differences between processes on WIN10 and WIN2016 Server Docker Container

I have a Matlab code generation process running on a WIN10 Computer and a WIN2016 Server Docker Container with Desktop Experience. (mcr.microsoft.com/windows:1809).

Both have as dependencies: Linaro, CMake, Ninja, Visual Studio 2015 Build Tools.

Both are self-hosted windows agent and use Azure Devops CI/CD Pipeline as a intermediary.

My Goal is replicating and transferring the behavior I see on my working CI/CD Pipeline workflow that uses my win10 self hosted agent to my docker container. Hence I need similar or equivalent output from the Matlab Process job steps.

But at the moment, my Matlab build process isn't picking up all my dependencies during it's build operation & causing bugs.(ex: I'm not seeing a toolchain call) **Notes, as part of the build hierarchy Coo is a giant simulation reference model that contains Boo, who also contains Foo.

WIN10 CI/CD LOG - Matlab Build Step

2020-12-03T18:27:48.7933494Z ### Writing header file Foo.h
2020-12-03T18:27:48.7934118Z .
2020-12-03T18:27:48.7934303Z ### Writing source file Foo.cpp
2020-12-03T18:27:48.7934765Z ### Writing source file C:agentS\_work1sFoo_MBDCodeGenerationgenCodeslprjert\_sharedutils
t_modd.cpp
2020-12-03T18:27:48.7935075Z ### Writing header file C:agentS\_work1sFoo_MBDCodeGenerationgenCodeslprjert\_sharedutils
t_modd.h
2020-12-03T18:27:48.7935299Z ### TLC code generation complete.
2020-12-03T18:27:49.8420364Z .### Using toolchain: Microsoft Visual C++ 2015 v14.0 | nmake (64-bit Windows)
2020-12-03T18:27:50.4226563Z ### Creating 'C:agentS\_work1sFoo_MBDCodeGenerationgenCodeslprjertFooFolderFoo.mk' ...
2020-12-03T18:27:50.4760812Z ### Successful completion of code generation for model: Foo
2020-12-03T18:27:51.0216181Z ### Checking the status of model reference RTW target for model 'Boo' used in 'BooDepency'
2020-12-03T18:27:51.0274892Z ### Model reference RTW target (Boo.cpp) for model Boo is out of date because Boo.cpp does not exist.
2020-12-03T18:27:51.4500966Z ### Starting build procedure for model: Boo
2020-12-03T18:27:51.6342552Z ### Generating code and artifacts to 'Model specific' folder structure
2020-12-03T18:27:51.6346384Z ### Generating code into build folder: C:agentS\_work1sFoo_MBDCodeGenerationgenCodeslprjertBoo
2020-12-03T18:27:55.7613326Z ### Invoking Target Language Compiler on Boo.rtw
2020-12-03T18:27:55.7634508Z ### Using System Target File: C:Program FilesMATLABR2017b2
twcertert.tlc
2020-12-03T18:27:57.2316454Z ### Loading TLC function libraries

WIN2016 SERVER CI/CD LOG - Matlab Build Step

2021-01-08T17:17:13.5588372Z ### Writing header file Foo.h
2021-01-08T17:17:13.5588483Z .
2021-01-08T17:17:13.5588598Z ### Writing source file Foo.cpp
2021-01-08T17:17:13.5588892Z ### Writing source file C:azpagent\_work1sFoo_MBDCodeGenerationgenCodeslprjert\_sharedutils
t_modd.cpp
2021-01-08T17:17:13.5591172Z ### Writing header file C:azpagent\_work1sFoo_MBDCodeGenerationgenCodeslprjert\_sharedutils
t_modd.h
2021-01-08T17:17:13.5593186Z ### TLC code generation complete.
2021-01-08T17:17:21.0428004Z .### Successful completion of code generation for model: Foo
2021-01-08T17:17:25.0400492Z ### Checking the status of model reference RTW target for model 'Boo' used in 'BooDepency'
2021-01-08T17:17:25.0989857Z ### Model reference RTW target (Boo.cpp) for model Boo is out of date because Boo.cpp does not exist.
2021-01-08T17:17:25.7978600Z ### Starting build procedure for model: Boo
2021-01-08T17:17:26.8324115Z ### Generating code and artifacts to 'Model specific' folder structure
2021-01-08T17:17:26.8419696Z ### Generating code into build folder: C:azpagent\_work1sFoo_MBDCodeGenerationgenCodeslprjertBoo
2021-01-08T17:17:42.5806329Z ### Invoking Target Language Compiler on Boo.rtw
2021-01-08T17:17:42.6248549Z ### Using System Target File: C:Program FilesMATLABR2017b
twcertert.tlc
2021-01-08T17:17:47.8626194Z ### Loading TLC function libraries

Error:

2021-01-08T17:44:26.8831417Z CGIR assertion 'Allocation failed. Insufficient memory to continue.' failed in 'b:matlabsrccg_irutil_prim
eleasemempool.hpp:100'
2021-01-08T17:44:26.8838372Z [  0] 0x00000000f792269d                                binwin64
twcg.dll+02631325
2021-01-08T17:44:26.8838625Z [  1] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8838890Z [  2] 0x00000000f792269d                                binwin64
twcg.dll+02631325
2021-01-08T17:44:26.8839131Z [  3] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8839423Z [  4] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8850385Z [  5] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8850920Z [  6] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8851176Z [  7] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8851566Z [  8] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8851820Z [  9] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8852057Z [ 10] 0x00000000f792269d                                binwin64
twcg.dll+02631325
2021-01-08T17:44:26.8852290Z [ 11] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8857614Z [ 12] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8857847Z [ 13] 0x00000000f792269d                                binwin64
twcg.dll+02631325
2021-01-08T17:44:26.8858087Z [ 14] 0x00000000f79226b9                                binwin64
twcg.dll+02631353
2021-01-08T17:44:26.8860899Z [ 15] 0x00000000f792269d                                binwin64
twcg.dll+02631325
2021-01-08T17:46:34.3864280Z ### Build procedure for model: 'Coo' aborted due to an error.
2021-01-08T17:46:51.2150096Z Error using tlc_c (line 176)
2021-01-08T17:46:51.2153547Z Unexpected or internal error encountered in "in CGIR: b:matlabsrccg_irutil_prim
eleasemempool.hpp line 100: Allocation failed. Insufficient memory to continue.
2021-01-08T17:46:51.2153868Z ".  Please report this to MathWorks if you can cause it to recur
2021-01-08T17:46:51.2157314Z 
2021-01-08T17:46:51.2157502Z Error in coder.internal.ModelBuilder/buildProcedure (line 710)
2021-01-08T17:46:51.2159775Z                 buildResult = tlc_c(h,...
2021-01-08T17:46:51.2159884Z 
2021-01-08T17:46:51.2165597Z Error in coder.internal.ModelBuilder/make_rtw (line 197)
2021-01-08T17:46:51.2165818Z                 buildResult = buildProcedure...
2021-01-08T17:46:51.2165917Z 
2021-01-08T17:46:51.2168320Z Error in coder.internal.ModelCodegenMgr/make_rtw (line 8)
2021-01-08T17:46:51.2171494Z     buildResult = obj.make_rtw(varargin);
2021-01-08T17:46:51.2171616Z 
2021-01-08T17:46:51.2171708Z Error in make_rtw (line 20)
2021-01-08T17:46:51.2171859Z buildResult = h.make_rtw(buildArgs, varargin{:});

Any Hints?

I'm not sure if it's a problem with my dependencies? Or an issue with memory in my docker container? Or something else?

Extra info :

I use chocolatey as a packet manager in my docker files to install my dependencies. They are all on the PATH, but may be in different location than my work computer. I didn't make the Cmake files or the core matlab project structure, so I'm not sure if the build process is absolute path dependent.

Update:

I tried running mex -v setup on both host and Dockers container. I have this on host :

...
Found installed compiler 'Microsoft Visual C++ 2017 (C)'.
...
Found installed compiler 'Microsoft Visual C++ 2015 (C)'.

I didn't find any configured compiler on Docker Container

... 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.
...
Did not find installed compiler 'Microsoft Visual C++ 2015 (C)'.
...
Did not find installed compiler 'Microsoft Visual C++ 2017 (C)'.

Could that cause the issue? How do I remedy that?


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

1 Answer

0 votes
by (71.8m points)

Solution:

Add a new registry entry via the Docker file.

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

Note:

I opened another question related to a sub-question of this issue. I got my answer. Turns out that sub-problem solution applied to the whole bug discussed here.

Chocolatey generated VS 2015 Compiler not found on docker image


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...