Sonic and Sega Retro Message Board: HOWTO: Compile Gen/GS r7 for linux - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

HOWTO: Compile Gen/GS r7 for linux Compile Gens/GS r7 on a recent linux distro

#1 User is offline Chilly Willy 

Posted 28 February 2011 - 07:53 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Tried compiling release 7 lately? Notice all the errors? I sure did. I was trying to put together a new compile of Gens/GS r7 with my "fixes" for DMA audio on the 32X. It's AWESOME! Only if you can get past the errors...

First up! You get some kind of message about the GdkDragContext not having a targets member... huh? It's right there in the include! Well, sort of. It actually says "GdkTargetList * GSEAL (targets);"... err, what the heck is that?!?!

It turns out, you're not SUPPOSED to be using the member vars in GDK structs. I KNOW they're public, but you should be using accessor functions so that the structs can change without needing to rewrite the code. So what does GSEAL() do? It makes the public member private. Sneaky, huh?

So that function in gens_window_callbacks.cpp should be:

CODE
gboolean gens_window_drag_drop(GtkWidget *widget, GdkDragContext *context,
                   gint x, gint y, guint time, gpointer user_data)
{
    GSFT_UNUSED_PARAMETER(x);
    GSFT_UNUSED_PARAMETER(y);
    GSFT_UNUSED_PARAMETER(user_data);

    if (gtk_drag_dest_get_target_list(widget))
    {
        GdkAtom target_type = gtk_drag_dest_find_target(widget, context, gtk_drag_dest_get_target_list(widget));
        gtk_drag_get_data(widget, context, target_type, time);
        return true;
    }
    return false;
}


Okay, what's next... oh, a notice that GtkNotebookPage isn't defined. Huh? That's in the docs, right... err, SOME of them. Looking at others, it says the switch_page signal passes a widget. So in pmgr_window.cpp, search for all instances of GtkNotebookPage and replace with GtkWidget.

One more down, dozens to go! The next booboo actually is one fix for a LOT of files. All those dialog files in the gtk ui all have the same problem: "gtk_dialog_set_has_separator(GTK_DIALOG(dir_window), FALSE);" doesn't grok. So what's the official fix?

CODE
#if !GTK_CHECK_VERSION(2,21,8)
    gtk_dialog_set_has_separator(GTK_DIALOG(dir_window), FALSE);
#endif


Yeppers, that is indeed "official". There's one file with that error you might have trouble finding - "src/mdp/misc/game_genie/gg_window_gtk2.cpp" is that file if you have trouble locating it.

Once you've done all that and my changes to pwm.c for DMA PWM, you shouldn't have any trouble running my MOD player for 32X. See how easy that was? eng101.png specialed.png

What? Where are my fixes again? Try here:
http://forums.sonicretro.org/index.php?sho...mp;#entry396935

What? You can't find the mod player? It's in the techies forum. What? You don't see that forum? You're not a techy? DAMN LEECHES! argh.gif

Just kidding! You wouldn't be trying to compile Gen/GS if you weren't worthy. v.png

latest mod player

A couple mods might be a bit sluggish... I'm looking into why... they USED to be fine. Don't you just love goofing up something that was fine before. flunked.png

#2 User is offline GerbilSoft 

Posted 28 February 2011 - 08:07 PM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001
Quick and dirty option: In configure.ac, find this line and remove it:

CODE
GTK_CFLAGS="$GTK_CFLAGS -DGTK_DISABLE_DEPRECATED -DDISABLE_DEPRECATED -DGSEAL_ENABLE"

then run autoreconf.

I added this line because the GTK+ documentation recommends it. I didn't think they'd pull stupid stunts like removing functions and classes that weren't deprecated at the time. GtkNotebookPage is still used by the "switch-page" signal emitted by GtkNotebook, and that signal is *not* deprecated.

EDIT: I see they replaced the GtkNotebookPage* with GtkWidget*. Meh.

EDIT 2: I don't really want to release any more builds of Gens/GS, since I've been concentrating on Gens/GS II more, but I might consider releasing a minor update, r7.01, if it's really necessary. (I'll have to fix up my build environment, though.)
This post has been edited by GerbilSoft: 28 February 2011 - 08:12 PM

