We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3496

Summary: "fatal error RC1203: invalid language ID or language name specified." when building with CMake on Win10 with VS2015
Product: SDL Reporter: Daniel <dschreij>
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: blocker    
Priority: P2 CC: dschreij
Version: 2.0.5Keywords: target-2.0.6
Hardware: x86_64   
OS: Windows 10   

Description Daniel 2016-11-18 18:53:53 UTC
When using CMake to build SDL2 2.0.5 on Windows 10 with Visual Studio 2015, the process crashes at the end with the following message:

~~~
SDL_mmjoystick.c
[ 98%] Building C object CMakeFiles/SDL2.dir/src/joystick/windows/SDL_windowsjoystick.c.obj
SDL_windowsjoystick.c
[ 98%] Building C object CMakeFiles/SDL2.dir/src/joystick/windows/SDL_xinputjoystick.c.obj
SDL_xinputjoystick.c
[ 99%] Building C object CMakeFiles/SDL2.dir/src/haptic/windows/SDL_dinputhaptic.c.obj
SDL_dinputhaptic.c
[ 99%] Building C object CMakeFiles/SDL2.dir/src/haptic/windows/SDL_windowshaptic.c.obj
SDL_windowshaptic.c
[100%] Building C object CMakeFiles/SDL2.dir/src/haptic/windows/SDL_xinputhaptic.c.obj
SDL_xinputhaptic.c
[100%] Building RC object CMakeFiles/SDL2.dir/src/main/windows/version.rc.res
fatal error RC1203: invalid language ID or language name specified.
NMAKE : fatal error U1077: 'C:\PROGRA~2\WI3CF2~1\8.1\bin\x86\rc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
~~~

This error does not occur when building SDL 2.0.4.
Comment 1 Sam Lantinga 2017-08-11 20:20:36 UTC
Ryan, is this CMake specific?
Comment 2 Ryan C. Gordon 2017-08-20 19:07:49 UTC
(In reply to Sam Lantinga from comment #1)
> Ryan, is this CMake specific?

So the reason this didn't happen in 2.0.4 is because our CMake project didn't include the version.rc files in 2.0.4. That started with this commit:

https://hg.libsdl.org/SDL/rev/b24c67bbb02f

This doesn't cause a problem with CMake on Windows 10 and Visual Studio 2015, if you generate Visual Studio project files, because the VS generator just adds an XML entry for the rc file and that's all. The NMake generator fails because it thinks "/GS-" is a preprocessor define and passes it to rc.exe (this is a cl.exe option, but is bogus for rc.exe). This is our bug, and we accidentally fixed it in https://hg.libsdl.org/SDL/rev/c92070a96da5 a few days ago by correcting the add_definition("/GS-") line.

Fwiw, you can use CMake to generate Visual Studio projects and build with them, all from the command line, as an option, too. My suspicion is that NMake will always be a slightly quirkier build option, and we didn't catch this because the Visual Studio project generator worked okay.

To do this, launch a Visual Studio command line window to a place where the SDL source is in an "SDL" directory, and:

    mkdir SDL-build
    cd SDL-build
    cmake -G "Visual Studio 14 2015" ../SDL
    devenv SDL2.sln /Build release

(That being said, NMake works now, too, so do whatever you think is best!)

Resolving bug!

--ryan.