neufena
Posts: 24
Joined: Wed Apr 11, 2012 7:04 pm

Error compiling AdvanceMame

Sun Jul 01, 2012 10:55 am

Hi,

Has anyone managed to compile AdvanceMAME in Raspbian? The pre compiled binaries at http://blog.sheasilverman.com/?tag=advancemame don't work so I'm having a go at compiling my own.

The error I get is:

obj/mame/linux/blend/cpu/sh2/sh2.o
src/cpu/sh2/sh2.c: In function ‘sh2_get_info’:
src/cpu/sh2/sh2.c:3217:1: error: unrecognizable insn:
(insn 2034 2033 2035 183 (set (subreg:SI (reg:DI 362 [ sh2.irq_line_state ]) 0)
(sign_extend:SI (mem/s/j/c:QI (plus:SI (reg/f:SI 361)
(const_int 260 [0x104])) [0 sh2.irq_line_state+0 S1 A32]))) src/cpu/sh2/sh2.c:3111 -1
(nil))
src/cpu/sh2/sh2.c:3217:1: internal compiler error: in extract_insn, at recog.c:2109
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccDYL8Al.out file, please attach this to your bugreport.
make: *** [obj/mame/linux/blend/cpu/sh2/sh2.o] Error 1

Thanks,

plugwash
Forum Moderator
Forum Moderator
Posts: 3599
Joined: Wed Dec 28, 2011 11:45 pm

Re: Error compiling AdvanceMame

Sun Jul 01, 2012 12:32 pm

I've seen this issue a couple of times while building packages for the raspbian repo. So-far my workaround has been to build those packages with gcc/g++ 4.7 rather than 4.6 (which is the default compiler in raspbian).

Most build systems will respect the CC and CXX environment variables so instaling the gcc-4.7 and g++-4.7 packages and then doing

export CC=gcc-4.7
export CXX=g++-4.7

Should make the build use gcc/g++ 4.7, some build processes however require more work to beat into submission.

asigner
Posts: 1
Joined: Tue Jul 31, 2012 10:38 pm

Re: Error compiling AdvanceMame

Tue Jul 31, 2012 10:42 pm

the SH2 and SH4 emulators seem to be too big to be compiled on the raspberry. either cross-compile on a more powerful machine, or remove support for SH2 and SH4:

cd <mame-root>
vi src/emu/cpu/cpu.mak

search for "CPUS += SH2" and "CPUS += SH4" and comment out those lines.

plugwash
Forum Moderator
Forum Moderator
Posts: 3599
Joined: Wed Dec 28, 2011 11:45 pm

Re: Error compiling AdvanceMame

Wed Aug 01, 2012 12:45 am

asigner wrote:the SH2 and SH4 emulators seem to be too big to be compiled on the raspberry. either cross-compile on a more powerful machine, or remove support for SH2 and SH4:
On what do you base that claim? the error in the original post doesn't look like resource exhaustion to me.

nelz
Posts: 1
Joined: Thu Aug 02, 2012 8:14 am

Re: Error compiling AdvanceMame

Thu Aug 02, 2012 8:16 am

A quick post to confirm that the suggestion posted by plugwash does indeed fix this problem.

mistaSteve
Posts: 3
Joined: Fri Jul 13, 2012 8:40 pm

Re: Error compiling AdvanceMame

Wed Sep 12, 2012 3:31 am

I've been having the worst time trying to compile AdvanceMame. Even the suggestion here made gcc-4.7 blow chunks:

when it got to: hq4x.o
gcc-4.7: internal compiler error: Killed (program ccl)
Please submit a full bug report,
this for advancemame-0.106.0

I'm doing this on wheezy, the image over in downloads. I've tried a couple of options and versions, no luck.

plugwash
Forum Moderator
Forum Moderator
Posts: 3599
Joined: Wed Dec 28, 2011 11:45 pm

Re: Error compiling AdvanceMame

Wed Sep 12, 2012 10:24 am

gcc-4.7: internal compiler error: Killed (program ccl)
In my experiance that error means you ran out of memory. Add more swap.

Judder
Posts: 3
Joined: Thu Sep 13, 2012 10:13 am

Re: Error compiling AdvanceMame

Thu Sep 13, 2012 10:18 am

The error is to do with the GCC optimisations not liking the code on ARM for some reason.

I found details of a similar error here - http://gcc.gnu.org/ml/gcc-bugs/1999-10n/msg00075.html - compiling on an ARM platform Netwinder.