#3 User is offline Chilly Willy 

Posted 28 February 2011 - 08:46 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
I didn't think you'd want another r7 release, which is why I made this thread. I figured if people could get past the errors, they could compile it themselves. If not, they can wait for Gens/GS II. smile.png

Oh well, at least with your reconfig line above, there's only one change they need to make (the GtkNotebookPage) as well as the pwm change. Shouldn't be that tough on folks.

Anywho, Gens/GS is definitely my favorite MD/CD/32X emulator. Thanks for the work you put into it. thumbsup.png

#4 User is offline GerbilSoft 

Posted 28 February 2011 - 08:53 PM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001
Okay, and thanks. smile.png

Gens/GS II does have all the improvements from r7+, including the SH2 DMA stuff (when I port that over, at least).

Also, andlabs recently discovered a bug in the C++ VDP code that breaks a bunch of games that use the Window plane. It's fixed in the latest Gens/GS II from git. (r7 doesn't have this bug, since it has the old x86 asm VDP code.)

Speaking of which, one of the latest changes in Gens/GS II is support for reconfigurable hotkeys / menu shortcuts. This is a feature that's been requested by quite a few people, and was previously implemented in Gens Rerecording. There's currently no UI for it, but the keys are configurable in the configuration file. Sometime after the 1.0 release, I'll add support for multiple keys per action, as well as the ability to map gamepad buttons to actions (e.g. so you can map savestate/loadstate to gamepad buttons).
This post has been edited by GerbilSoft: 28 February 2011 - 09:04 PM

#5 User is offline Chilly Willy 

Posted 28 February 2011 - 10:59 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Nice! You already have some of the best controller support. I run Gens/GS off a Sony dual shock connected via a PSX to USB adapter. I really need to get a Saturn to USB adapter as that's better for Genesis emulators than the PSX controller.

I recently cloned the Gens/GS II repo and built it from scratch. Didn't have any troubles after getting the qt4 dev packages. I was a little disappointed that 32X wasn't ready yet, but it's really nice otherwise.


#6 User is offline GerbilSoft 

Posted 28 February 2011 - 11:04 PM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001
I'm not sure if controller support will be implemented in 1.0_pre1, but it will be overhauled significantly when it's implemented. I'm going to write my own native joystick input library for Windows and Linux (and later Mac), including support for joystick hotplugging. Figuring out how to enumerate controllers will be a challenge, though.

Also, I want to implement native cwiid support on Linux. smile.png
This post has been edited by GerbilSoft: 28 February 2011 - 11:06 PM

#7 User is offline Chilly Willy 

Posted 01 March 2011 - 04:43 AM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Sounds like a lot of work. smile.png

Here's my newest MOD Player for 32X binary arc. The source is in the tech forum, or can be found over at SpritesMind if someone is interested in the source. This version has all my current bug fixes and improved sound. It plays fine in the patched Gens/GS r7.

Controls: UP/DOWN = next/prev MOD, RIGHT/LEFT = raise/lower volume, START = pause/resume

ModTest32X-20110228.7z
This post has been edited by Chilly Willy: 01 March 2011 - 04:47 AM

#8 User is offline Andlabs 

Posted 04 June 2012 - 12:56 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
Testing something super important and I needed patch codes so I had to rebuild this with some edits...

