forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trying to compile SNES9x for PS2...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
bootsector_



Joined: 25 Feb 2008
Posts: 15

PostPosted: Fri Mar 07, 2008 5:30 am    Post subject: Trying to compile SNES9x for PS2... Reply with quote

Hi folks!

I'm trying to compile SNES9x 1.51 using PS2 toolchain (please, see the WIP Makefile I'm using at the end of this post), and I'm getting the following internal compiler error:

Code:
ee-g++ -D_EE -O2 -G0 -Wall -D_EE -O2 -G0 -Wall -DCPU_SHUTDOWN -DSPC700_SHUTDOWN -DNO_INLINE_SET_GET -DNOASM -DNEW_COLOUR_BLENDING -DZLIB -DRIGHTSHIFT_int8_IS_SAR -DRIGHTSHIFT_int16_IS_SAR -DRIGHTSHIFT_int32_IS_SAR -DRIGHTSHIFT_int64_IS_SAR -DRIGHTSHIFT_IS_SAR -DNOSOUND    -DSPC700_C  -DUNZIP_SUPPORT -DJMA_SUPPORT     -DSDD1_DECOMP -DCORRECT_VRAM_READS    -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/ps2sdk/sbv/include -I/usr/local/ps2dev/ps2sdk/ports/include -I/usr/local/ps2dev/gsKit/include -I. -I./unzip -c soundux.cpp -o soundux.o
soundux.cpp: In function `void S9xSetSoundFrequency(int, int)':
soundux.cpp:734: insn does not satisfy its constraints:
(insn 155 37 157 (set (reg:DI 2 v0)
        (ashiftrt:DI (reg:DI 66 accum)
            (const_int 32 [0x20]))) 216 {ashrdi3_internal4} (nil)
    (nil))
soundux.cpp:734: Internal compiler error in reload_cse_simplify_operands, at
   reload1.c:8338
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make: *** [soundux.o] Error 1


I'm new to GNU C++, so I have no idea about this error message (besides the fact that scared me a lot :P).

If I remove soundux.o from the objects list inside Makefile (and make some corrections [comments] inside file /usr/local/ps2dev/ee/include/c++/3.2.2/cstdio) I got to compile all objects, but it fails when linking (undefined reference).

I tried this in cygwin and MinGW. So what do y ou guys think? Forget about trying to bring a new SNES emulator for PS2? C++ for PS2 won't support its compilation process?

Here is the Makefile I'm using (it's pretty hacky, it's a WIP Makefile :P):

Code:



EE_BIN = SNES9X.ELF

#ZSNESFX=1
#ZSNESC4=1

#NETPLAY=1
UNZIP=1
JMA=1
#GLIDE=1
#OPENGL=1
#AIDO=1
#GUI=0
#THREAD_SOUND=1
#ASMKREED=1
SDD1_DECOMP=1
CORRECT_VRAM_READS=1
#DREAMCAST=1
CHEATS=1
2XSAI=0

ifdef ZSNESFX
FXOBJ=$(CPU)/fxemu2b.o $(CPU)/fxemu2.o $(CPU)/fxemu2c.o $(CPU)/fxtable.o $(CPU)/sfxproc.o $(CPU)/ZSNES.O
FXDEFINES=-DZSNES_FX -DEXECUTE_SUPERFX_PER_LINE
FXDEPENDS=zsnes_fx
FXNO_DEPENDS=c_fx
else
FXOBJ=fxinst.o fxemu.o fxdbg.o
FXDEFINES=
FXDEPENDS=c_fx
FXNO_DEPENDS=zsnes_fx
endif

ifdef ZSNESC4
C4OBJ=$(CPU)/C4.O $(CPU)/zsnesc4.o c4.o
C4DEFINES=-DZSNES_C4
C4DEPENDS=zsnes_c4
C4NO_DEPENDS=c_c4
else
C4OBJ=c4.o c4emu.o
C4DEFINES=
C4DEPENDS=c_c4
C4NO_DEPENDS=zsnes_c4
endif

SOUNDOBJ=spc700.o apu.o soundux.o
SOUNDDEFINES=-DSPC700_C

ifdef ASMCPU
CPUOBJ=$(CPU)/cpuops.o $(CPU)/cpuexec.o $(CPU)/sa1ops.o
else
CPUOBJ=cpuops.o cpuexec.o sa1cpu.o
endif


ifdef CHEATS
CHEATOBJ=cheats.o cheats2.o
endif

ifdef 2XSAI
ifdef ASMKREED
KREEDOBJ=$(CPU)/2XSAIMMX.O $(CPU)/bilinear.o 2xsai.o
KREEDDEFINES=-DMMX
else
KREEDOBJ=2xsai.o
endif
endif

ifdef SDD1_DECOMP
SDD1OBJ=sdd1emu.o
ifdef SDD1_VERIFY
SDD1DEFINES=-DSDD1_DECOMP -DSDD1_VERIFY
else
SDD1DEFINES=-DSDD1_DECOMP
endif
endif

ifdef CORRECT_VRAM_READS
CORRVRAMDEFINES=-DCORRECT_VRAM_READS
endif

SPC7110OBJ=spc7110.o
OBC1OBJ=obc1.o
SETAOBJ=seta.o seta010.o seta011.o seta018.o

EE_OBJS=$(CPUOBJ) $(SOUNDOBJ) apudebug.o $(FXOBJ) $(C4OBJ) \
   crosshairs.o  controls.o cpu.o sa1.o debug.o sdd1.o tile.o srtc.o gfx.o \
   memmap.o clip.o dsp1.o ppu.o dma.o snes9x.o data.o globals.o reader.o \
   conffile.o bsx.o logger.o \
   $(SPC7110OBJ) $(OBC1OBJ) $(SETAOBJ) $(KREEDOBJ) $(SDD1OBJ) \
   $(CHEATOBJ) $(PLATFORMOBJ) $(SNAPOBJ) $(SCREENSHOTOBJ) $(MOVIEOBJ)

ifdef UNZIP
OBJECTS += loadzip.o unzip/unzip.o unzip/explode.o unzip/unreduce.o unzip/unshrink.o
UNZIPDEFINES=-DUNZIP_SUPPORT
endif

ifdef JMA
OBJECTS += jma/s9x-jma.o jma/7zlzma.o jma/crc32.o jma/iiostrm.o jma/inbyte.o jma/jma.o jma/lzma.o jma/lzmadec.o jma/winout.o
JMADEFINES = -DJMA_SUPPORT
endif

ifdef THREAD_SOUND
CPUDEFINES += -DUSE_THREADS
EXTRALIBS += -lpthread
endif

ifdef GLIDE
GLIDEOBJS = unix/glide.o
GLIDEDEFINES = -DUSE_GLIDE -I/usr/include/glide
GLIDELIBS = -lglide2x
endif

ifdef OPENGL
OPENGLOBJS = unix/opengl.o
OPENGLDEFINES = -DUSE_OPENGL
OPENGLLIBS = -lGL -lGLU -ldl
endif

ifdef AIDO
AIDOOBJS = unix/aido.o
AIDODEFINES = -DUSE_AIDO
endif

JOYDEFINES =

#ifdef DREAMCAST
#CCC = sh-elf-c++ -fno-rtti
#CC = sh-elf-gcc
#NASM = fail
#GASM = fail
#else
#CCC = $(EE_CXX)  #g++  -fno-rtti
#CC = $(EE_CC)    #gcc
#NASM = not_found
#GASM = $(EE_CXX) #g++
#endif

##INCLUDES = -I../zlib -INONE
#ifdef DREAMCAST
#INCLUDES = -Idc
#DEFS = -DDC
#else
#INCLUDES = $(EE_INCS) #-INONE
##DEFS = #-DMITSHM
#endif

#INCLUDES += -I. -Iunzip

#ifdef DREAMCAST
#OPTIMISE=-O4 -ffreestanding -ffast-math -fschedule-insns2 -fomit-frame-pointer -fno-inline-functions -fno-defer-pop -fforce-addr -fstrict-aliasing -funroll-loops -fdelete-null-pointer-checks -fno-exceptions
#CPUFLAGS=-ml  -m4-single-only
#else
#OPTIMISE =  -D_EE -O2 -G0 -Wall $(EE_CFLAGS) #-O2 -fomit-frame-pointer -fno-exceptions -Wall -W -pedantic -Wno-unused-parameter -pipe
#endif


EE_CFLAGS += \
-DCPU_SHUTDOWN \
-DSPC700_SHUTDOWN \
-DNO_INLINE_SET_GET -DNOASM -DNEW_COLOUR_BLENDING -DZLIB -DRIGHTSHIFT_int8_IS_SAR -DRIGHTSHIFT_int16_IS_SAR -DRIGHTSHIFT_int32_IS_SAR -DRIGHTSHIFT_int64_IS_SAR -DRIGHTSHIFT_IS_SAR -DNOSOUND \
$(FXDEFINES) \
$(C4DEFINES) \
$(CPUDEFINES) \
$(SOUNDDEFINES) \
$(NETPLAYDEFINES) \
$(UNZIPDEFINES) \
$(JMADEFINES) \
$(GLIDEDEFINES) \
$(OPENGLDEFINES) \
$(AIDODEFINES) \
$(KREEDDEFINES) \
$(SDD1DEFINES) \
$(CORRVRAMDEFINES)   

#EE_CFLAGS += $(DEFS)
#EE_CXXFLAGS += $(EE_CFLAGS)
EE_CXXFLAGS += $(EE_CFLAGS)
EE_INCS = -I$(PS2SDK)/sbv/include -I$(PS2SDK)/ports/include -I$(PS2DEV)/gsKit/include -I. -I./unzip
EE_LDFLAGS = -L$(PS2DEV)/gskit/lib -L$(PS2DEV)/ps2sdk/ports/lib -s
EE_LIBS = -lgskit -ldmakit -ljpg -lpng -lz -lm -lfileXio -lhdd -lmc -lpadx -laudsrv -lpoweroff -lpatches -ldebug -lcdvdfs

#.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm .obj .O .CPP .C .ASM

#ifdef ASMCPU
#OFFSET=offsets
#else
#OFFSET=
#endif
#
#offsets: offsets.o
#   $(CCC) $(INCLUDES) -o $@ offsets.o
#   ./offsets >$(CPU)/offsets.h


#snes9x: $(OBJECTS) #$(AIDOOBJS) $(OFFSET)
#   $(CCC) $(INCLUDES) -o $@ $(OBJECTS) #$(AIDOOBJS) $(GLIDEOBJS) $(OPENGLOBJS) $(LDLIBS) $(GLIDELIBS) $(OPENGLLIBS)

all: $(EE_BIN)
   ee-strip $(EE_BIN)

#jma/s9x-jma.o: jma/s9x-jma.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/7zlzma.o: jma/7zlzma.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/crc32.o: jma/crc32.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/iiostrm.o: jma/iiostrm.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/inbyte.o: jma/inbyte.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/jma.o: jma/jma.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/lzma.o: jma/lzma.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/lzmadec.o: jma/lzmadec.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#jma/winout.o: jma/winout.cpp
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
#
#.cpp.o:
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) $*.cpp -o $@
#
#.c.o:
#   $(CC) $(INCLUDES) -c $(CCFLAGS) $*.c -o $@
#
#.cpp.S:
#   $(GASM) $(INCLUDES) -S $(CCFLAGS) $*.cpp -o $@
#
#.cpp.i:
#   $(GASM) $(INCLUDES) -E $(CCFLAGS) $*.cpp -o $@
#
#.S.o:
#   $(GASM) $(INCLUDES) -c $(CCFLAGS) $*.S -o $@
#
#.S.i:
#   $(GASM) $(INCLUDES) -c -E $(CCFLAGS) $*.S -o $@
#
#.s.o:
#   @echo Compiling $*.s
#   sh-elf-as -little $*.s -o $@
#
#.asm.o:
#   $(NASM) -f elf -DELF $(FXDEFINES) -i. -ii386 -o $@ $*.asm
#
#.obj.o:
#   cp $*.obj $*.o
#
#.CPP.O:
#   $(CCC) $(INCLUDES) -c $(CCFLAGS) -x c++ $*.CPP -o $@
#
#.C.O:
#   $(CC) $(INCLUDES) -c $(CCFLAGS) $*.C -o $@
#
#.ASM.O:
#   $(NASM) -f elf -DELF $(FXDEFINES) -i . -i i386 $*.ASM -o $@
#


clean:
   rm -f *.o


include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal_cpp


I did also this to port.h:

Code:
#define LSB_FIRST

//#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__x86_64__) || defined(__WIN32__) || defined(__alpha__)
//#define LSB_FIRST
//#define FAST_LSB_WORD_ACCESS
//#else
//#define MSB_FIRST
//#endif


Best regards,

bootsector
Back to top
View user's profile Send private message
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Fri Mar 07, 2008 7:00 am    Post subject: Reply with quote

When you get an internal compiler error, then best advice I can give is to comment out functions in the offending source file and try to find the code which breaks the compiler and create an alternative version of code, which doesn't break the compiler :-)
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
Mega Man



Joined: 18 Jun 2005
Posts: 274

PostPosted: Sat Mar 08, 2008 7:57 am    Post subject: Reply with quote

I saw this error before. I believe you can get around this problem when using a different STL library:

Code:

svn co svn://svn.ps2dev.org/ps2/trunk/ps2sdk-ports/stlport


Code:

EE_CXXFLAGS += -D_STLP_NO_NAMESPACES -D_NOTHREADS -D_STLP_NO_EXCEPTIONS -D_STLP_USE_NEWALLOC -D_STLP_HAS_WCHAR_T -D_STLP_NO_IOSTREAMS -Dwint_t=int -I$(PS2SDK)/ports/include/stlport/
Back to top
View user's profile Send private message Visit poster's website
bootsector_



Joined: 25 Feb 2008
Posts: 15

PostPosted: Tue Mar 18, 2008 5:54 am    Post subject: Reply with quote

Thanks for your answer Mega Man!

Getting back to the lab on this, I get the following error message when trying to make stlport:

Quote:
../stlport/cstdio:102: `rename' not declared


What should I do? Comment out 'rename' definiton on that file? That would be enough and safe?
Back to top
View user's profile Send private message
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Tue Mar 18, 2008 7:12 am    Post subject: Reply with quote

bootsector_ wrote:
Thanks for your answer Mega Man!

Getting back to the lab on this, I get the following error message when trying to make stlport:

Quote:
../stlport/cstdio:102: `rename' not declared


What should I do? Comment out 'rename' definiton on that file? That would be enough and safe?


Create the function yourself, just create a new file with the new name and delete the one with the old name, see ps2sdk/ee/include/fileio.h. (definition of function: http://www.cplusplus.com/reference/clibrary/cstdio/rename.html)

You could also just create a empty stub and printf whenever it gets called, this way you would know if you need it or not :-)
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
Rev1Dev



Joined: 13 Apr 2008
Posts: 22

PostPosted: Tue Apr 15, 2008 9:05 pm    Post subject: Reply with quote

I can't wait for this. = )
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group