Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiling for Win 8.1 and Win 8.1RT
12-12-2013, 09:27 AM
Post: #1
Compiling for Win 8.1 and Win 8.1RT
Hi,

Actually I have two questions:

1: Has anyone ever compiled the source on a Windows 8.1 machine using Visual Studio 2013? I get an error in the file Os/Windows/Os.c because Microsoft has deprecated the GetVersionEx function.
My C++ skills are rusted solid I'm afraid...

2: In theory it should be possible to get the sources compiled for Windows 8.1 ARM for Windows RT. I guess that I have make some changes in the make file? When I compile now in the command prompt for the ARM compiler I get a fatal error saying "Compiling Desktop applications for the ARM platform is not supported"
Find all posts by this user
12-12-2013, 10:45 AM
Post: #2
RE: Compiling for Win 8.1 and Win 8.1RT
(12-12-2013 09:27 AM)ftamminga Wrote:  1: Has anyone ever compiled the source on a Windows 8.1 machine using Visual Studio 2013? I get an error in the file Os/Windows/Os.c because Microsoft has deprecated the GetVersionEx function.
My C++ skills are rusted solid I'm afraid...

The following patch (which'll appear on github in the next couple of days) should fix this:

Code:
diff --git a/Os/Windows/Os.c b/Os/Windows/Os.c
index febf408..6e93bbc 100644
--- a/Os/Windows/Os.c
+++ b/Os/Windows/Os.c
@@ -10,6 +10,9 @@
#include <Ws2tcpip.h>
#include <Iphlpapi.h>
#include <Dbghelp.h>
+#if NTDDI_VERSION > 0x06010000
+# include <versionhelpers.h>
+#endif

static const uint32_t kMinStackBytes = 1024 * 16;
static const uint32_t kStackPaddingBytes = 1024 * 16;
@@ -244,6 +247,7 @@ void OsConsoleWrite(const char* aStr)

void OsGetPlatformNameAndVersion(OsContext* aContext, char** aName, uint32_t* aMajor, uint32_t* aMinor)
{
+#if NTDDI_VERSION <= 0x06010000 /* Windows 7 and below */
     OSVERSIONINFO verInfo;
     UNUSED(aContext);
     memset(&verInfo, 0, sizeof(verInfo));
@@ -252,6 +256,14 @@ void OsGetPlatformNameAndVersion(OsContext* aContext, char** aName, uint32_t* aM
     *aName = "Windows";
     *aMajor = verInfo.dwMajorVersion;
     *aMinor = verInfo.dwMinorVersion;
+#else
+    /* There doesn't seem to be any reliable way to determine version info on Windows 8.1 and beyond
+       The recommended route appears to be to add ever more IsWindowsXxx tests as new OS versions are released... */
+    UNUSED(aContext);
+    *aName = "Windows";
+    *aMajor = 6;
+    *aMinor = (IsWindows8Point1OrGreater()? 3 : 2);
+#endif
}

THandle OsSemaphoreCreate(OsContext* aContext, const char* aName, uint32_t aCount)

(12-12-2013 09:27 AM)ftamminga Wrote:  2: In theory it should be possible to get the sources compiled for Windows 8.1 ARM for Windows RT. I guess that I have make some changes in the make file? When I compile now in the command prompt for the ARM compiler I get a fatal error saying "Compiling Desktop applications for the ARM platform is not supported"

Which version of visual studio are you using? Which version of Windows are you running it on? (I'm using Win7 and can't see any option to use VS 2013 Express to create RT apps so can't try a test build myself...)

Googling for the error links to various claimed solutions you could try. Its likely all will require that you edit the makefile - OhNet.mak. If you can get a build running via Visual Studio using a sample project, you could look through the project's settings and edit the variables that make up the command line build invocation in the makefile.
Find all posts by this user
12-12-2013, 12:01 PM
Post: #3
RE: Compiling for Win 8.1 and Win 8.1RT
(12-12-2013 10:45 AM)simonc Wrote:  Which version of visual studio are you using? Which version of Windows are you running it on? (I'm using Win7 and can't see any option to use VS 2013 Express to create RT apps so can't try a test build myself...)

You'll have to use Windows 8.1 with VS2013 in order to create Win8.1RT apps. No way around that.
But I'll go ahead and try to get the make file running.
Find all posts by this user
12-12-2013, 01:57 PM (This post was last modified: 12-12-2013 02:21 PM by ftamminga.)
Post: #4
RE: Compiling for Win 8.1 and Win 8.1RT
Ok, It's compiling now with the patch included, but it stops at a python script that wants to bundle some stuff.
Do I need to install Pyhon to make the build work? And if so: what version? The version I downloaded gives errors on the print statement that seems to be altered into a function from version 3 up.
-----
EDIT: I have installed python 2.7.6 and it works now
-----

Apart from that:
Am I correct that, if I want to create an RT version, I have to combine the 'Windows' with 'armv7' paths of compiling?
Find all posts by this user
12-12-2013, 02:28 PM
Post: #5
RE: Compiling for Win 8.1 and Win 8.1RT
(12-12-2013 01:57 PM)ftamminga Wrote:  Ok, It's compiling now with the patch included, but it stops at a python script that wants to bundle some stuff.
Do I need to install Pyhon to make the build work? And if so: what version? The version I downloaded gives errors on the print statement that seems to be altered into a function from version 3 up.
-----
EDIT: I have installed python 2.7.6 and it works now
-----

Good stuff.

You will need python for the final step of the build - zipping the build outputs. This can be considered optional; if you could live with a "successful" build ending by reporting an error, you could choose to ignore the bundling. Installing python and having this final build step succeed is obviously good too.

(12-12-2013 01:57 PM)ftamminga Wrote:  Apart from that:
Am I correct that, if I want to create an RT version, I have to combine the 'Windows' with 'armv7' paths of compiling?

I'm not sure what you mean. I'd imagine you would need to use an arm cross-compiler that was distributed with MSVC. I don't think there are any architecture-specific parts of OhNet.mak however.

If this doesn't help, can you clarify your question please?
Find all posts by this user
13-12-2013, 09:32 AM
Post: #6
RE: Compiling for Win 8.1 and Win 8.1RT
Ok, my progress so far:
Using the VS2013 ARM Cross Tools Command Prompt and making some changes in:
- ohNet.mak, added the definition for WINAPI_FAMILY=WINAPI_FILMILY_APP
61: compiler = cl /nologo /DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP /Fo$(objdir)
- Os/Windows/TeminalOs.cpp, changed line 19 in:
19: #ifndef WINAPI_FAMILY
20: return (TChar) (_getch());
21: #else
22: return 0;
23: #endif

This, because RT does not have the function _getch(). See http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx
Maybe returning just a 0 is not the best solution, but it compiles Smile.

Now i'm stuck at the next hurdle. The make file runs well up to compiling Os/Windows/Os.c. Somehow the compiler does not like the SOCKET identifier. After 100 syntax errors it stops.
I get the following errors

cl /nologo /DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP /FoBuild\Obj\Windows\Release\Os.obj -c /MT /Ox /W4 /EHsc /FRBuild\Obj\Window
s\Release\ -DDEFINE_LITTLE_ENDIAN -DDEFINE_TRACE -D_CRT_SECURE_NO_WARNINGS /WX -IBuild\Include Os/Windows/Os.c
Os.c
Os/Windows/Os.c(28) : error C2061: syntax error : identifier 'SOCKET'
Os/Windows/Os.c(29) : error C2061: syntax error : identifier 'iEvent'
Os/Windows/Os.c(29) : error C2059: syntax error : ';'
etc, etc, etc...

I don't have a clue how to fix this one. I cannot find anything about that SOCKET identifier in combination with the ARM compiler for now. I'll update this post if I get any further.
Suggestions are welcome.
Find all posts by this user
13-12-2013, 10:26 AM
Post: #7
RE: Compiling for Win 8.1 and Win 8.1RT
(13-12-2013 09:32 AM)ftamminga Wrote:  Now i'm stuck at the next hurdle. The make file runs well up to compiling Os/Windows/Os.c. Somehow the compiler does not like the SOCKET identifier. After 100 syntax errors it stops.
I get the following errors

cl /nologo /DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP /FoBuild\Obj\Windows\Release\Os.obj -c /MT /Ox /W4 /EHsc /FRBuild\Obj\Window
s\Release\ -DDEFINE_LITTLE_ENDIAN -DDEFINE_TRACE -D_CRT_SECURE_NO_WARNINGS /WX -IBuild\Include Os/Windows/Os.c
Os.c
Os/Windows/Os.c(28) : error C2061: syntax error : identifier 'SOCKET'
Os/Windows/Os.c(29) : error C2061: syntax error : identifier 'iEvent'
Os/Windows/Os.c(29) : error C2059: syntax error : ';'
etc, etc, etc...

I don't have a clue how to fix this one. I cannot find anything about that SOCKET identifier in combination with the ARM compiler for now. I'll update this post if I get any further.
Suggestions are welcome.

ohNet uses Windows' traditional networking library - WinSock - for sockets support. This has existed for about 20 years and I assumed Microsoft's reputation for caring about backwards compatibility would mean it would continue to be supported. It turns out I was wrong... According to http://msdn.microsoft.com/en-us/library/...64945.aspx WinSock is not supported in WinRT.

Getting ohNet working with WinRT looks like it'd require re-implementing the OsNetwork* functions to use Windows.Networking.Sockets. I'd imagine this work, plus refactoring to the existing Windows port, might take about a week for someone familiar with network programming who has a Windows 8.1 machine.

I don't plan to do this work at present (not least because I don't have a Windows 8.1 install). I'm happy to accept patches if you want to have a go at it.
Find all posts by this user
13-12-2013, 10:48 AM
Post: #8
RE: Compiling for Win 8.1 and Win 8.1RT
Thanks for your effort so far.

I'm afraid it ends for me here at this moment. My last real C++ experience was somewhere around 2001. I can find my way in the file structure and am able to read the code, but I don't have the illusion I can make a substantial contribution to the project.
Find all posts by this user


Forum Jump: