controllab / fmi-export-20sim

FMI export code generation template for 20-sim
GNU General Public License v3.0
3 stars 4 forks source link

Compile error on FMU #21

Closed mpcagro closed 8 years ago

mpcagro commented 8 years ago

I get the following compile error, when I try to compile export FMU code from 20-sim:

>make
------------------------------------------------------------
20-sim standalone co-simulation FMU export for:
vehicle
------------------------------------------------------------
[cc] src/fmi2Functions.c
[cc] src/EulerAngles.c
[cc] src/motionprofiles.c
[cc] src/xxfuncs.c
[cc] src/xxinteg.c
[cc] src/xxinverse.c
[cc] src/xxmatrix.c
[cc] src/xxmodel.c
[cc] src/xxsubmod.c
make: *** No rule to make target `project/gcc/Table2D.o', needed by `dll'.  Stop.

The bug is apperring with gcc and make on ubuntu 14.04. But is is clearly a mistake in the make file that is being exported.

mpcagro commented 8 years ago

I am still able to use the old version in 4.6.1, that comes with the tool.

>make
------------------------------------------------------------
20-sim standalone co-simulation FMU export for:
vehicle
------------------------------------------------------------
[cc] src/fmi2Functions.c
[cc] src/EulerAngles.c
[cc] src/motionprofiles.c
[cc] src/xxfuncs.c
[cc] src/xxinteg.c
[cc] src/xxinverse.c
[cc] src/xxmatrix.c
[cc] src/xxmodel.c
[cc] src/xxsubmod.c
Creating an empty FMU
Copy the compiled 64-bit so project/gcc/vehicle.so to project/fmu/binaries/linux64
Copy the generated sources to project/fmu/sources
Create the FMU: vehicle.fmu
  adding: binaries/ (stored 0%)
  adding: binaries/linux64/ (stored 0%)
  adding: binaries/linux64/vehicle.so (deflated 59%)
  adding: documentation/ (stored 0%)
  adding: modelDescription.xml (deflated 92%)
  adding: sources/ (stored 0%)
  adding: sources/xxtypes.h (deflated 55%)
  adding: sources/xxinteg.c (deflated 82%)
  adding: sources/fmi2FunctionTypes.h (deflated 73%)
  adding: sources/xxfuncs.c (deflated 59%)
  adding: sources/fmiGUID.h (stored 0%)
  adding: sources/xxmodel.h (deflated 64%)
  adding: sources/EulerAngles.h (deflated 63%)
  adding: sources/xxinverse.c (deflated 47%)
  adding: sources/motionprofiles.c (deflated 49%)
  adding: sources/fmi2Functions.c (deflated 76%)
  adding: sources/xxmatrix.c (deflated 46%)
  adding: sources/xxsubmod.h (deflated 51%)
  adding: sources/xxmatrix.h (deflated 47%)
  adding: sources/xxsubmod.c (deflated 64%)
  adding: sources/motionprofiles.h (deflated 49%)
  adding: sources/xxfuncs.h (deflated 56%)
  adding: sources/EulerAngles.c (deflated 63%)
  adding: sources/fmi2TypesPlatform.h (deflated 62%)
  adding: sources/xxmodel.c (deflated 81%)
  adding: sources/xxinteg.h (deflated 62%)
  adding: sources/fmi2Functions.h (deflated 74%)
Ready!

The main problem right now is that I am unable to use the new variable step size solver export.

margro commented 8 years ago

Hi Martin, My guess is that the fix for this is the following Makefile change: https://github.com/controllab/fmi-export-20sim/commit/2567e806f8e71d528cc86306b005c343ef49c2ee

This fix will be included in the upcoming 20-sim 4.6.2 release (and is already included in 4.6.2-intocps)

Which version of 20-sim are you using? If you are using the code generation template from Github, it should already be fixed...

mpcagro commented 8 years ago

Hi Marcel

I am currently mainly using 4.6.1 and testing 4.6.2-intocps. I thend to not move forward until I have tested that everything from the old version works in the new one. I tried to download a new fmu export from this page (mine could have been to old like you indicated). What happende, was the following:

------------------------------------------------------------
20-sim standalone co-simulation FMU export for 'vehicle'
------------------------------------------------------------
Creating an empty FMU
Generating a GUID: b906afb7-d5a3-4803-bc7f-351b2fa840e1
Generating the modelDescription.xml
Collecting resources
------------------------------------------------------------
Searching for Visual C++ compiler...
Found Visual C++ 2010 express
Loading vsvar32
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Build Engine version 4.0.30319.34209
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.

  EulerAngles.c
  motionprofiles.c
  xxfuncs.c
  xxinteg.c
  xxinverse.c
  xxmodel.c
  xxmatrix.c
  fmi2Functions.c
..\..\src\fmi2Functions.c(491): error C2143: syntax error : missing ';' before
'const' [c:\temp\vehicle\project\VS2010\vehicle.vcxproj]
..\..\src\fmi2Functions.c(492): error C2065: 'fmiCallbackFunctions' : undeclare
d identifier [c:\temp\vehicle\project\VS2010\vehicle.vcxproj]
..\..\src\fmi2Functions.c(492): error C2223: left of '->freeMemory' must point
to struct/union [c:\temp\vehicle\project\VS2010\vehicle.vcxproj]
  xxsubmod.c
  xxTable2D.c
  Generating Code...
Error: "vehicle.dll failed to build!  See ..\VS2010\Release\BuildLog.htm for det
ails."
------------------------------------------------------------
Press any key to exit...

c:\temp\vehicle\project>

Should I just ignore this error and is there a way to stop it from compiling automatically ?

margro commented 8 years ago

Hmm, that error is not good. Looks like an error in the template. Ignoring won't help you since any other compiler and the FMU builder will give a similar error.

Unfortunately, there is no easy way to stop it from compiling. The export searches for a suitable compiler and only skips compilation when VS2010, VS2013 and VS2015 are all three not found.

margro commented 8 years ago

On the other hand, it might be only VS2010 that is complaining about this... My guess is that it is fixed with: c0d159c11153809192816ce4568b23900907760b

mpcagro commented 8 years ago

Ok on the compile stuff. I was just wondering if it was possibly add a export flag for this in 20-sim. I will test again and see what happens !

mpcagro commented 8 years ago

Getting closer :-)

------------------------------------------------------------
20-sim standalone co-simulation FMU export for 'vehicle'
------------------------------------------------------------
Creating an empty FMU
Generating a GUID: 4a09a2b7-bd78-4212-a4fe-fce7d6c9609c
Generating the modelDescription.xml
Collecting resources
------------------------------------------------------------
Searching for Visual C++ compiler...
Found Visual C++ 2010 express
Loading vsvar32
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Build Engine version 4.0.30319.34209
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.

  EulerAngles.c
  motionprofiles.c
  xxfuncs.c
  xxinteg.c
  xxinverse.c
  xxmodel.c
  xxmatrix.c
  fmi2Functions.c
  xxsubmod.c
  xxTable2D.c
  Generating Code...
     Creating library c:\temp\vehicle\project\VS2010\Win32\Release\vehicle.lib
  and object c:\temp\vehicle\project\VS2010\Win32\Release\vehicle.exp
  vehicle.vcxproj -> c:\temp\vehicle\project\VS2010\Win32\Release\vehicle.dll
Build successful.
Copy the compiled DLL VS2010\Win32\Release\vehicle.dll to c:\temp\vehicle\projec
t\fmu\binaries\win32
        1 file(s) copied.
copy the generated sources to c:\temp\vehicle\project\fmu\sources
c:\temp\vehicle\src\EulerAngles.c
c:\temp\vehicle\src\fmi2Functions.c
c:\temp\vehicle\src\motionprofiles.c
c:\temp\vehicle\src\xxfuncs.c
c:\temp\vehicle\src\xxinteg.c
c:\temp\vehicle\src\xxinverse.c
c:\temp\vehicle\src\xxmatrix.c
c:\temp\vehicle\src\xxmodel.c
c:\temp\vehicle\src\xxsubmod.c
c:\temp\vehicle\src\xxTable2D.c
       10 file(s) copied.
c:\temp\vehicle\src\EulerAngles.h
c:\temp\vehicle\src\fmi2Functions.h
c:\temp\vehicle\src\fmi2FunctionTypes.h
c:\temp\vehicle\src\fmi2TypesPlatform.h
c:\temp\vehicle\src\fmiGUID.h
c:\temp\vehicle\src\motionprofiles.h
c:\temp\vehicle\src\xxfuncs.h
c:\temp\vehicle\src\xxinteg.h
c:\temp\vehicle\src\xxmatrix.h
c:\temp\vehicle\src\xxmodel.h
c:\temp\vehicle\src\xxsubmod.h
c:\temp\vehicle\src\xxTable2D.h
c:\temp\vehicle\src\xxtypes.h
       13 file(s) copied.
