Guide: Compiling ResidualVM on Windows

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

Moderator: ScummVM Team

User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Guide: Compiling ResidualVM on Windows

Post by JohnnyWalker2001 »

Ok, thanks to KuroShiro, here's a complete guide to compiling ResidualVM on Windows.

Install GIT
Git is a version control system and you can download it here:
http://git-scm.com/

When you install it, make sure you choose the option that adds to PATH. After that choose the recommended options for Windows.

Get ResidualVM's source code from GitHub
Once you have GIT installed with a PATH set up correctly, go to the command prompt, navigate to the PARENT directory you'd like your "ResidualVM" directory to be in and type:

git clone https://github.com/residualvm/residualvm.git

It should then download the latest source into the current directory.

In future, to update the sources to the latest version, you can type:

git pull

Install MingW
This is a necessary step. Download and install MingW from:
http://www.mingw.org/

(It's a bit confusing: Go to "Downloads" and then look for the .exe link near "Looking for the latest version?")

Choose:
C++
and
MingW Developer Tookit (including MSYS)

Next is probably the most confusing part... Open up the command prompt in Windows and type 'path'. Make sure that all the MinGW directories are there. It should contain (assuming you installed to C:\MinGW)

';C:\MinGW\bin;C:\MinGW\libexec\gcc\mingw32\4.5.2;C:\MinGW\msys\1.0\bin'

at the end. Those should have been added by the install program, but if not, you'll have to add them manually. To do this, go to Computer -> System properties -> Advanced System Settings (it's on the left). Then click on the Environment Variable button, and in the bottom dialog box scroll down until you see the PATH variable, and double click it. Then add the directories listed above, making sure to have a semi colon before all the directory names.

You now have the ResidualVM source and a compiler, but you need libraries before you can compile and make a ResidualVM.exe.

Install SDL Development Libraries
Download the SDL Libraries from here:
http://www.libsdl.org/release/SDL-devel ... w32.tar.gz

Extract the files to a directory on your computer, then move the contents of the following folders to their respective MingW folders:

include\ to c:\MingW\include\
lib\ to c:\MingW\lib\
bin\ to c:\MingW\bin\

Install zlib
Despite what the ResidualVM site says, you apparently need zlib installed, too. This is another fiddly step, but not too difficult.

Download zlib from:
http://www.zlib.net/

(You want the source code, not the DLL.)

Copy the contents of the zlib source archive to a temporary folder, e.g. "c:\zlib".

Now open up MSYS. This is done by going to MingW Shell in your START menu. A window should open that looks very much like the normal command prompt.

Type the following:

cd /c/zlib
make -f win32/makefile.gcc

After the code has compiled type:

cp -p libz.a /c/mingw/lib
cp -p zlib.h zconf.h /c/mingw/include

Done!

(Here's a guide to the basic commands of MSYS, if you're confused: https://users.cs.jmu.edu/bernstdh/Web/c ... /index.php)

Compile ResidualVM
You need to go into MingW Shell (aka MSYS) again.

Simply navigate to your ResidualVM directory in the MingW Shell (see the above guide if you need help on that) and type:

./configure && make

At the end of the process you should have a (rather large) ResidualVM.exe in your ResidualVM folder. You've just compiled ResidualVM!

To strip out all the unnecessary debug gubbins and make a smaller, more efficient executable, type:

strip residual.exe

And you're done!
Last edited by nuphonic on Tue Aug 16, 2011 12:54 pm, edited 4 times in total.
KuroShiro
Posts: 473
Joined: Thu May 15, 2008 7:42 am
Location: Somewhere Out There

Post by KuroShiro »

Well, I can give you a simple guide to how I do it. First, get the source from the git repository. You can do this using the git program and a command line ('git clone https://github.com/residualvm/residualvm.git', or just 'git pull' if you've already cloned the repository), or some other repo checker.

Next, you'll need a compiler. I use MinGW with msys -- you can get it here. Make sure you choose to install the C++ compiler and the msys dtk. I suggest installing into C:\MinGW.

Next is probably the most confusing part... open up the command line in windows by typing cmd.exe in the run menu, and then type 'path'. Make sure that all the MinGW directories are there. It should contain (assuming you installed to C:\MinGW) ';C:\MinGW\bin;C:\MinGW\libexec\gcc\mingw32\4.5.2;C:\MinGW\msys\1.0\bin' at the end. Those should have been added by the install program, but if not, you'll have to add them manually. To do this, go to Computer->System properties->Advanced System Settings (it's to the left). Then click on the Environment Variable button, and in the bottom dialog box scroll down until you see the PATH variable, and double click it. Then add the directories listed above, making sure to have a semi colon before all the directory names.

Phew, ok, once it's installed, you will need to install the SDL development libraries. Copy the contents of the /bin and /include directories in the .tar.gz file (you can extract it with 7zip) into the corresponding directories wherever you installed MinGW. Other than that, there's a few more optional libraries you can install (such as ogg, flac, and mp3 support, zlib for compressing save games, etc). For info on that, you can check the guide on the ScummVM Wiki which talks about installing other optional libraries.

Once you're ready, just type './configure && make' and ResidualVM will compile. Afterwards you might want to also use 'strip ./residual.exe' to decrease the size of the .exe file.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

Hey, thanks so much for this. I'm compiling it through Netbeans, but I don't think that should make any difference. I've got to the point where I need to type "./configure && make"... Where do I type this?
User avatar
somaen
ScummVM Developer
Posts: 376
Joined: Thu Apr 21, 2011 7:31 pm
Location: Trondheim, NO

Post by somaen »

Well, afaik, Netbeans is a complete IDE, so you'd have to add the necessary files there and set up the project yourself, unless Netbeans is one of the ones that include MingW, in which case, I don't know.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

Well even if I follow KuroShiro's instructions to the letter, where do I type "./configure && make"?
KuroShiro
Posts: 473
Joined: Thu May 15, 2008 7:42 am
Location: Somewhere Out There

Post by KuroShiro »

JohnnyWalker2001 wrote:Well even if I follow KuroShiro's instructions to the letter, where do I type "./configure && make"?
Those are basically Linux commands. I guess I did sort of miss one step -- if you follow exactly what I said, after installing all the programs, you have to run the msys program (it is a command line shell, similar to Linux), navigate to the directory where you have the source code, and then type that. That scummvm wiki page I linked has a bunch of info about using msys. I have no idea about Netbeans.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

I might be worth noting that .configure is saying that zlib library support is required?
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

Written a complete guide, and put it in the first post.
VaultDweller
Posts: 1
Joined: Mon Jan 23, 2012 1:50 pm

Compiling error: zero-size array

Post by VaultDweller »

Everything went swimmingly until I tried to compile ResidualVM. It hit a snag here:

Code: Select all

C++ audio/audiostream.o
audio/audiostream.cpp:64:1: error: zero-size array 'Audio::STREAM_FILEFORMATS'
make: *** [audio/audiostream.o] Error 1
I'm installing on Win 7 Ultimate SP1 64bit.

Any suggestions?
User avatar
somaen
ScummVM Developer
Posts: 376
Joined: Thu Apr 21, 2011 7:31 pm
Location: Trondheim, NO

Post by somaen »

A few notes, zlib isn't required, but you won't get videos without it, and it has to have the proper defines done for that (which configure does, and create_project SHOULD do). If this is not the case, do tell how it doesnt work, so we can try to fix it. (although, large parts of the game are videos, so you wouldn't really want to build without zlib anyhow.)

Currently we have a dependency on MAD, which might explain the above post, this dependency is only an error, as yes, mad is required for audio in EMI, but not for anything in GRIM, FLAC and OGG are not used for anything IIRC.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

As I say, I couldn't get it to work without zlib, which is why I put it in my guide. I wish I could remember why, however. Sorry! :(
User avatar
somaen
ScummVM Developer
Posts: 376
Joined: Thu Apr 21, 2011 7:31 pm
Location: Trondheim, NO

Post by somaen »

could you try a recompile with ./configure --disable-zlib?
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

Hmm.

error: unrecognised option: --disable-zlib
User avatar
somaen
ScummVM Developer
Posts: 376
Joined: Thu Apr 21, 2011 7:31 pm
Location: Trondheim, NO

Post by somaen »

Is it listed when you try:
./configure --help
hooby3dfx
Posts: 16
Joined: Tue Dec 31, 2013 6:01 am

Re: Guide: Compiling ResidualVM on Windows

Post by hooby3dfx »

2015 update!

I am attempting to build in Windows and want to document my progress thus far.

Have run in to a ton of issues during first attempt. Here's what I did (definitely a lot of mistakes):

1. Started with this MinGW install: http://nuwen.net/mingw.html
That includes a few of the libs and so it looked like it would save time in the long run. Also appears to be up to date instead of http://www.mingw.org/
Extracted to C:\MinGW

2. I then also grabbed the MSYS package as well (http://nuwen.net/files/mingw/msys-10.4.7z)
Extracted to C:\MSYS then ran extract.bat

3. The above MinGW distro included SDL 2 but this project uses SDL 1.2, so I followed other steps to get this version and extract to MinGW dir:
https://www.libsdl.org/release/SDL-deve ... w32.tar.gz

4. WEIRD STUFF
-If you just run MSYS it won't know about MinGW paths, I followed the fstab hint here: http://www.mingw.org/wiki/Getting_Started
-Even then, ./configure wasn't finding libjpeg, zlib, etc. I realized that MSYS needs to have additional paths set, so first either do set_distro_paths.bat or run msys.bat from open_distro_window.bat.
-./configure was spitting out some sed errors on sdl-config (see http://www.cplusplus.com/forum/general/77110/). I followed the advice there and by deleting/renaming C:\MinGW\bin\sed.exe that issue went away (wtf).
-At this point compilation got started but I am now getting this:

Code: Select all

    C++      backends/taskbar/win32/win32-taskbar.o
backends/taskbar/win32/win32-taskbar.cpp: In member function 'virtual void Win32
TaskbarManager::addRecent(const Common::String&, const Common::String&)':
backends/taskbar/win32/win32-taskbar.cpp:312:21: error: 'SHARD_LINK' was not dec
lared in this scope
   SHAddToRecentDocs(SHARD_LINK, link);
                     ^
Makefile.common:105: recipe for target 'backends/taskbar/win32/win32-taskbar.o'
failed
make: *** [backends/taskbar/win32/win32-taskbar.o] Error 1
...and calling it a night. Any ideas?
E: possible hints: http://www.enderboi.com/log.php?log=scu ... ormat=html
E2: aaand solution: --disable-taskbar option in configure!

5. This updated MinGW has 64 bit support, so I needed to copy bin/include/lib from http://sourceforge.net/projects/mingw-w ... z/download to C:\MinGW\x86_64-w64-mingw32
...and then at run-time you will also need to 64 bit dll: https://www.libsdl.org/release/SDL-1.2.15-win32-x64.zip

6. SUCCESS!!
Post Reply