VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

NIVeriStand.tlc S-Function obj file not found

Hi,

 

I'm working on a matlab block that calls C code through the use of S-Function. In the mdl file, the function is declared like that :

 

[...]
System {
    Name "rtlab_phasor"
    [...]
    Block {
        BlockType S-Function
        Name "Solver"
        [...]
        FunctionName "OpIRTS"
    [...]

(I omitted some fields for brevity).

Now I want to plug that block in a simulink model to interact with it, then incorporate it on Veristand 2017.

 

Now here is my configuration for code generation, the solver is setup ton Fixed-step and discrete

image.png

 

Now comes the time to generate the code and build the dll file. Except the makefile is looking for a .obj file of my S-Function that is nowhere to be found, and crashes at linking time. The problem is that the .obj file is not generated by the tlc, and I'm completely lost. 

I can find that .obj file in my compiled S-Function, but the makefile deletes everytime it builds.

 

Is there a way to link my S-Function as said a library? Static or dynamic?

 

Here's the log of the compilation

 

### VeriStand 2017.0.1.0 (2017 f1) code generation started
### Invoking Target Language Compiler on ephasor.rtw
### Using System Target File: C:\VeriStand\2017\ModelInterface\tmw\target\NIVeriStand.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing header file ephasor.h
### Writing header file ephasor_types.h
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing header file zero_crossing_types.h
.
### Writing source file ephasor.c
### Writing header file ephasor_private.h
### Writing header file rtmodel.h
### Writing source file ephasor_data.c
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rt_defines.h
.
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### TLC code generation complete.
### Generating TLC interface API.
### NI VeriStand 2017.0.1.0 (2017 f1) Modifying source file ephasor.c
### NI VeriStand 2017.0.1.0 (2017 f1) Modifying source file ephasor_data.c
.
### NI VeriStand 2017.0.1.0 (2017 f1) Writing header file ni_pglobals.h
### NI VeriStand 2017.0.1.0 (2017 f1) Modifying header file ephasor.h
### NI VeriStand 2017.0.1.0 (2017 f1) Generating Ports Readme file
### NI VeriStand 2017.0.1.0 (2017 f1) Generating Signals Readme file
### NI VeriStand 2017.0.1.0 (2017 f1) Generating Parameters Readme file
### NI VeriStand 2017.0.1.0 (2017 f1) Copying support files
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
### VeriStand 2017.0.1.0 (2017 f1) code generation done
### VeriStand 2017.0.1.0 (2017 f1) code compilation started
.
### Processing Template Makefile: C:\VeriStand\2017\ModelInterface\tmw\target\NIVeriStand_vc.tmf
[Warning: VeriStand: You selected an unsupported compiler. Attempting to locate a supported installation of the Microsoft Visual Studio C++ tool chain.]
VeriStand: Using the Microsoft Visual C++ 10.0 tools.
### Creating ephasor.mk from C:\VeriStand\2017\ModelInterface\tmw\target\NIVeriStand_vc.tmf
### Building ephasor: .\ephasor_vc.bat
 
C:\[PATH]\ephasor_niVeriStand_rtw>set MATLAB=C:\Program Files\MATLAB\R2017a  
 
C:\[PATH]\ephasor_niVeriStand_rtw>set VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\  
 
C:\[PATH]\ephasor_niVeriStand_rtw>call "C:\VeriStand\2017\ModelInterface\tmw\toolchain\nivs_vcvars32_100.bat"  
Setting environment for using Microsoft Visual C++ 10 x86 tools. 
--- 
Using Microsoft Windows SDK for Visual Studio 2010 
 
C:\[PATH]\ephasor_niVeriStand_rtw>cd /d C:\[PATH]\ephasor_niVeriStand_rtw\  
 
C:\[PATH]\ephasor_niVeriStand_rtw>nmake -f ephasor.mk  ISPROTECTINGMODEL=NOTPROTECTING NIDEBUG=0 NIOPT="Default" OPTS="" /I  
 
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 
Copyright (C) Microsoft Corporation.  All rights reserved. 
 
### Deleting the objects and ephasor.dll 
	del /F /Q ephasor.obj rt_matrx.obj rt_printf.obj ephasor_data.obj ni_modelframework.obj rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj rt_logging.obj rt_sim.obj  ephasor.res  OpIRTS.obj ephasor.lnk ephasor.dll.manifest ephasor.dll 
Could Not Find C:\[PATH]\ephasor_niVeriStand_rtw\ephasor.obj 
### Compiling model source: ephasor.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE -DNI_VERISTAND_MAINMODELFILE ephasor.c 
ephasor.c
### Compiling C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_matrx.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_matrx.c 
rt_matrx.c
### Compiling C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_printf.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_printf.c
rt_printf.c 
### Compiling model data file: ephasor_data.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE -DNI_VERISTAND_MODELDATAFILE ephasor_data.c
ephasor_data.c
### Compiling ni_modelframework.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE ni_modelframework.c 
ni_modelframework.c
### Compiling rtGetInf.c
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE rtGetInf.c
rtGetInf.c
### Compiling rtGetNaN.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE rtGetNaN.c 
rtGetNaN.c
### Compiling rt_nonfinite.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE rt_nonfinite.c 
rt_nonfinite.c
### Compiling C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_logging.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_logging.c 
rt_logging.c
### Compiling C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_sim.c 
	cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -D_DLL -MD /wd4996 /fp:precise  -Od /MD  -DUSE_RTMODEL -DNI_ROOTMODEL_ephasor -DMODEL=ephasor -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_sim.c
rt_sim.c
### Compiling ephasor.rc 
	rc ephasor.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385  
Copyright (C) Microsoft Corporation.  All rights reserved.  
 
### Linking ... 
	C:\PROGRA~1\MATLAB\R2017a\sys\perl\win32\bin\perl C:\PROGRA~1\MATLAB\R2017a\rtw\c\tools\mkvc_lnk.pl ephasor.lnk ephasor.obj rt_matrx.obj rt_printf.obj ephasor_data.obj ni_modelframework.obj rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj rt_logging.obj rt_sim.obj  ephasor.res  OpIRTS.obj
	link /RELEASE  /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib       @ephasor.lnk @ephasor_ref.rsp /dll -out:ephasor.dll
LINK : fatal error LNK1181: cannot open input file 'OpIRTS.obj'
### Created library : C:\[PATH]\ephasor_niVeriStand_rtw\ephasor.dll
C:\[PATH]\ephasor_niVeriStand_rtw>exit /B 0
### The build procedure failed to compile the model: ephasor. This might be the result of a failed linking or compile operation of the binary file.
For more information, refer to the error message generated in the MATLAB Command Window.
If MATLAB reports error LNK1123, make sure to apply all service packs and updates for your version of Microsoft Visual Studio or Windows SDK. For more information about this error, refer to Microsoft article KB2757355.

How am I supposed to supply OpIRTS.obj if it gets deleted at each build, and is not built by the makefile?

 

Thanks

0 Kudos
Message 1 of 4
(3,678 Views)

Hi szeni,

 

I'd like to continue working with you through the Service Request you've created. If anyone on the forums has any input on this, feel free to reply!

 

Otherwise, if we come to some resolution or workaround, I'm sure others would appreciate it if you could post our conclusion here.

Andy F.
Applications Engineering
National Instruments
Message 2 of 4
(3,633 Views)

hello

 

I got the same issue with matlab 2017a and Veristand 2018.

Please can you tell me if you have succed to compil your model with S function ?

 

thanks

0 Kudos
Message 3 of 4
(2,582 Views)

Hi all,

 For future reference - if there's an S-function in the model, it has to be run through MEX before model compilation. So at first compile all the s-functions with MEX, then compile the model.

 It happened also to me - I used C S-functions in the model, the sources were in the folder, but the model compilation failed complaining about lack of the S-function. Turned out that after running the source through MEX, it worked.

Piotr F.
Hardware Engineer @ ZF
0 Kudos
Message 4 of 4
(2,462 Views)