Compiling ScummVM for Windows RT(ARM)

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Compiling ScummVM for Windows RT(ARM)

Post by bartekxyz »

Hi, as you might know, Windows RT allows only Windows Store apps to be used, desktop environment is locked. But with recent jailbreak tool people can run unsigned exe files in desktop. So I tried recompiling ScummVM in VS11 for ARM and building goes well but at 99% there is an error:

Code: Select all

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
Here is output:

Code: Select all

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 ==========
It looks like nasm is source of a problem. And there is my question: Can it be turned off? Nasm is x86 tool, my target platform is ARM.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Run the create_project tool with the parameter --disable-nasm. Check its help (via. --help) for more info.
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

md5 wrote:Run the create_project tool with the parameter --disable-nasm. Check its help (via. --help) for more info.
Did it other way - cutting few lines in source. But still there are six errors during building scummvm solution(game engines build just fine). Those errors are:

Code: Select all

Error	8	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	6	error C2495: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : '__declspec(noreturn)' can only be applied to function declarations or definitions	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	5	error C2182: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : illegal use of type 'void'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	3	error C2146: syntax error : missing ';' before identifier 'SYMBOL'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	7	error C2143: syntax error : missing ';' before '!'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	9	error C2059: syntax error : '%'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Possibly not related to scummvmm source.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

I'm not sure what kind of modifications you did to the source. As for setjmp, perhaps it's used in LUA in the sword25 engine? Try excluding the sword2 engine from compilation, via --disable-sword25
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

bartekxyz wrote:
md5 wrote:Run the create_project tool with the parameter --disable-nasm. Check its help (via. --help) for more info.
Did it other way - cutting few lines in source. But still there are six errors during building scummvm solution(game engines build just fine). Those errors are:

Code: Select all

Error	8	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	6	error C2495: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : '__declspec(noreturn)' can only be applied to function declarations or definitions	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	5	error C2182: 'FORBIDDEN_look_at_common_forbidden_h_for_more_info' : illegal use of type 'void'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	3	error C2146: syntax error : missing ';' before identifier 'SYMBOL'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	7	error C2143: syntax error : missing ';' before '!'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Error	9	error C2059: syntax error : '%'	D:\Programy\VS2011\VC\include\setjmp.h	175	1	scummvm
Possibly not related to scummvmm source.
That error message is not really helpful, since it doesn't reveal from which file inside ScummVM setjmp.h is included. So a more detailed log would be helpful here.

About nasm: I think the problem is that you probably created the ARM configuration out of the x86 configuration. It has special custom build tool setups for NASM. One option would be to disable nasm via the command line option md5 proposed. Another option would be to use the amd64 (or x64 as it's called in MSVC) configuration as a base for your ARM configuration. An even better option would be to add support to create_project to create an ARM configuration. Removing code isn't really a solution, if you want to get this upstream.
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

Ok, I used create_project.exe to disable nasm, libmad(there is no way to use this library in Windows RT yet as it contains inline assembly - x86 one). I have also disabled sword25 engine but still there are the same setjmp errors. And there is line in setjmp.h which contains all six errors:

Code: Select all

_CRTIMP __declspec(noreturn) void __cdecl longjmp(_In_ jmp_buf _Buf, _In_ int _Value) throw(...);
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

bartekxyz wrote:Ok, I used create_project.exe to disable nasm, libmad(there is no way to use this library in Windows RT yet as it contains inline assembly - x86 one). I have also disabled sword25 engine but still there are the same setjmp errors.
Disabling Sword25 probably did not disable the offending code inside the shared ScummVM code. But I would say the chances that would happen have been pretty low anyway.

libmad should work fine on ARM systems. You will probably need to fiddle with the MSVC project configuration of libmad too.
bartekxyz wrote:And there is line in setjmp.h which contains all six errors:

Code: Select all

_CRTIMP __declspec(noreturn) void __cdecl longjmp(_In_ jmp_buf _Buf, _In_ int _Value) throw(...);
Yes, that's expected to happen when you include setjmp.h after common/scummsys.h is included. The question here is: Which file of ScummVM is being compiled when you get that error?
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

LordHoto wrote: Yes, that's expected to happen when you include setjmp.h after common/scummsys.h is included. The question here is: Which file of ScummVM is being compiled when you get that error?
Here is a whole build output so you can see where exactly it fails:

http://pastebin.com/3ApDV1p2
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

bartekxyz wrote:
LordHoto wrote: Yes, that's expected to happen when you include setjmp.h after common/scummsys.h is included. The question here is: Which file of ScummVM is being compiled when you get that error?
Here is a whole build output so you can see where exactly it fails:

http://pastebin.com/3ApDV1p2
You'll probably need to add a

Code: Select all

#define FORBIDDEN_SYMBOL_ALLOW_ALL
before

Code: Select all

#include "common/scummsys.h"
EDIT: Just in case it isn't clear in which file, it should be: backends/saves/windows/windows-saves.cpp
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

Building went ok, but there are still errors during code generation:

Code: Select all

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
Any ideas?

EDIT: Already figured it out
Last edited by bartekxyz on Mon Feb 04, 2013 5:40 pm, edited 1 time in total.
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

bartekxyz wrote:Building went ok, but there are still errors during code generation:

Code: Select all

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
Any ideas?
That could be related to different runtime library setups used when compiling the libraries/ScummVM.
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

LordHoto wrote:
bartekxyz wrote:Building went ok, but there are still errors during code generation:

Code: Select all

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
Any ideas?
That could be related to different runtime library setups used when compiling the libraries/ScummVM.
I just had to tell linker to ignore default MSVCRT.lib, so first Windows RT ScummVM version is built. Now I need to force disabled dependencies to work
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Does that binary work? Cause ignoring MSVCRT might lead to undesirable results...
bartekxyz
Posts: 15
Joined: Tue May 05, 2009 8:28 pm
Contact:

Post by bartekxyz »

md5 wrote:Does that binary work? Cause ignoring MSVCRT might lead to undesirable results...
Yes, it works, I'm playing The Curse Of Monkey Island on my Surface RT right now.

Image
grunger106
Posts: 7
Joined: Sat Jan 12, 2013 8:42 am

Post by grunger106 »

Cool! Great work!
When this gets polished up any chance it will be submitted to the store?
I know you can run unsigned code at the moment, but this may change.....
Emulators are allowed, snes8x and the Atari 7800 ones are there already.
Post Reply