To fix the error in my build, I removed the optimisation settings from the Makefile as follows:

Original:

CONF_CFLAGS_OPT= -O2 -fomit-frame-pointer -fno-merge-constants -Wall -Wno-sign-compare -Wno-unused

Modified:

CONF_CFLAGS_OPT= -fomit-frame-pointer -fno-merge-constants -Wall -Wno-sign-compare -Wno-unused

If you are still having problems you can just comment out the whole optimisation line with a # and then if will definitely compile.

Here's the output from my build for reference, and now to work out what it needs to get the video to initialise :D

Code: Select all

root@raspberrypi:/home/pi/downloads/advancemame-0.106.1# advcfg
Unable to initialize the video driver. The errors are:
fb: Works only with TERM=linux terminals.

Ensure to use the 'device_video_output auto' option.
Ensure to have a Frame Buffer driver (other than VESA) in your Linux kernel.
Try to run this program in a TERM=linux terminal.

Judder
Posts: 3
Joined: Thu Sep 13, 2012 10:13 am

Re: Error compiling AdvanceMame

Fri Sep 14, 2012 10:37 am

They say a picture is worth a thousand words, so here is a picture of Defender running at full speed on my Raspberry Pi using HDMI and complete documentation of how to do the same with your Raspberry Pi

http://www.thedefenderproject.com/?p=126

Image

plugwash
Forum Moderator
Forum Moderator
Posts: 3599
Joined: Wed Dec 28, 2011 11:45 pm

Re: Error compiling AdvanceMame

Fri Sep 14, 2012 3:00 pm

Judder wrote:The error is to do with the GCC optimisations not liking the code on ARM for some reason.
There are two different errors under discussion here.

The "unrecognised INSN" error does indeed seem to be an optimiser related problem and in every case i've seen has been avoided by using gcc 4.7 instead of gcc 4.6. It's also in my experiance avoided by disabling optimisation but I tend to consider that as a last resort to be used only if there is no other soloution available.

The "killed" error is in my experiance nearly always a case of running out of memory and having the OOM killer in the linux kernel step in and kill the compiler. This is fixed by adding more swap. It may also be fixed by disabling optimisation (since optimisation increases the memory requirements of the compiler) but I tend to consider that as a last resort to be used only if there is no other soloution available.

mistaSteve
Posts: 3
Joined: Fri Jul 13, 2012 8:40 pm

Re: Error compiling AdvanceMame

Sat Sep 15, 2012 3:41 pm

plugwash wrote:
gcc-4.7: internal compiler error: Killed (program ccl)
In my experiance that error means you ran out of memory. Add more swap.
Yes, that was the problem. I had a couple other things running so I think there was not enough memory for the build to work. Once I took care of the memory scarcity, it worked!

Thanks very much for your help.

Steve

fbis251
Posts: 1
Joined: Fri Sep 21, 2012 3:10 am

Re: Error compiling AdvanceMame

Sat Sep 29, 2012 4:22 am

For those of you who want to cross compile AdvanceMAME under ubuntu (I tested with 12.04) you can do:

Code: Select all

# Install the cross compiler
sudo apt-get install gcc-arm-linux-gnueabihf

# Download the AdvanceMAME sources from the following page:
# http://advancemame.sourceforge.net/download.html

mkdir ~/advmame
cd ~/advmame
tar xzvf /path/to/advancemame-0.106.1.tar.gz
cd advancemame-0.106.1
./configure --host=arm-linux-gnueabihf
# The -j8 flag will use 8 threads for me. I have hyper-threading enabled on my core i7 (quad core + 2 threads per core = 8 threads, adjust to your system as needed)
make -j8

# Now you can sit around and wait
You'll get the proper binaries afterwards:

Code: Select all

file obj/mame/linux/blend/advmame
obj/mame/linux/blend/advmame: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0xe8caf6425e3596ef8438aa44e61f49f0ef00de16, stripped
I haven't tested them on my raspi but I can post a link to the tarball. I'm currently uploading it to my dropbox.

Nyebodnye
Posts: 1
Joined: Sun Oct 07, 2012 8:39 pm

Re: Error compiling AdvanceMame

Sun Oct 07, 2012 8:44 pm

Currently cross-compiling using Cygwin on Windows 7. Huge thanks to previous comments about errors etc. Will post back when it either completes (or doesn't).

Return to “Raspberry Pi OS”