02-24-2020 03:30 AM
Hello all,
I've tried to compile a Simulink model for use with Veristand 2019 R3. I've done it before for NIVS 2018 (with Matlab 2016b) and it worked well. For 2019R3 though, there's a new *.tlc file introduced and Veristand Version Compatibility page says it needs a different compiler (MinGW instead of Windows SDK 7.1).
I've managed to get the compilation running using Matlab 2018a with Matlab-provided MinGW compiler... There's one problem, though - the result of the compilation is an EXE instead of a DLL. Any suggestions?
Thank you in advance!
Veristand: 2019 R3
Matlab: 2018a (Simulink, Stateflow, MinGW compiler)
Solved! Go to Solution.
02-24-2020 04:01 AM
Hi Piotr,
you must use NI provided compiler from https://www.ni.com/cs-cz/support/downloads/software-products/download.c-c---development-tools.html#3...
Linked in the KB https://www.ni.com/cs-cz/support/documentation/compatibility/17/veristand-version-compatibility.html
Regards,
Jiri
CLA, CTA
02-24-2020 05:05 AM
Hello Jiri,
Thank you!
That's essentially the same article that I linked in the initial post... I've read it again, however, and noticed that there is another table for PharLap compatibility (I've been looking at the Windows table all the time - sorry, should've read it more thoroughly). That table lists R2018a as incompatible anyway - I need at most R2017b (with Windows SDK 7.1) for PharLap support... (Time to move to Linux, I think).
I've tried pointing Matlab to different compilers according to https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7qZSAS&l=pl-PL and here are the results:
- Veristand compiler for Linux 64-bit: compiles an *.so file - seems OK
- Veristand compiler for Linux 32-bit: compiles an *.so file - seems OK
- Veristand compiler for Windows: fails with following error
"Error(s) encountered while building "squibs": ### Failed to generate all binary outputs.
I have "C/C++ Development Tools for NI Linux RT 2017" installed. Should it work for generating models for Windows too or do I need to install another compiler package for this?
This topic in Veristand Help: https://www.ni.com/documentation/en/veristand/latest/manual/select-compiler/ points out that for compiling models for Windows one needs an "environment variable", but doesn't specify its name nor the expected contents.
02-24-2020 05:33 AM
Hi Piotr,
it was not clear to me from your post, that you want to generate model for Windows... I expected somehow Linux.
Honestly I haven't tried yet with R3...
~Jiri
CLA, CTA
02-24-2020 05:54 AM - edited 02-24-2020 06:12 AM
Hi Jiri,
That's fine 🙂 I should've been more specific. I ran into this problem on Friday afternoon...
My goal is to have fully functional model compiling environment, as the only Veristand platform that we don't have around here is an VxWorks cRIO... 🙂
In fact the problem started from an attempt to compile model for PharLap. Now I know that for this I need older Matlab and the Windows SDK 7.1 (seems like I can use the same toolchain as for NIVS2018).
By the way - should older models (compiled for Veristand 2018) run without changes in 2019 or do they require recompiling because of changes in Model Framework?
Then I tried to compile with another compiler, but I missed the entries for Veristand toolchains. Now it's clear that there are entries for Linux compilers and they require C/C++ Development tools for Linux RT.
One thing that remains is to solve is to get the Windows-targeting compiler to run. NI Support people pointed me to another KB article: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000001DmQcCAK&l=pl-PL
If it's true, I need to check which MinGW compilers are installed on my machine (I expect two - Matlab-provided and Ni DevTools-provided) and properly manipulate system PATH, depending on which platform I'm building the model for.
02-24-2020 08:59 AM
Hi Piotr,
I've got a hint from colleagues.
Would you check?
Thanks,
Jiri
CLA, CTA
02-24-2020 09:30 AM
Hi Piotr,
Just to add on to Jiri's comments, you can find the mingw project here: https://sourceforge.net/projects/mingw-w64/files/. As our documentation states, VeriStand will require MinGW-w64 for 32-bit and 64-bit Windows with slsj and win32 options: https://www.ni.com/documentation/en/veristand/latest/manual/select-compiler/. The toolchain I would recommend is here: x86_64-win32-sjlj.
Once you install the "correct" MinGW-w64, you can follow that KB you linked earlier. We'll make sure to update that KB to include the information on MinGW versions so this is clearer.
Best,
Brian
02-25-2020 04:50 AM
Hi Jiri & Brian,
Thank you for pointers and the information. I'll have to download the MinGW compiler somehow (IT policy blocks us from SourceForge...) and test if it works - this can take some time...
It seems like the solution will be to have BAT files to run Matlab with proper PATH setup based on the platform for which the model is targeted.
02-25-2020 04:43 PM
Hi Piotr,
You should not actually require having the Eclipse provided gcc.exe in PATH to compile models for NI Linux RT with the NI toolchain. I believe the Eclipse installation automatically adds those to PATH, but it should not be required. So, you should just need MinGW added to PATH after you install the compatible version.
Best,
Brian
02-26-2020 07:44 PM
"Remove Eclipse added GCC from path and leave MinGW64 in the path" can work. Veristand 2019 r3 model generation is still more complex than before. I've tried different combination of the TLC and compilers. Hope this is useful for others to reference.