Search code examples
c++cmakemaya-api

Difficulties troubleshooting this build error for a Maya plugin (v2016.5)


Trying to build this plugin from source but using Visual Studio 2017: https://github.com/david-cattermole/mayaMatchMoveSolver/blob/master/BUILD_WINDOWS.md

I followed its directions except i have been using x64_x86 Cross Tools Command Prompt for VS 2017, but I keep getting these errors when attempting to build

preview of errors:

13>------ Build started: Project: mmSolver, Configuration: Debug x64 ------
13>Building Custom Rule C:/Users/Desktop02/Documents/mayaMatchMoveSolver2017/CMakeLists.txt
13>pluginMain.cpp
13>C:\MinGW\include\stdio.h(38): warning C4068: unknown pragma
13>C:\MinGW\include\msvcrtver.h(35): warning C4068: unknown pragma
13>C:\MinGW\include\w32api.h(35): warning C4068: unknown pragma
13>C:\MinGW\include\sdkddkver.h(35): warning C4068: unknown pragma
13>C:\MinGW\include\w32api.h(184): warning C4005: '_EXTERN_C' : macro redefinition
13>        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\yvals.h(472) : see previous definition of '_EXTERN_C'
13>c:\mingw\include\sys/types.h(34): warning C4068: unknown pragma
13>C:\MinGW\include\stdio.h(260): error C2143: syntax error : missing ';' before '*'
13>C:\MinGW\include\stdio.h(260): warning C4229: anachronism used : modifiers on data are ignored
13>C:\MinGW\include\stdio.h(260): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
13>C:\MinGW\include\stdio.h(260): error C2377: 'FILE' : redefinition; typedef cannot be overloaded with any other symbol
13>        C:\MinGW\include\stdio.h(220) : see declaration of 'FILE'
13>C:\MinGW\include\stdio.h(261): error C2143: syntax error : missing ';' before '*'
13>C:\MinGW\include\stdio.h(261): warning C4229: anachronism used : modifiers on data are ignored
13>C:\MinGW\include\stdio.h(261): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
13>C:\MinGW\include\stdio.h(261): error C2061: syntax error : identifier 'FILE'
13>C:\MinGW\include\stdio.h(262): error C2062: type 'int' unexpected
13>C:\MinGW\include\stdio.h(263): error C2062: type 'int' unexpected

full error: https://pastebin.com/HzxLed93

and I get similar looking errors using Visual Studio 2012 Update 5 as described in the doc (maybe without the ones concerning stdio.h).

I just really have no idea how to troubleshoot this further, so if anyone can provide some assistance/insight would be appreciated...

Some details:

CMake 3.17.3
Python 2.7.12

Maya version:
Operating System: Microsoft Windows 7 Business Edition, 64-bit Windows 7 Service Pack 1 (Build 7601)

Cut ID: 201603022110-988944-2
Maya Version: Autodesk Maya 2016 Extension 2
Maya API: 201650
Qt Version: 4.8.6
Compositing Manager: True
Window Manager: Windows Aero
GPU: Version : 2015.11.4.11. Feature Level 5.
Adapter : GeForce GTX 560 Ti/PCIe/SSE2
Vendor ID: 4318. Device ID : 4608
Driver : nvoglv64.dll:23.21.13.9135.
API : OpenGL V.4.6. Max texture size : 16384 * 16384. Max tex coords : 32
Shader versions supported (Vertex: 5, Geometry: 5, Pixel 5).
Shader compiler profile : (Best card profile)
Active stereo support available : 0
GPU Memory Limit : 1024 MB.
CPU Memory Limit: 31107 MB.

EDIT: I was looking at this thread in search of similar looking errors: https://forum.zdoom.org/viewtopic.php?f=3&t=13253

and a user states that reading include files from MinGW will create issues. If that is the case, how do I then switch VS 2017 from using the MSVC(?) files instead of MinGW? Is there something i can add with a cmake command that will force it to change?


Solution

  • I submitted an issue in the original repo and the plugin's author has helped me resolve the issue, here are the steps i took:

    1. re-installed VS 2012 with Update 4 (https://my.visualstudio.com/Downloads?q=visual%20studio%202012)
    2. re-generated a solution/project for this plugin via the docs
    3. removed C:\MinGW from the "Additional Includes Directories" from the mmSolver project in Visual Studio
    4. replaced COMMAND rcc -binary resources.qrc -o resources.rcc in icons\CMakeLists.txt to COMMAND C:/Python27/Lib/site-packages/PyQt4/pyrcc4.exe -o resources.rcc resources.qrc (I had to do something similar for the sphinx-build anyways)

    After doing all of that I re-compiled the solution, and it seemed to work? although there were a lot of warnings, hoping that these are expected.../

    https://pastebin.com/bpf1U4vD

    And I saw that a .mod file and a directory identically named to your latest release were generated, but just copying those didn't really do anything, so what I ended up doing was taking the release zip file and extracting that, but replaced the .mll plugin file with what was generated on my end. I also noticed that if I left the .mod file the way it was my version of Maya still did not load anything, so as a guess I changed the + PLATFORM:win64 MAYAVERSION:2016 mayaMatchMoveSolver 0.3.6 line in the mod file to + PLATFORM:win64 MAYAVERSION:2016.5 mayaMatchMoveSolver 0.3.6 and that made everything load up fine.

    For more info refer to the issue I have submitted here: https://github.com/david-cattermole/mayaMatchMoveSolver/issues/148