[how to] compile and port win32 apps to Windows RT ARM

Search This thread

unbenannt

Senior Member
Apr 30, 2009
147
21
Is there some decent desktop mp3 player -port for RT?

and why is there no windows media player on desktop. it could have helped a lot and made the experience far better within desktop mode.
 

Geo8

Member
Jun 7, 2014
15
0
I tried several times to port SDR# on my own but I can't get it to work. I am a beginner but want to use it on my Surface RT now.
Can somebody with some free time help me out on this?
http://sdrsharp.com/# is the download
 

hisoft

Senior Member
Feb 17, 2009
199
20
Last edited:

thandiBear

Senior Member
Aug 13, 2017
141
31
You can only build with VS2012

Thanks for replying... I thought this thread was dead already.
Another thing, where can I get the dll to lib tool from? The link in op takes me to another thread, whose download link does not work. I believe the whole process is easy to follow even if one has zero developing/programming experience

Long live surface RT
 

Qiangong2

Senior Member
Oct 31, 2014
1,452
381
Samsung Galaxy S20
Thanks for replying... I thought this thread was dead already.
Another thing, where can I get the dll to lib tool from? The link in op takes me to another thread, whose download link does not work. I believe the whole process is easy to follow even if one has zero developing/programming experience

Long live surface RT

The link is correct for the dll to lib tool. There is a download at the bottom of the first post. It's great that more people are getting interested in app porting for RT
 
  • Like
Reactions: OlirexGamer

thandiBear

Senior Member
Aug 13, 2017
141
31
The link is correct for the dll to lib tool. There is a download at the bottom of the first post. It's great that more people are getting interested in app porting for RT

My surface was just collecting dust in a closet until this Thursday, when suddenly random neurons fired in my brain and I thought "why not Google how to.....".

Thank all you guys for taking a step further in making the RT what it should have been at launch
 
Last edited:

lovicub

Member
Aug 22, 2011
20
6
Cologne
First of all, thank you for this tutorial! 'm able to complie my own programms and some of example apps from MSDN/VS examples (with .sln project files).
After compiling with VS2012 and signing it with Windows_RT 8.1 it works great. Ive learned C# but for this projects i need to learn some C++. I've tried to port some github open src apps (c++ win32 based) but i always getting many errors like:
fatal error C1083: Datei (Include) kann nicht geöffnet werden(can't open): "xxxxxx.h": No such file or directory
from compiler.
Any ideas?
 

Attachments

  • 20180125_140316.jpg
    20180125_140316.jpg
    227.7 KB · Views: 228
Last edited:

Qiangong2

Senior Member
Oct 31, 2014
1,452
381
Samsung Galaxy S20
First of all, thank you for this tutorial! 'm able to complie my own programms and some of example apps from MSDN/VS examples (with .sln project files).
After compiling with VS2012 and signing it with Windows_RT 8.1 it works great. Ive learned C# but for this projects i need to learn some C++. I've tried to port some github open src apps (c++ win32 based) but i always getting many errors like:

from compiler.
Any ideas?

It's pretty self explanatory. It can't find the file. If it's there, your paths may be wrong, or you may have accidentally misspelled something.

Also, if you just create a blank project, then add the files, it won't work. Most require CMAKE to create a VS2012 sln file that configures everything.
 
  • Like
Reactions: lovicub

lovicub

Member
Aug 22, 2011
20
6
Cologne
It's pretty self explanatory. It can't find the file. If it's there, your paths may be wrong, or you may have accidentally misspelled something.

Also, if you just create a blank project, then add the files, it won't work. Most require CMAKE to create a VS2012 sln file that configures everything.

Thanks for the answer :)

I've tried to compile "The Powder Toy" and "Eventghost" from github with scons&other builders to get project fiile with no luck. I start to think that I'm noob in porting programs - spent 5 hrs on trying and get only errors :good: :silly:.
I think its easyer to code in c++ than porting.
I'm working now on programm that sends HTTP requst to auroremote app (android) for Smart Home and other actions. So when im done with that will post it here.
 

Attachments

  • sm_wRT.png
    sm_wRT.png
    12.2 KB · Views: 226

Qiangong2

Senior Member
Oct 31, 2014
1,452
381
Samsung Galaxy S20
Thanks for the answer :)

I've tried to compile "The Powder Toy" and "Eventghost" from github with scons&other builders to get project fiile with no luck. I start to think that I'm noob in porting programs - spent 5 hrs on trying and get only errors :good: :silly:.
I think its easyer to code in c++ than porting.
I'm working now on programm that sends HTTP requst to auroremote app (android) for Smart Home and other actions. So when im done with that will post it here.

Nice! We look forward to seeing your application! :) It's a lot harder to port applications that use external libraries than ones that don't. That may be one of the reasons it is hard to port those programs.
 

[DZ]Radon

New member
Aug 26, 2018
3
0
Sorry if you mind the bump, but I wanna know if this will work out with the Ultimate / Professional versions of VS 2012 since I tried it with the Express version but it gave me nothing rather than errors thought. I also tried to source any Evaluation versions but they seem to be found nowhere. Also, asking if there could be any problems if I use Windows 7 instead of Windows 8.1..
 

rtwindows

New member
Mar 31, 2019
2
0
Sorry but will this only work for c or will it work for python(thinking of porting anki looks like its only made of python)
 

OlirexGamer

New member
Oct 23, 2017
4
2
I know this is an old thread but I'd like to know if there is a way to do this with VS 2019. I was about to install VS 2012 but it would be interesting to know if there is any way to do it with VS 2019.

