Search code examples
pythonccmakemingw-w64fmi

Failed building/installing PyFMI package on 64bit Windows 10


I have successfully built the FMILibrary with MinGW W64. At least no error message was shown. When it comes to installing PyFMI I failed with the gcc compiler as well as with several visual studio compilers.

This is the last message in the command line I get unsing the mingw compiler:

error: Command "gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -IC:\Python27\lib\site-packages\numpy\core\include -Isrc -Isrc\pyfmi -IC:\Users\Michael\Documents\Builds\install\include -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c src\pyfmi\fmi.c -o build\temp.win-amd64-2.7\Release\src\pyfmi\fmi.o -O2 -fno-strict-aliasing" failed with exit status 1

Before the operation quits, I get several different errors similar to this:

src\pyfmi\fmi.c:82221:20: error: invalid application of 'sizeof' to incomplete type 'enum fmi1_status_kind_t'
         if (sizeof(enum fmi1_status_kind_t) < sizeof(long)) {

I also tried compiling the FMI library with visual studio compilers, but this failed due to vsnprintf errors.

Consider I might have done some stupid mistakes, because I have never manually compiled any libraries or so.

I am thankful for any suggestions.

Cheers, Michael


Solution

  • Well, I fixed it. Here is how:

    1. Removed latest Visual Studio installation, in my case 2015.

    2. Installed Visual Studio Express 2010 from ISO.

    3. Installed Windows 7 SDK from ISO. To avoid .NET version error, I used the setupsdk installer in the setup folder. Note: Make sure you downloaded the 64bit version of the SDK.

    4. Installed SP1 for Visual Studio 10 an the compiler update.

    5. Built and installed FMI-Library using latest cmake release.

    6. Ceated an environment variable FMIL_HOME with the installation path of the FMI-Library as the value.

    7. Installed Visual C++ Compiler for Python.

    8. Finally installed PyFMI using the command pip install pyfmi in the windows command line.

    This worked for me, maybe I can help someone out with this.