FORUMS
Remove All Ads from XDA

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

276 posts
Thanks Meter: 102
 
By no2chem, Senior Member on 13th January 2013, 04:51 AM
Post Reply Email Thread
3rd February 2013, 10:18 AM |#31  
Member
Thanks Meter: 49
 
More
Hi, I'm trying to recompile ScummVM for Windows RT and everything seems to go well, after changing solution platform and configuration building goes well, but at 99% there is an error:

Code:
Error	2	error MSB6006: "cmd.exe" exited with code 9009.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets	172	5	scummvm
Could anyone help?

EDIT: Possibly I found source of a problem:

Code:
31>------ Rebuild All started: Project: scummvm, Configuration: Release ARM ------
31>  Performing Custom Build Tools
31>  'nasm.exe' is not recognized as an internal or external command,
31>  operable program or batch file.
31>  Performing Custom Build Tools
31>  'nasm.exe' is not recognized as an internal or external command,
31>  operable program or batch file.
31>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5): error MSB6006: "cmd.exe" exited with code 9009.
========== Rebuild All: 30 succeeded, 1 failed, 0 skipped ==========
From ScummVM dev wiki:

"Additional tools

You will need to download and install nasm which is used for assembler versions of our scalers."

Must find a way to cut it from source.

EDIT: Ok, there were 2 scalers written in ASM, I deleted those so nasm is no longer needed, also scummvm make use of libmad - MPEG audio decoder library which has some inline assembly so I was forced to get rid of it. Still there are 6 errors I can't resolve:

Code:
31>C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h(1182): warning C4005: 'ARRAYSIZE' : macro redefinition
31>          ..\..\common/util.h(58) : see previous definition of 'ARRAYSIZE'
31>D:\Programy\VS2011\VC\include\setjmp.h(122): warning C4005: 'setjmp' : macro redefinition
31>          ..\..\common/forbidden.h(189) : see previous definition of 'setjmp'
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C2146: syntax error : missing ';' before identifier 'SYMBOL'
31>D:\Programy\VS2011\VC\include\setjmp.h(175): warning C4229: anachronism used : modifiers on data are ignored
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C2182: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : illegal use of type 'void'
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C2495: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : '__declspec(noreturn)' can only be applied to function declarations or definitions
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C2143: syntax error : missing ';' before '!'
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
31>D:\Programy\VS2011\VC\include\setjmp.h(175): error C2059: syntax error : '%'
 
 
3rd February 2013, 02:38 PM |#32  
Senior Member
Thanks Meter: 58
 
More
Quote:
Originally Posted by bartekxyz

Hi, I'm trying to recompile ScummVM for Windows RT

'FORBIDDEN_look_at_common_forbidden_h_for_more_inf o'

Have you looked at common_forbidden.h for more info?

These errors usually happen when some header file has ifdef blocks for x86 and x64 and an a final else block that errors. When you compile for arm, you hit that else block. You'll need to figure out the "right" way to do whatever they're doing for arm.

setjump/longjump usually do crap with the pc and stack pointers, so it will be cpu specific. google for arm setjmp.h to get some ideas of what you'll have to do to make it work for arm...
3rd February 2013, 03:27 PM |#33  
Recognized Developer
Flag Seattle
Thanks Meter: 2,918
 
More
Also, unless those assembly files were merely optional optimizations for C/C++ code that you can use instead, simply "removing" chunks of assembly is likely to break things. You havne't gotten to the linker, yet; it may conlain of missing program entry points when you do unless you have substitutes for those assembly functions.
3rd February 2013, 09:22 PM |#34  
Member
Thanks Meter: 49
 
More
Quote:
Originally Posted by GoodDayToDie

Also, unless those assembly files were merely optional optimizations for C/C++ code that you can use instead, simply "removing" chunks of assembly is likely to break things. You havne't gotten to the linker, yet; it may conlain of missing program entry points when you do unless you have substitutes for those assembly functions.

Those assembly lines were used by two scalers. Also there is nice tool in scummvm source that you can use to customize project, example:

Code:
C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10>create_project.exe ..\.. --ms
vc --disable-nasm --disable-mad --disable-freetype
Enabled engines:

    SCUMM
    v7 & v8 games
    HE71+ games
    AGI
    AGOS
    AGOS 2 games
    CGE
    Cinematique evo 1
    Magic Composer
    Cinematique evo 2
    Dragon History
    Drascula: The Vampire Strikes Back
    Dreamweb
    Gobli*ns
    Groovie
    Hugo Trilogy
    Legend of Kyrandia
    Lands of Lore
    Lure of the Temptress
    MADE
    Mohawk
    Parallaction
    Flight of the Amazon Queen
    SAGA
    IHNM
    SCI
    Beneath a Steel Sky
    Broken Sword
    Broken Sword II
    Teen Agent
    Tinsel
    Toonstruck
    Touche: The Adventures of the Fifth Musketeer
    TsAGE
    Bud Tucker in Double Trouble

Disabled engines:

    Groovie 2 games
    Eye of the Beholder
    The Last Express
    Where in Time is Carmen Sandiego?
    Riven: The Sequel to Myst
    Myst
    SAGA 2 games
    SCI32 games
    Broken Sword 2.5
    TestBed: the Testing framework
    3 Skulls of the Toltecs

Enabled features:

    zlib (compression) support
    Ogg Vorbis support
    FLAC support
    libpng support
    Theora decoding support
    Bink video support
    Scalers
    HQ scalers
    16bit color support
    integrated MT-32 emulator
    Taskbar integration support
    Translation support
    System language detection support

Disabled features:

    libmad (MP3) support
    FreeType support
    IA-32 assembly support
    OpenGL support
    Virtual keyboard support
    Keymapper support

C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10>
Still, those setjmp errors, specifically in line:

Code:
_CRTIMP __declspec(noreturn) void __cdecl longjmp(_In_ jmp_buf _Buf, _In_ int _Value) throw(...);
It's beyond me so I'm forced to give up.
3rd February 2013, 11:46 PM |#35  
Member
Flag Portland, OR
Thanks Meter: 32
 
More
Quote:
Originally Posted by bartekxyz

scummvm make use of libmad - MPEG audio decoder library which has some inline assembly so I was forced to get rid of it.

libmad builds fine - it just needs to be built with /D FPM_DEFAULT or /D FPM_64BIT instead of any other potential option. scummvm probably has a config.h for libmad that has:

#define FPM_INTEL

in it (or similar in the C/C++ macro list in VS), which causes x86 assembler to be used in the fixed-point routines.
4th February 2013, 09:29 AM |#36  
Member
Thanks Meter: 49
 
More
Quote:
Originally Posted by irony_delerium

libmad builds fine - it just needs to be built with /D FPM_DEFAULT or /D FPM_64BIT instead of any other potential option. scummvm probably has a config.h for libmad that has:

#define FPM_INTEL

in it (or similar in the C/C++ macro list in VS), which causes x86 assembler to be used in the fixed-point routines.


Good to know. BTW, setjmp errors are gone - adding "#define FORBIDDEN_SYMBOL_ALLOW_ALL" at the beginning of backends/saves/windows/windows-saves.cpp solved this problem. Still I was expecting it to be easier job so don't know if I will handle this.

EDIT: Building went ok, now there are errors during code generation. Could anybody look at this?:

Code:
Error	11	error LNK1169: one or more multiply defined symbols found	C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10\Release32\scummvm.exe	1	1	scummvm
Error	9	error LNK2005: "private: __cdecl type_info::type_info(class type_info const &)" (??0type_info@@AAA@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)	C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10\MSVCRT.lib(ti_inst.obj)	scummvm
Error	10	error LNK2005: "private: class type_info & __cdecl type_info::operator=(class type_info const &)" (??4type_info@@AAAAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)	C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10\MSVCRT.lib(ti_inst.obj)	scummvm
Error	8	error LNK2005: free already defined in LIBCMT.lib(free.obj)	C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10\MSVCRT.lib(MSVCR110.dll)	scummvm
Error	7	error LNK2005: malloc already defined in LIBCMT.lib(malloc.obj)	C:\Users\Bartek\Desktop\scummvm-1.5.0\dists\msvc10\MSVCRT.lib(MSVCR110.dll)	scummvm
EDIT2: Already figured it out. So the very first Windows RT build of ScummVM is ready, much still have to be done but that's some start.

http://forum.xda-developers.com/show...&postcount=402
10th February 2013, 05:54 AM |#37  
Retired Recognized Developer
Thanks Meter: 221
 
Donate to Me
More
There is no MFC library for ARM in Visual Studio, though DLL is present on the device.
We can't use dll2lib to create our own import library from mfc110u.dll as it exports only ordinals, but I was managed to recompile MFC from sources as a static library. As MS provided incomplete sources - some features are not present, for example using OLE controls and MFC controls embedded in dialogs designed in visual studio dialog editor. Creating those controls dynamically would work fine.
More information is here.
LIB sizes are huge (157 Mb debug and 1.2 Gb release builds) as I have not stripped the debug information. Don't be afraid of that - the produced EXE files would be small.
You can recompile MFC yourself like I did, or download LIBs here: http://www.multiupload.nl/FJEYPW5M26
Compressed with 7Zip as it gave the smallest archive size.

For installation - uncompress them into: "\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\lib\arm\" directory, add "#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS" to your stdafx.h and select "use MFC in static library" in your project settings.
16th February 2013, 04:30 AM |#38  
OP Senior Member
Thanks Meter: 102
 
More
Quote:
Originally Posted by mamaich

There is no MFC library for ARM in Visual Studio, though DLL is present on the device.
We can't use dll2lib to create our own import library from mfc110u.dll as it exports only ordinals, but I was managed to recompile MFC from sources as a static library. As MS provided incomplete sources - some features are not present, for example using OLE controls and MFC controls embedded in dialogs designed in visual studio dialog editor. Creating those controls dynamically would work fine.
More information is here.
LIB sizes are huge (157 Mb debug and 1.2 Gb release builds) as I have not stripped the debug information. Don't be afraid of that - the produced EXE files would be small.
You can recompile MFC yourself like I did, or download LIBs here: http://www.multiupload.nl/FJEYPW5M26
Compressed with 7Zip as it gave the smallest archive size.

For installation - uncompress them into: "\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\lib\arm\" directory, add "#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS" to your stdafx.h and select "use MFC in static library" in your project settings.

Good idea mamaich, I haven't had much time lately, but I was able to get a mfc .def with most of the named ordinals by using libtool and dumpbin with the .pdb in the directory. If dumpbin detects a .pdb file, it uses the pdb hints to generate the .def. Microsoft SymServer has the pdb for arm.

The problem I had is with the mfc static part, maybe you could figure that out and we'll have MFC
16th February 2013, 08:07 AM |#39  
Retired Recognized Developer
Thanks Meter: 221
 
Donate to Me
More
Quote:
Originally Posted by no2chem

The problem I had is with the mfc static part, maybe you could figure that out and we'll have MFC

Unfortunately I don't have time for that - spending all time on the emulator project.
But it should not be too difficult. After looking at static x86 part - you can see the needed files:
Code:
rawdllmainproxy.obj
stdafx.obj
nolib.obj
appmodul.obj
dumpstak.obj
oleexp.obj
sockexp.obj
dllmodul.obj
dllmodulx.obj
All files except for the last one are present. You need to reconstruct the last one manually looking at the dumpbin output. Or maybe we could ask in microsoft forums for this file?
24th February 2013, 01:13 AM |#40  
Recognized Developer
Flag Seattle
Thanks Meter: 2,918
 
More
Ugh... working on porting Free Download Manager, and it's demanding MFC and ATL, and in particular nafxcw.lib. I don't know MFC very well at all; not sure what it would take to get that file but without it I'm not able to port the program. I've gotten almost all the components ported, but the actual EXE is MFC based.
24th February 2013, 03:50 AM |#41  
Senior Member
Flag NY, Long Island
Thanks Meter: 10
 
More
Good luck to everyone making some awesome ports. I hope to feature some of these awesome ports on the website I write for once they're ready
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes