Building the sdk on windows 8.1 using VS2013 express

Nov 15, 2014 at 12:11 PM
Edited Nov 15, 2014 at 12:15 PM
I'm trying to build the sdk but to no avail.
My goal is to build a static version of the library, following the instructions here:
How to statically link the CPP REST SDK, but I haven't even got to the static part, the build fails on the project as is.

Here's what I did:
  1. cloned the repo from https://git01.codeplex.com/casablanca
  2. ran setup_ps_env_VS2013.ps1 (not sure it's necessary)
  3. opened casablanca120.desktop.sln using VS2013 express
  4. ran Build Solution
    The compilation seems to work, but linking fails with:
error LNK1104: cannot open file 'MY_WORSPACE\cpprest\Binaries\Win32\Debug\cpprest120d_xp_2_2.lib'   MY_WORSPACE\cpprest\Release\samples\BingRequest\BingRequest120.xp\LINK  BingRequest120.xp
I'm not trying to build it for XP at all, so I then tried the same but with the casablanca120.WinRT.sln solution, when I try to build that I get:
MY_WORSPACE\cpprest2\Release\src\build\casablanca120.winrt.vcxproj : error  : Unable to read the project file "casablanca120.winrt.vcxproj".
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1809,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

MY_WORSPACE\cpprest2\Release\src\build\casablanca120.wp81.vcxproj : error  : Unable to read the project file "casablanca120.wp81.vcxproj".
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1809,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

MY_WORSPACE\cpprest2\Release\samples\BlackJack\BlackJack_UIClient\BlackJack_UIClient120.vcxproj : error  : Unable to read the project file "BlackJack_UIClient120.vcxproj".
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1809,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

MY_WORSPACE\cpprest2\Release\samples\FacebookDemo\FacebookDemo120.vcxproj : error  : Unable to read the project file "FacebookDemo120.vcxproj".
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1809,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

MY_WORSPACE\cpprest2\Release\samples\WindowsLiveAuth\WindowsLiveAuth120.vcxproj : error  : Unable to read the project file "WindowsLiveAuth120.vcxproj".
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1809,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Any ideas what I'm doing wrong?
Coordinator
Nov 17, 2014 at 4:39 PM
Hi nitm,

The first thing you are seeing about XP is a known issue that we've fixed in the development branch and it will be in our next release 2.3.0. Basically we had a problem that was causing the XP targeting project file to not be correctly loaded into the solution. That is why when you see the BingRequest sample failing to build due to not being able to find the XP lib. If you want to continue to work out of the master branch you can just unload the BingRequest XP sample from the solution in Visual Studio and continue.

For the second issue I'm guessing you are using a version of Visual Studio express that doesn't support building for Windows Store and Phone, the 'Winrt' solution file. To build for Windows desktop you need to use Express 2013 for Windows Desktop. To build for the Windows Store and Phone you need Express 2013 for Windows.

Steve
Nov 18, 2014 at 6:10 PM
Thanks Steve,

I removed all of the examples and it worked.
But I then noticed that the library is HUGE, about 80MB, why is that?
Coordinator
Nov 18, 2014 at 6:17 PM
Hi nitm,

Specifically exactly what is 80MB? When I take a look at the sizes for Windows Desktop 120 toolset Win32 Debug I see the dll is 5,154KB and the lib is 149KB.

Steve
Nov 18, 2014 at 10:45 PM
Edited Nov 19, 2014 at 8:27 AM
Hey Steve,

I don't know what to tell you, when I look at the produced libraries what I get is far bigger..
The release version (Binaries/Win32/Release/cpprest120_2_2.lib) is 83,021KB
The Debug version (Binaries/Win32/Debug/cpprest120d_2_2.lib) is 96,818KB

It's probably also important to state that I built it as a static library.

Any idea why?
Thanks, Nitzan
Coordinator
Nov 19, 2014 at 4:46 PM
Hi Nitzan,

It is hard to say exactly what is causing it without deeper investigation. We currently don't build static libraries right now. My initial thoughts are a lot of code is getting pulled in from our 3rd party dependencies (Boost, websocketpp, OpenSSL) that all will be eliminated when linked with an actual executable. If you are just keeping and using the static libs on your machine and building your application this is probably a non-issue. There seems to be several threads on stackoverflow about this, if you really want to try and reduce you could try turning off whole program optimization as suggested here.

Steve
Nov 19, 2014 at 5:29 PM
Steve,

In my project the optimization is disabled (just the way it was), and the Whole Program Optimization is set to No .

I need this lib to be part of a program I'm going to spread out, not for something which will run locally on my machine, if that was the case I wouldn't get into this static lib mess.
I've probably went through most if not all of the threads in stackoverflow which deal with building the library as static, but I haven't crossed anything to do with this large file size.
I basically followed this: http://katyscode.wordpress.com/2014/04/01/how-to-statically-link-the-c-rest-sdk-casablanca/ to build it statically.

As you currently don't support the static version, what do you recommend that I should do?
Thanks, nitzan;
Coordinator
Nov 20, 2014 at 4:46 PM
Hi Nitzan,

If you aren't going to be distributing this static lib that you built to others then I wouldn't really worry much about the size. When you actually link with it and build your program I bet a bunch of the unused code is going to be removed. Is the size of the actual program you are then building with this static library abnormally large because of this? If not I wouldn't worry about it.

Steve
Nov 30, 2014 at 1:09 PM
Steve,

Thanks for the info.
You're probably right, I haven't tried yet to compile my project with the static lib, and was just alarmed by the size.
I should get back on that project and check the resulting size, but I'm not sure yet when.
I will update the thread in case it results in too big a file.

Thanks again, nitzan;