Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Yarn on April 26, 2016, 09:13:50 pm

Title: Can't compile FSO anymore
Post by: Yarn on April 26, 2016, 09:13:50 pm
While working on a new branch of mine, I found that I wasn't able to compile it. My local copy of the main master branch compiled, though. I deleted that copy and cloned a new one to see whether it would fail to compile, and lo and behold, it did fail.

The following errors are generated whenever I try to compile:
Code: [Select]
Severity  Code     Description                        Project     File                                                                                Line
Error     RC2135   file not found: phrases.cfg        Freespace2  C:\Games\FreeSpace2\fs2_open\master\code\freespace2\freespace.rc                    451
Error     LNK1181  cannot open input file 'code.lib'  Fred2       C:\Games\FreeSpace2\fs2_open\master\projects\MSVC_2015\LINK                         1
Error     MSB6006  "cmd.exe" exited with code 9009.   code        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets  171

I'm using Visual Studio Community 2015 Update 2, by the way.
Title: Re: Can't compile FSO anymore
Post by: Yarn on April 26, 2016, 09:51:27 pm
I tracked down the culprit to commit f824df070b2c40e71c8959af6a0b903903c35424 (https://github.com/scp-fs2open/fs2open.github.com/commit/f824df070b2c40e71c8959af6a0b903903c35424), which dates back to August 20, 2015! Either something's wrong with my Visual Studio installation, or no one has tried to check out a fresh copy of FSO's code since then.
Title: Re: Can't compile FSO anymore
Post by: niffiwan on April 26, 2016, 10:27:07 pm
that's confusing, I compiled a bunch of builds after August 2015 as part of my APNG work, and I was updating my branch with master throughout.
Title: Re: Can't compile FSO anymore
Post by: Yarn on April 26, 2016, 10:38:55 pm
What happens if you check out to a completely empty folder and compile that? That's what I had to do to get this problem.
Title: Re: Can't compile FSO anymore
Post by: AdmiralRalwood on April 26, 2016, 10:56:32 pm
Code: [Select]
Severity  Code     Description                        Project     File                                                                                Line
Error     RC2135   file not found: phrases.cfg        Freespace2  C:\Games\FreeSpace2\fs2_open\master\code\freespace2\freespace.rc                    451
So, why isn't phrases.cfg being generated?
Title: Re: Can't compile FSO anymore
Post by: m!m on April 27, 2016, 02:43:22 am
Appveyor compiles all the PR changes using VS 2015 and never failed so there must be something wrong with your Visual Studio installation.
Title: Re: Can't compile FSO anymore
Post by: The E on April 27, 2016, 03:11:59 am
I noticed something similar when I recently had occasion to reinstall my machine. My guess is that the speech API stuff isn't installed, since it doesn't come with VS anymore; you'll need to install the Speech SDK (I think it's this one? (https://www.microsoft.com/en-us/download/details.aspx?id=27226) Gonna have to check that at home later).
Title: Re: Can't compile FSO anymore
Post by: m!m on April 27, 2016, 03:15:56 am
That's odd. I thought the speech SDK was part of the standard Windows SDK. I got the SDK as part of my Visual Studio install (I think I have the Ultimate edition but I'm not sure) but maybe it isn't included in the community edition.
Title: Re: Can't compile FSO anymore
Post by: FreeSpaceFreak on April 27, 2016, 09:35:52 am
I made a couple fresh FSO checkouts over the past few weeks, didn't have any compile errors :nervous: Using VS2015 Community on Windows 7
Title: Re: Can't compile FSO anymore
Post by: chief1983 on April 27, 2016, 12:07:11 pm
Ok, that commit shouldn't matter whether you have the speech sdk or not.  My nightly build system is using VS 2015 Community now, and does an export of only tracked files from my repo, and of a specific hash.  It hasn't had issues building because of that commit.  I hadn't installed Update 2 yet though, doing that now.  I'll see if it causes any issues with building the nightlies from a clean export tomorrow since something was merged today.
Title: Re: Can't compile FSO anymore
Post by: Goober5000 on April 27, 2016, 01:28:44 pm
To correct a few misconceptions:

1) The Speech API files were copied into the codebase a while back.  They are in the speech folder under the top-level directory.
2) The solution was designed to compile whether FS2_VOICER was defined or not (as chief1983 said).  If it was defined, grammar.h and phrases.cfg would be generated and built; if not, they wouldn't.

I don't see anything in that git change that should affect this unfortunately.  Yarn, is FS2_VOICER currently defined in the project that fails to compile?  Strike that, this is the problem:

In freespace.rc (https://github.com/scp-fs2open/fs2open.github.com/commit/f824df070b2c40e71c8959af6a0b903903c35424#diff-964dba9897d2650a87bbe5cd62a92e0e):
Code: [Select]
#ifdef FS2_VOICER
-IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
+IDR_CMD_CFG SRGRAMMAR DISCARDABLE "phrases.cfg"
#endif

In the custom build step:
Code: [Select]
gc /O "$(IntDir)voicer\%(Filename).cfg" /H "$(IntDir)voicer\grammar.h" "%(RootDir)%(Directory)%(Filename)"
It's a simple directory mismatch.  The generated files are being placed in $(IntDir)voicer whereas freespace.rc is looking for them in freespace2.  Additionally, any file that needs to #include grammar.h is probably not going to be able to find it.

Since $(IntDir) is a variable that's only available in the context of a build, and since both grammar.h and phrases.cfg need to be available in the context of compilation, I think PR #290 (https://github.com/scp-fs2open/fs2open.github.com/pull/290) was a mistake and should be reverted.
Title: Re: Can't compile FSO anymore
Post by: m!m on April 27, 2016, 02:01:45 pm
The resource compilation uses the additional include directory "$(Configuration)\code\voicer\" which should contain the files generated by the gc execution. Is it possible to examine the command line of the resource compiler? Maybe the additional include path is wrong.
Title: Re: Can't compile FSO anymore
Post by: AdmiralRalwood on April 27, 2016, 04:28:23 pm
1) The Speech API files were copied into the codebase a while back.  They are in the speech folder under the top-level directory.
They're only used in the 2010 project files (because 2010 Express doesn't include SAPI); otherwise it uses SAPI's compiler, which is definitely included in the Community editions of 2013 and 2015 (if it wasn't, AppVeyor wouldn't work and also I wouldn't have been able to compile FSO with voice recognition after upgrading to Windows 10).

It's a simple directory mismatch.  The generated files are being placed in $(IntDir)voicer whereas freespace.rc is looking for them in freespace2.
No it isn't. I added the directory to the list of directories resources are searched in for.

The problem is not with the project files; they've been thoroughly tested by multiple people at this point. The problem is that Yarn's system is failing to compile phrases.cfg for some reason.


EDIT: Unless Update 2 took them out for some reason; I just tested it and "gc" is no longer recognized. Damn.
Title: Re: Can't compile FSO anymore
Post by: Yarn on May 01, 2016, 09:02:13 pm
The recent change by MageKing17 (I think that's AdmiralRalwood) solved the problem for me.