Thanks in advance to everyone still working for a better Windows RT experience.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 16
    Here's a basic guide on how to port, since some people were asking:

    Prerequisites:

    Windows 8 (non-RT) development machine

    Visual Studio 2012 (Don't know if express will work, but evaluation editions exist here: http://www.microsoft.com/visualstudio/eng/downloads)

    dll-to-lib tool (http://xdaforums.com/showthread.php?p=36597774)

    Part 1: Getting necessary libs:

    (1) On your Windows RT device, copy the .dll files in C:\Windows\System32 to some directory on your development machine (We'll call it C:\rtdev\dlls).

    (2) Create a directory on your development machine for the libs (we'll call it C:\rtdev\libs)

    (3) Extract the dll-to-lib to your lib directory

    (4) Open powershell (run powershell.exe) and navigate to the libs directory

    (5) run the lib script against the dlls ("./dll-to-lib.ps1 C:\rtdev\dlls).

    (6) If you've never run a powershell script before, you might get a signing error. You can type "Set-ExecutionPolicy Unrestricted" to run the script. Please be aware of the security implications if you choose to do this.

    (7) You now have a bunch of libs that tell the linker what functions are available in the DLLs on the Windows RT device. Copy the libs that you need to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\arm". DO NOT OVERWRITE ANY EXISITNG LIBS (repeat: DO NOT OVERWRITE ANY EXISITNG LIBS OR YOU MAY HAVE TO REPAIR/REINSTALL VS) You'll probably have to change the security permissions if you want to copy to this directory, or copy as an administrator.

    Part 2: Fixing the compiler.

    The compiler won't let you build desktop apps due to a configuration setting. Fortunately, some people at stack overflow figured this out:
    http://stackoverflow.com/questions/11151474/can-arm-desktop-programs-be-built-using-visual-studio-2012

    Basically, edit:
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\ARM\Microsoft.Cpp.ARM.Common.props

    to include:
    <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
    before </PropertyGroup>

    Part 3: Building a Win32 Hello World app.

    Now that we have the libs out of the way, lets build a basic hello world app.

    (1) Start Visual Studio 2012.

    (2) Create a new project, select Visual C++ (might be under other languages) and pick Win32 Project.

    (3) In the wizard, select "Console Application", and press "Finish".

    (4) Replace the program body with some text that prints hello world:

    #include "stdafx.h"
    #include <stdio.h>

    int _tmain(int argc, _TCHAR* argv[])
    {
    printf("Hello World!");
    return 0;
    }

    (5) Add the ARM configuration settings in configuration manager. Goto Build>Configuration Manager, and under "Active Solution Platform" click on Win32 and click New. Select "ARM" under "Type or select the new platform", and press "OK".

    (6) Select the "Release" configuration and build the solution (F6). With some luck, some win32 ARM binaries should appear in the ARM subdirectory of your project.

    Part 4: Porting Apps

    Now that your compiler works, you can port apps over. Most apps that have a VC++ project should port fine just by adding the ARM configuration.

    Some apps will have manually set \MACHINE:x86, in which case you will have to change that in the linker options. Also, ARM doesn't support no dynamic rebase, so if you get that error, turn of \DYNAMICBASE:NO in the linker options.

    A lot of cross-platform apps will use 'nmake' or the like. For the most part, these apps can be cross compiled using the VS 2012 ARM Cross Tools - you can find that in your start menu- In Windows 8 just type "ARM" and it should show up.

    Also some interesting issues might experience:

    You might encounter missing symbols from __imp_XXXX or the like from the linker. If it looks like a Win32 function, you just need to explicitly add the .lib (in project properties under Linker->Input->Additional Dependencies, type the name of the lib, which you need to also copy to the VC\lib\arm directory as above. Some common libs include "gdi32.lib" "shell32.lib" and "ole32.lib". You can usually find the .lib under the msdn references: for example this entry for GetUserName http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432(v=vs.85).aspx tells us we can find GetUserName in Advapi32.lib. Also the A and W suffixes just represent the ANSI and unicode version of these functions.

    When compiling big libraries like Qt, you might run into some problem about BLX fixups, since relative jumps on arm are limited (23 bits?) I guess they didn't create fixup islands in the MSVC compiler, but I found if you set \INCREMENTAL:NO, that should fix the problem most of the time. Otherwise you might have to add an \ORDER file and manually order things. See stack overflow topic for more details: http://stackoverflow.com/questions/11478055/lnk2013-error-fixup-overflow

    Another serious pitfall.. no in-line assembly support in the MS ARM compiler. So you'll have to write in your assembly in a .S file and link to it.

    ...hopefully this helps someone - happy coding!
    6
    I figured out a way to support RT desktop compilation without modifying the compiler's Microsoft.Cpp.ARM.Common.props file, which is nice if you want to distribute your changes to others.

    Set up each of your Visual Studio projects to have an ARM target as usual, then close Visual Studio. For each .vcproj file of the solution, do the following:

    1. Open the .vcproj file in Notepad or a similar text editor.
    2. Find the <PropertyGroup> tag representing the Debug ARM target. An example:
    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
    3. Inside that PropertyGroup, add this tag:
    <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
    4. Repeat for any other ARM targets you have (typically Release).

    That tag is the same as the one you can add to Microsoft.Cpp.ARM.Common.props, but without having to modify your Visual Studio installation. For the extra .lib files, you can always just put them in one of your project directories and add that directory to your library path for the project. Then no changes to Visual Studio 2012 will be required to compile your project.
    2
    A lot of cross-platform apps will use 'nmake' or the like. For the most part, these apps can be cross compiled using the VS 2012 ARM Cross Tools - you can find that in your start menu- In Windows 8 just type "ARM" and it should show up.

    I have found with some nmake projects you need to add
    Code:
    /D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
    to your CFLAGS otherwise cl complains about not being able to build desktop arm executables even with the change made to visual studio
    2
    Did you manage to run anything in 2017? Please reply even if you didn't

    You can only build with VS2012
    2
    Reposting here to keep all porting hints in the same thread.

    danesh110 found that beta version of Visual Studio 2012 (VS11) contained the ARM MFC library: http://xdaforums.com/showpost.php?p=40988765&postcount=690
    VS11 beta contains both static and DLL MFC versions, both debug and retail. You can download it here: http://download.microsoft.com/downl...-40C9-A53C-E6322E2F033D/VS11_BETA_ULT_ENU.iso, install it, for example, into virtual machine and grab files from "C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\lib\arm" folder.

    It is better to use Microsoft-made MFC than my files - as my sources contain some stubs and hacks.
    I've compared the MFC sources from VS11 beta with the retail VS2012 - they are more complete in beta. Sources contain files missing from the retail build.