After doing what GerbilSoft suggested, you will need to run this:
autoreconf || { automake -a; autoreconf; }
or at least I did (though I'm still on Ubuntu 11.04...) so automake can produce a configure file (-a adds missing files). Probably not worth posting about but I got stumped before realizing I needed autoreconf :/
This post has been edited by Andlabs: 04 June 2012 - 01:02 AM

#9 User is offline Chilly Willy 

Posted 19 September 2012 - 02:30 AM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Well, I was working out the kinks for interrupt driven DMA PWM and ran into more issues with gtk... deprecated functions went bye-bye under Ubuntu 12.04 (due to using the latest glib2). Some combo box functions had to be changed. After I could get it to compile again, I was finally ready to get DMA interrupts for the PWM working... the only DMA interrupts in the current r7 code are for internal DMA, like memory to memory operations. External ops using DREQ don't have any interrupt capability. The fix was pretty easy - just change this in pwm.c

        if (PWM_Mode & 0x0080)
        {
            // RPT => generate DREQ1 as well as INT
            SH2_DMA1_Request(&M_SH2, 1);
            SH2_DMA1_Request(&S_SH2, 1);
        }



to this

        if (PWM_Mode & 0x0080)
        {
            // RPT => generate DREQ1 as well as INT
            SH2_DMA1_Request(&M_SH2, 1);
            SH2_DMA1_Request(&S_SH2, 1);

            if ((SH2_Read_Long(&S_SH2, 0xFFFFFF9C) & 7) == 7)
                SH2_Interrupt_Internal(&S_SH2, (SH2_Read_Long(&S_SH2, 0xFFFFFFA8)<<8) | ((SH2_Read_Word(&S_SH2, 0xFFFFFEE2) >> 8) & 0x000F));
        }



Technically, there should be another for the master SH2 as well, but I only use the slave for sound, so I don't really care. I'm the only person using the features anyway. :eng101:

You would THINK that you could just access the context variables directly... instead of SH2_Read_Long(&S_SH2, 0xFFFFFF9C) just use S_SH2.CHCR1, right? Right?!?! WRONG!!!!!! You cannot access the context variables directly or the whole thing goes wonky. Bizarre, but that's the deal. It took me ALL F—KING DAY to figure out you can't access the context directly. :specialed:

What that does is check the CHCR1 register right after the DREQ1 - if IE is set AND TE is set AND DE is set (7), we know we need to do an end of transfer interrupt. The int level is from IPRA bits 12-8 and the vector is from DMA1VCR.

Once you add those lines, interrupt driven DMA PWM works great!

#10 User is offline Andlabs 

Posted 01 October 2012 - 09:07 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
64-bit compiles on multiarch compiles (figured out by me and GerbilSoft), or what I had to do:

$ # I am using Linux Mint but these should also work for other Debian-likes like Ubuntu
$ sudo apt-get install \
>     g++-multilib libgtk2.0-0:i386 libgtkmm-2.4-1c2a:i386 ia32-libs
$ # then, from a fresh git clone
$ acme configure.ac # remove the GTK+ deprecated features thing GerbilSoft mentioned above
$ autoreconf -I



The only downside is that libjack-dev, libjack0, and portaudio19-dev have to be removed because they're not multi-arch compatible (PortAudio being the main thing: it hates new JACK), meaning no Gens/GS II until GerbilSoft either includes PortAudio directly into the source or drops PortAudio entirely.


Now configure is failing on detecting GTK+:

configure:17221: checking for GTK+ - version >= 2.4.0
configure:17331: gcc -o conftest -m32 -std=gnu99 -L/usr/lib/i386-linux-gnu/ -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12    -m32 -L/usr/lib/i386-linux-gnu/ conftest.c -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0    >&5
/usr/bin/ld: cannot find -lgtk-x11-2.0
/usr/bin/ld: cannot find -lgdk-x11-2.0
/usr/bin/ld: cannot find -latk-1.0
/usr/bin/ld: cannot find -lgio-2.0
/usr/bin/ld: cannot find -lpangoft2-1.0
/usr/bin/ld: cannot find -lpangocairo-1.0
/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/ld: cannot find -lcairo
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lfreetype
/usr/bin/ld: cannot find -lfontconfig
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lglib-2.0
collect2: ld returned 1 exit status
configure:17331: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gens"
| #define PACKAGE_TARNAME "gens"
| #define PACKAGE_VERSION "2.16.7"
| #define PACKAGE_STRING "gens 2.16.7"
The configure line I used last time:
$ CFLAGS="-m32 -std=gnu99 -L/usr/lib/i386-linux-gnu/" CXXFLAGS="-m32 -L/usr/lib/i386-linux-gnu/" LDFLAGS="-m32 -L/usr/lib/i386-linux-gnu/"  ./configure —build=i686-pc-linux-gnu —host=i686-pc-linux-gnu —target=i686-pc-linux-gnu
along with various combinations of values in CFLAGS and LDFLAGS. Does anyone have a clue? The libraries are definitely in /usr/lib/i386-linux-gnu/. Thanks.

#11 User is offline Chilly Willy 

Posted 02 October 2012 - 12:57 AM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
I'm using 32-bit Xubuntu 12.04, and it had no trouble with configure. What I ran into were old deprecated glib calls in the UI that needed to be changed. One thing to remember, glib uses two different paths for the libraries now, so if you're passing the library paths yourself instead of getting the glib package flags/paths, you need both paths or some of the associated libraries won't be found. In my case, doing make distclean before configure cleared that problem as configure gets the glib flags/paths when building all the makefiles the first time. So if you haven't done a make distclean in a while, try that.

#12 User is offline Andlabs 

Posted 03 October 2012 - 10:28 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
Since I am compiling from freshly downloaded sources, I don't have a Makefile to distclean from.

I got a bit farther; this appears to be the appropriate configure line:

./configure —build=x86_64-linux-gnu —host=i686-pc-linux


libtool in make, however, does not seem to care:

/bin/bash ../../../../../libtool   —tag=disable-shared  —mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../../.. -I../../../../../src/   -I../../../../../src/  -MT libmdp_render_1x_la-mdp_render_1x_16_x86.lo -MD -MP -MF .deps/libmdp_render_1x_la-mdp_render_1x_16_x86.Tpo -c -o libmdp_render_1x_la-mdp_render_1x_16_x86.lo 'test -f 'mdp_render_1x_16_x86.S' || echo './'`mdp_render_1x_16_x86.S
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../../.. -I../../../../../src/ -I../../../../../src/ -MT libmdp_render_1x_la-mdp_render_1x_16_x86.lo -MD -MP -MF .deps/libmdp_render_1x_la-mdp_render_1x_16_x86.Tpo -c mdp_render_1x_16_x86.S -o libmdp_render_1x_la-mdp_render_1x_16_x86.o
mdp_render_1x_16_x86.S: Assembler messages:
mdp_render_1x_16_x86.S:47: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:51: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:52: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:53: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:54: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:55: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:93: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:94: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:95: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:96: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:97: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:101: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:118: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:122: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:123: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:124: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:125: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:126: Error: invalid instruction suffix for 'push'
mdp_render_1x_16_x86.S:176: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:177: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:178: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:179: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:180: Error: invalid instruction suffix for 'pop'
mdp_render_1x_16_x86.S:184: Error: invalid instruction suffix for 'pop'
make[6]: *** [libmdp_render_1x_la-mdp_render_1x_16_x86.lo] Error 1
make[6]: Leaving directory `/home/pietro/gens/src/gens/plugins/render/normal'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/pietro/gens/src/gens/plugins/render'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/pietro/gens/src/gens/plugins'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/pietro/gens/src/gens'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/pietro/gens/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/pietro/gens'
make: *** [all] Error 2


Now what?

#13 User is offline Chilly Willy 

Posted 03 October 2012 - 02:19 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Build on a 64-bit machine? :specialed:

Seriously, I've never been able to cross-build between 32 and 64 bit x86 for ANYTHING. If I want 64 bit, I have to build on 64 bit, and vice versa.

#14 User is offline Andlabs 

Posted 20 October 2012 - 08:08 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
http://www.dusers.dr...D:/configure.ac
How do I edit this to have GTK+ done via pkg-config instead of manually? Some discussion in #autotools leads me to this as a possible solution to GTK+-related issues with other configure lines. Thanks.

#15 User is offline Chilly Willy 

Posted 21 October 2012 - 08:31 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X

View PostAndlabs, on 20 October 2012 - 08:08 PM, said:

http://www.dusers.dr...D:/configure.ac
How do I edit this to have GTK+ done via pkg-config instead of manually? Some discussion in #autotools leads me to this as a possible solution to GTK+-related issues with other configure lines. Thanks.


It SHOULD be doing it already. As I mentioned, all I had to do for the change in glib was to "make disctclean", then "./configure" to get the proper library includes.

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users