Generate the FMU

7-Zip 4.57  Copyright (c) 1999-2007 Igor Pavlov  2007-12-06
Scanning

Creating archive c:\temp\vehicle\vehicle.fmu

Compressing  binaries\win32\vehicle.dll
Compressing  modelDescription.xml
Compressing  sources\EulerAngles.c
Compressing  sources\EulerAngles.h
Compressing  sources\fmi2Functions.c
Compressing  sources\fmi2Functions.h
Compressing  sources\fmi2FunctionTypes.h
Compressing  sources\fmi2TypesPlatform.h
Compressing  sources\fmiGUID.h
Compressing  sources\motionprofiles.c
Compressing  sources\motionprofiles.h
Compressing  sources\xxfuncs.c
Compressing  sources\xxfuncs.h
Compressing  sources\xxinteg.c
Compressing  sources\xxinteg.h
Compressing  sources\xxinverse.c
Compressing  sources\xxmatrix.c
Compressing  sources\xxmatrix.h
Compressing  sources\xxmodel.c
Compressing  sources\xxmodel.h
Compressing  sources\xxsubmod.c
Compressing  sources\xxsubmod.h
Compressing  sources\xxTable2D.c
Compressing  sources\xxTable2D.h
Compressing  sources\xxtypes.h

Everything is Ok
------------------------------------------------------------
Your vehicle FMU is ready and can be found in:
  c:\temp\vehicle
The name of your FMU is:
  c:\temp\vehicle\vehicle.fmu
------------------------------------------------------------
Press any key to exit...
mpcagro commented 8 years ago

Succes :-)

>make
------------------------------------------------------------
20-sim standalone co-simulation FMU export for:
vehicle
------------------------------------------------------------
[cc] src/fmi2Functions.c
[cc] src/EulerAngles.c
[cc] src/motionprofiles.c
[cc] src/xxfuncs.c
[cc] src/xxinteg.c
[cc] src/xxinverse.c
[cc] src/xxmatrix.c
[cc] src/xxmodel.c
[cc] src/xxsubmod.c
[cc] src/xxTable2D.c
Creating an empty FMU
Copy the compiled 64-bit so project/gcc/vehicle.so to project/fmu/binaries/linux64
Copy the generated sources to project/fmu/sources
Create the FMU: vehicle.fmu
  adding: binaries/ (stored 0%)
  adding: binaries/win32/ (stored 0%)
  adding: binaries/win32/vehicle.dll (deflated 45%)
  adding: binaries/linux64/ (stored 0%)
  adding: binaries/linux64/vehicle.so (deflated 61%)
  adding: documentation/ (stored 0%)
  adding: modelDescription.xml (deflated 93%)
  adding: resources/ (stored 0%)
  adding: sources/ (stored 0%)
  adding: sources/xxtypes.h (deflated 54%)
  adding: sources/xxinteg.c (deflated 85%)
  adding: sources/fmi2FunctionTypes.h (deflated 73%)
  adding: sources/xxfuncs.c (deflated 62%)
  adding: sources/fmiGUID.h (stored 0%)
  adding: sources/xxmodel.h (deflated 67%)
  adding: sources/EulerAngles.h (deflated 63%)
  adding: sources/xxinverse.c (deflated 48%)
  adding: sources/motionprofiles.c (deflated 50%)
  adding: sources/fmi2Functions.c (deflated 78%)
  adding: sources/xxmatrix.c (deflated 47%)
  adding: sources/xxsubmod.h (deflated 54%)
  adding: sources/xxmatrix.h (deflated 48%)
  adding: sources/xxsubmod.c (deflated 68%)
  adding: sources/motionprofiles.h (deflated 50%)
  adding: sources/xxfuncs.h (deflated 57%)
  adding: sources/EulerAngles.c (deflated 63%)
  adding: sources/xxTable2D.c (deflated 48%)
  adding: sources/fmi2TypesPlatform.h (deflated 62%)
  adding: sources/xxmodel.c (deflated 82%)
  adding: sources/xxTable2D.h (deflated 48%)
  adding: sources/xxinteg.h (deflated 69%)
  adding: sources/fmi2Functions.h (deflated 74%)
Ready!