The purpose of this post is to help any newbies out there (like myself) who would like to develop vb games/roms on Linux but don’t want to have to deal with M$ Windows. I’ve messed around for a few days and have been able to compile a demo through Linux only apps and get it run on an actual Virtual Boy. Perhaps there is a post somewhere already explaining this but I couldn’t find it. So here is a step by step on how to get to at least a good starting point for developing VB Games on Linux.
Again the purpose here is to not have to use M$ Windows for any reason so I’m obviously excluding the options of setting up dual boot or running virtual machines. Also I’m running Ubuntu (Debian based) although I believe this should work on any flavor of Linux.
I was unsuccessful in compiling the source for gccVB 2.95. I tried to fight through the errors but not being a C programmer they were beyond my limited nowledge of C so I tried something else.
1st. Download / Install all necessary software.
Install WINE (windows emulator) (open source and not technically windows)
From a command prompt:
sudo apt-get install wine
After wine installs (providing you used all default options) you should have a .wine folder under your home directory. Inside that folder should be a folder called drive_c
Make a new folder called gccVB in drive_c
From a command prompt:
mkdir ~/.wine/drive_c/gccVB
From the planet virtual boy site download gccVB ver 1.0 http://www.planetvb.com/content/downloads/tools/gccvb.zip
save the gccvb.zip file in ~/.wine/drive_c/gccVB/
unzip the file.
From a command prompt:
cd ~/.wine/drive_c/gccVB/
unzip gccvb.zip
From the planet virtual boy site download gccVB ver 2.95 (Source)
http://www.planetvb.com/content/downloads/tools/vb_v810_gcc_03.tar.gz
Make a temp directory somewhere and move the vb_v810_gcc_03.tar.gz file into that temp directory
cd to the temp directory
untar the file
From a command prompt:
tar zxvf vb_v810_gcc_03.tar.gz
We need two files from here to get roms to work on an actual virtual boy.
Inside your temp directory should be a folder called vb_810
cd into that folder
Copy the files to our gccVB ver 1.0 installation
From the command promt:
cp crt0.s ~/.wine/drive_c/gccVB/lib/src/
cp vb.ld ~/.wine/drive_c/gccVB/lib/
Now we need to compile the crt0.s so cd to the directory we just moved it too.
From a command prompt:
cd ~/.wine/drive_c/gccVB/lib/src/
wine cmd
make
exit
Now our goal is to compile the example that came with gccVB so with your favorite editor we’ll need to make some changes to some of the files since there seem to be syntax errors right from the get go.
From a command prompt:
cd ~/.wine/drive_c/gccVB/examples/hello3/
nano hello3.c
inside int main…
uncomment the line that looks like
// vbSetColTable();
at the end of the source file are two macros called OBJ_YSET and OBJ_PSET.
Change these to OBJ_SET_Y and OBJ_SET_P
save your changes
now cd into the include folder
From a command prompt:
cd ~/.wine/drive_c/gccVB/include/vb/
nano object.h
The following macros are missing semicolons that need added Before the “} while(0)” in each case.
OBJ_SET_X
OBJ_SET_Y
OBJ_SET_P
OBJ_SET_PAL
save your changes.
Providing I didn’t forget any steps you should now be ready to compile your first vb rom that will run on a real virtual boy using Linux without the need of M$.
From a command prompt:
cd ~/.wine/drive_c/gccVB/examples/hello3/
wine cmd
c:\gccVB\bin\make c:\gccVB\examples\hello3\ hello3
If you don’t receive any messages then the source should have compiled and you should have a new .vb file. Again this is a starting point to get you going with Linux. From this point on you can customize until your hearts content.
You should also be able to run the rom inside of reality boy using wine as well.
From a command prompt:
cd ~/.wine/drive_c/gccVB/examples/hello3/
wine (directory of reality boy exe)/reality_boy.exe hello3.vb
Far be it from me to question your methods—especially given that you’ve made working ROMs—but if you’re going to go to the trouble of using WINE to run a win32 compiler, why not at least use the VBDE, which includes a more modern GCC and the latest crt0, linker script, and libgccvb headers?
Have you tried compiling GCC 4.x with the VB patches applied? I think it’s been done under OSX, so it should work fine under Ubuntu. Here’s a relevant post that should get you on the right track, at least:
http://www.planetvb.com/modules/newbb/viewtopic.php?post_id=13509#forumpost13509
I’m almost certain I used that very tarball (the non-OSX 4.4.2 one, that is) to build the Win32 version of GCC included in the VBDE (under MinGW). The only thing that might be newer is the crt0 and/or linker script. The one I have was last updated by dasi, but I don’t know if it’s the same one included in the VBDE package.
I hope that helps you streamline your VB dev. environment.
I’ll probably give that a try here next week. My first post here was simply to share my last couple days of trial and error and give a starting point for the other 3 or 4 people who use Linux exclusively and wander on to this site :). Also, since I don’t have a lot of time to read through all the posts I didn’t actually know about the VBDE. I saw it mentioned but didn’t see it under the tools section of this site so I actually just thought it was a typo for VIDE. (Can you tell I’m still wet behind the ears with this whole VB Dev thing). I’ll use your links and see if I can get it running on Linux.
Thanks.
It’s alive!!
I thought I’d weigh in on this thread for posterity’s sake.
First off, Greg’s instructions worked pretty well for getting gccVB 1.0 working in a Linux environment using Wine. One adjustment I had to make was to take out comments around the vector definitions in crt0.s. At first I didn’t have make.exe so I downloaded that and then the “make” direction worked perfectly.
RunnerPack’s suggestion about VBDE is I think another good option for LiGNUx users. The major obstacle I’ve encountered so far is that the compile feature in notepad++ does not seem to work. That said, using the command line to manually invoke the utilities seemed to work. With a sufficient makefile, the VBDE utilities should work just as good as using gccVB 1.0. My problem is I’m fairly clueless editing makefiles so maybe Runner has some good advice for this. I liked the gccVB 1.0 method of having one global makefile that works for multiple projects.
Here’s some extra advice to help streamline the development process for us Linux users. Most of my tips are for the VBDE set up created by KR155E, but everything that follows should work for gccvb 1.0 as well.
The absolute MUST for compiling in Linux is using the compilers through Wine. Until we can compile gccvb in Linux, using the precompiled binaries of gccVB will be the way to go. So, once you get VBDE/gcc 1.0 downloaded and unpacked on your computer, there are a few things you can do to make compiling easier. Since the notepad++ way of compiling seems broken in Wine/Linux, compilation has to be done the old fashioned way. There are a few things to do which will make this MUCH more manageable: the PATH variable and Make.
Assuming your VBDE is unpacked and sitting somewhere in the virtual C drive wine uses. This can be tricky as the /.wine folder is hidden in your home directory. You can unhide it in the Nautilus file manager with ctrl+H or just append /.wine to your home directory path. From there you should see “drive_c”, aka C:. Unpack the VBDE stuff anywhere in C:. Now get to a terminal and enter DOS mode: $ wine cmd.exe. Locate and note the location of the folder in the VBDE directory with v810-gcc, v810-objcopy, etc… Then, in cmd.exe, type “regedit”.
The registry edit (regedit) window should pop open. We need to navigate through the folders shown in the left panel to find our path variable. Here’s a breakdown of where to find the path variable:
HKEY_LOCAL_MACHINE -> System -> CurrentControlSet -> Control -> Session Manager -> Seeions Manager -> Environment, You should see the PATH variable in the middle of the right pane.
Use this website as a reference to find the path variable if the above is confusing:
http://wiki.winehq.org/UsefulRegistryKeys
Now modify the path variable to look something like this; “C:\windows\system32;C:\windows;C:\VBDE\gccvb\bin;C:\VBDE\emus\rboy;C:\VBDE\gccvb\make-3.81-bin\bin”
Notice I also stuck in the path for the Reality Boy emulator and Make. Now close the regedit window and then type “Exit” back in the terminal to leave wine (the regedit update doesn’t seem to take immediate effect). From here on you should be able to just type in the name of the program you want to use (v810-gcc, v810-objcopy) without specifying horrific pathnames either for the program or the source file.
If you don’t want to bother with the last step that is fine, creating a good makefile is really what will save you headaches. But first you’ll need to find a decent makefile from a demo project to build on. Go download some homebrew titles with source and browse the makefiles to get a sense of what kinds of commands and invokations creates playable .vb files from the .c and .h files. Here’s a quick reference of what steps have worked for me:
wine cmd.exe
cd ..\.wine\drive_c\VBDE\projects\YOUR_PROJECT
v810-gcc -x c -o main.o main.c
v810-objcopy -O binar main.o main.vb
v810-padder main.vb 20 main.vbh
There are, of course, a billion different errors that could arise during any of those steps but that is the basic outline. If you edit your PATH variable in Wine, then that should simplify what types of commands to place in your makefile. I’m in no way an expert of this build process of the right way to do things; I can only say what has worked for me so far in getting source to playable .vb. If you look through several makefiles you are bound to see extra options passed to the three programs above. What I listed above was the absolute minimum I used to get something to run in Reality Boy. Maybe someone in the know can chime in with other important options that may make or break your code. But with a little practice and a little patience, demos should start compiling for you with minimal source file edits. Good luck!