What's new? | Help | Directory | Sign in
Google
gosu
Cross-platform 2D game development library
  
  
  
  
    
Search
for
Updated Apr 17, 2008 by julianraschke
GettingStartedOnLinux  
How to set up Gosu on Linux.

Dependencies

To compile Gosu, you will need the following packages (install via sudo apt-get install <packagename>):

If you want to use FMOD for audio, fmod 3.75 must be installed system-wide or manually unpacked so that the fmod... folder is in the same folder as the Gosu, GosuImpl and linux folders. Otherwise, SDL_mixer needs to be present (package libsdl-mixer1.2-dev).

Copy-and-pastable command line for Ubuntu 7.10 (Gutsy Gibbon), with SDL-mixer as the audio library and without Ruby support:

sudo apt-get install g++ autoconf libgl1-mesa-dev libglu1-mesa-dev libglut3-dev libpango1.0-dev libboost-dev libxxf86vm-dev libsdl-mixer1.2-dev

Ruby/Gosu will be built if the following packages are installed as well:

Copy-and-pastable command line for Ubuntu 7.10 (Gutsy Gibbon), with SDL-mixer as the audio library and Ruby support:

sudo apt-get install g++ autoconf libgl1-mesa-dev libglu1-mesa-dev libglut3-dev libpango1.0-dev libboost-dev libxxf86vm-dev ruby ruby1.8 ruby1.8-dev swig libsdl-mixer1.2-dev

Compiling Gosu

To compile Gosu for Unix, go into the linux directory and execute:

autoconf
./configure
make

Using Ruby/Gosu

Just require gosu.so (require 'gosu') and everything should work fine. You can copy gosu.so into the examples folder and run Tutorial.rb to check everything's okay.

Using C++ Gosu

Copy or link Gosu into your application's directory. You've got to compile with `gosu/linux/gosu-config --libs` and -Igosu `gosu/linux/gosu-config --cxxflags`

A simple Makefile could look like this:

OBJS = main.o player.o
CXXFLAGS += -Igosu/ `gosu/linux/gosu-config --cxxflags`
LIBS = `gosu/linux/gosu-config --libs`

myGame: $(OBJS) gosu/linux/gosu.a
        g++ -o myGame $(OBJS) gosu/linux/gosu.a $(LIBS)

Comment by seancribbs, Aug 16, 2007

Might want to add that you need to copy gosu.so to your ruby installation's lib directory in order to use Gosu in ruby. This could alternatively be added to the Makefile with the install target.

Comment by rcbaxter, Nov 21, 2007

The make error above is a result of compiling Gosu on Ubuntu Feisty. To fix the error I added #include <boost/none.hpp> to the LargeImageData?.hpp file and recompiled with make. More details can be found at http://crunchlife.com/articles/2007/11/20/compiling-the-gosu-game-development-library-on-ubuntu-feisty

Comment by julianraschke, Nov 25, 2007

Thanks, I fixed and committed this. I'll leave the rather unhandy error message as it is for now though, because there may still be Ubuntu users looking for just this :) Thanks!

Comment by jeremias.kangas, Dec 11, 2007

Doesn't seem to work with ruby1.9. Reports about missing ruby.h.

Running Ubuntu Gutsy.

Comment by julianraschke, Dec 11, 2007

Hi, weird, I see nothing specific to Ruby 1.8 in the configure/makefile. Is ruby1.9-dev installed? Can you find ruby.h via locate?

Comment by jeremias.kangas, Dec 23, 2007

julianraschke: ruby.h was found with locate and ruby1.9-dev was installed, but gosu build process couldn't find it or something

Comment by jordan.applewhite, Jan 05, 2008

Hi! I'm wondering if a Fedora user can help me. I'm trying to get Gosu to compile on an XO laptop.

When I try to ./configure, i get "lib/cpp fails sanity check" but I have gcc, g++ installed and they are in $PATH. What else could I try?

Thanks!

Comment by jordan.applewhite, Jan 06, 2008

ah, I needed glibc-headers...

Comment by julianraschke, Jan 20, 2008

jeremias.kangas: I hope you are still reading this -- Gosu should now work with Ruby 1.9 on Linux. Check out the latest source from SVN and let me know how it works for you! :)

Comment by oli.obk, Jan 24, 2008

I'm using qmake for just about everything, but I needed some time to get gosu working with qmake. Here's how you do it:

you need the folder structure: gosu_tutorial/src/Tutorial.cpp << from the gosu examples dir

gosu_tutorial/media << from the gosu examples dir

gosu_tutorial/gosu_tutorial.pro << create with contents below

TEMPLATE = app
DEPENDPATH += . include src 
INCLUDEPATH += . include 
INCPATH += $$system(../gosu/gosu-read-only/linux/gosu-config --cxxflags) 
LIBS += ../gosu/gosu-read-only/linux/gosu-config --libs -lgosu 
SOURCES += src/Tutorial.cpp 
HEADERS += 
CONFIG += qt debug_and_release warn_on

CONFIG(debug, debug|release) {

    DESTDIR = debug 

} else {

    DESTDIR = release 

}

now you run "qmake" in that dir

then "make"

then "debug/gosu_tutorial" (or if you used "make release" use "release/gosu_tutorial")

I'll create a windows tutorial for that as soon as I successfully compiled everything on windows

Comment by skawaii, Feb 21, 2008

Hey, guys. I'm trying to get gosu installed on Fedora 8. When compiling, I'm getting an error (/usr/bin/ld: cannot find -lboost_thread). Seems it can't find libboost_thread. But when I locate libboost_th, I get

/usr/lib/libboost_thread-mt.so
/usr/lib/libboost_thread-mt.so.1.34.1
/usr/lib/libboost_thread-mt.so.3

Any suggestions? Am I missing a library? I can't seem to find any other boost libraries to install, so I'm really not sure.

Comment by julianraschke, Feb 22, 2008

Well, the -mt suffix means a boost library is compiled with multithread support, which is kind of redundant for Boost Threads. I don't know why some distributions omit this and Fedora doesn't, but if you can just replace -lboost_thread by -lboost_thread-mt, that should fix it :) Not sure how to add a check for this case to the AutoConf? file right now… :(

Comment by skawaii, Feb 22, 2008

Thanks, Julian. That fixed it.

For anyone else installing gosu in Fedora 8 (maybe earlier version, as well), I'll just recap the fix.

Run autoconf and ./configure as normal, but before running make, open up the Makefile and change the two libboost_thread references from -lboost_thread to -lboost_thread-mt. Then run make to compile.

AFter compiling you need to move <gosu_direcotry>/linux/gosu.so to /usr/lib/ruby/site_ruby/1.8/i386-linux/ (assuming you took the default options when install ruby).

Comment by julianraschke, Apr 17, 2008

(Note regarding the above comments: The threading has been taken out in 0.7.9 and will come back in 0.8.x, so these libraries aren't relevant or needed right now.)

Comment by dasgib, Apr 30, 2008

How can I compile Gosu on a x64 system (Ubuntu)? make stops with an error:

/usr/bin/ld: Math.o: relocation R_X86_64_32 against `__gxx_personality_v0' can not be used when making a shared object; recompile with -fPIC
Math.o: could not read symbols: Bad value
Comment by oli.obk, May 27, 2008

about the ruby.h missing: if you got ruby1.9 installed, you need ruby1.9-dev since gosu will automatically try to use ruby1.9 (the above apt-get line will only install 1.8 and 1.8-dev which will be ignored)

Comment by leoboiko, Jul 12, 2008
Comment by leoboiko, Jul 12, 2008

also: like seancribbs said, it would be nice if "make install" actually installed gosu.so in the ruby lib dir…

Comment by julianraschke, Jul 12, 2008

Using the right paths causes so much trouble that I've actually removed the 'make install' command for now. Maybe it'll come back, but I'd much prefer a binary Linux gem anyway. Of course, it'd be even cooler if the Rakefile could somehow cross-compile all common Linux architectures at once.

Comment by bhoult, Jul 16, 2008

For Ubuntu 8.04 (Hardy Heron) Install package "libasound2-plugins" Run "asoundconf set-pulseaudio"


Sign in to add a comment