CrabEMU need help compiling...

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Stryfe
Psychotic DCEmu
Psychotic DCEmu
Posts: 577
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Aug 11, 2008 9:34 am
Location: Nowhere U.S.A.
Has thanked: 0
Been thanked: 0

CrabEMU need help compiling...

Post by Stryfe »

Hello. This is mostly directed at BlueCrab, but I suppose anyone with the knowledge could chime in.

I'm not quite sure what's going on here when I attempt to compile the latest SVN trunk of CrabEMU.

I've downloaded the subversion of CrabEMU.

Code: Select all

svn co https://crabemu.svn.sourceforge.net/svnroot/crabemu $HOME/Dreamcast/crabemu 
I've downloaded the subversion of KOS.

Code: Select all

svn co https://cadcdev.svn.sourceforge.net/svnroot/cadcdev $HOME/Dreamcast/cadcdev
I compiled KOS without any errors, directing the "toolchains/dc" to install in "$HOME/Dreamcast/". ie - $HOME/Dreamcast/toolchains/dc/sh-elf, etc.

I opened the "cadcdev/kos/doc/environ.sh.sample" file and edited it to the following, saved it to environ.sh in my toolchains directory, and made it executable.

Code: Select all

# KallistiOS environment variable settings
#
# This is a sample script. Configure to suit your setup. Some possible
# alternatives for the values below are included as an example.
#
# This script should be executed in your current shell environment (probably
# by bashrc or something similar).
#

# Build architecture. Set the major architecture you'll be building for.
export KOS_ARCH="dreamcast"
#export KOS_ARCH="gba"
#export KOS_ARCH="ps2"
#export KOS_ARCH="ia32"

# Build sub-architecture. If you need a particular sub-architecture, then set
# that here; otherwise use "pristine".
export KOS_SUBARCH="pristine"
# export KOS_SUBARCH="navi"	# DC
# export KOS_SUBARCH="rte"	# PS2

# KOS main base path
export KOS_BASE="$HOME/Dreamcast/cadcdev/kos"

# Make utility
export KOS_MAKE="make"
#export KOS_MAKE="gmake"

# Load utility
export KOS_LOADER="dc-tool -x"				# dcload, preconfigured
# export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x"	# dcload-serial
# export KOS_LOADER="vgba -sound 44100 -nocrc"		# GBA/vgba

# Genromfs utility
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"
#export KOS_GENROMFS="genromfs"

# Compiler prefixes
#export KOS_CC_BASE="$HOME/Dreamcast/toolchains/dc/dc-elf"
#export KOS_CC_PREFIX="dc"
export KOS_CC_BASE="$HOME/Dreamcast/toolchains/dc/sh-elf"		# DC
export KOS_CC_PREFIX="sh-elf"
#export KOS_CC_BASE="${EE}"				# PS2
#export KOS_CC_PREFIX="ee"
#export KOS_CC_BASE="/usr/local/gba/arm-elf"		# GBA
#export KOS_CC_PREFIX="arm-elf"

# If you are compiling for DC and have an ARM compiler, use these too.
export DC_ARM_BASE="$HOME/Dreamcast/toolchains/dc/arm-elf"
export DC_ARM_PREFIX="arm-elf"

# Expand PATH (comment out if you don't want this done here)
export PATH="${PATH}:${KOS_CC_BASE}/bin:$HOME/Dreamcast/toolchains/dc/bin"

# Manually add our second addons tree
export KOS_INC_PATHS="-I${KOS_BASE}/../kos-ports/include"

# reset some options because there's no reason for them to persist across
# multiple sourcing of this
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""

# Setup some default CFLAGS for compilation. The things that will go here
# are user specifyable, like optimization level and whether you want stack
# traces enabled. Some platforms may have optimization restrictions,
# please check README.
export KOS_CFLAGS="-O2 -fomit-frame-pointer"
# export KOS_CFLAGS="-O2 -DFRAME_POINTERS"

# Everything else is pretty much shared. If you want to configure compiler
# options or other such things, look at this file.
. ${KOS_BASE}/environ_base.sh
After running the environ.sh script, navigating to the "$HOME/Dreamcast/crabemu/trunk/CrabEmu/src/dreamcast" directory, and running make, this is what I get.

Code: Select all

# make
Makefile:55: /Makefile.rules: No such file or directory
make: *** No rule to make target `/Makefile.rules'.  Stop.
Am I missing something here?
ImageImageImageImage
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: CrabEMU need help compiling...

Post by BlueCrab »

You need to source the environ.sh file before you try to build anything with KOS. Also, you have to build KOS, which it sounds like you haven't actually done, since you'd have had to source the environ.sh file for that as well. You probably only have the toolchains built, and not KOS itself.
Stryfe
Psychotic DCEmu
Psychotic DCEmu
Posts: 577
Joined: Mon Aug 11, 2008 9:34 am
Location: Nowhere U.S.A.
Has thanked: 0
Been thanked: 0

Re: CrabEMU need help compiling...

Post by Stryfe »

BlueCrab wrote:Also, you have to build KOS, which it sounds like you haven't actually done, since you'd have had to source the environ.sh file for that as well.
So I didn't, heh... :mrgreen:

Okay so I ran "source environ.sh" on my edited sample file, and did the make. It completed without any apparent errors.

Now after sourcing the environ.sh file again, and trying to build crabemu, I get this output.

Code: Select all

~/Dreamcast/crabemu/trunk/CrabEmu/src/dreamcast # make
rm -f crabemu.bin crabemu.elf
kos-cc  -c main.c -o main.o
kos-cc  -c sound.c -o sound.o
kos-cc  -c palmenu.c -o palmenu.o
kos-cc  -c ../consoles/sms/sms.c -o ../consoles/sms/sms.o
kos-cc  -c ../consoles/sms/smsmem.c -o ../consoles/sms/smsmem.o
kos-cc  -c ../consoles/sms/smsvdp.c -o ../consoles/sms/smsvdp.o
kos-cc  -c ../consoles/sms/smsz80.c -o ../consoles/sms/smsz80.o
kos-cc  -c menu.c -o menu.o
menu.c: In function ‘create_list’:
menu.c:110:9: warning: array subscript has type ‘char’
menu.c:111:12: warning: array subscript has type ‘char’
menu.c:112:12: warning: array subscript has type ‘char’
menu.c:115:9: warning: array subscript has type ‘char’
menu.c:116:17: warning: array subscript has type ‘char’
menu.c:119:9: warning: array subscript has type ‘char’
menu.c:120:17: warning: array subscript has type ‘char’
menu.c: In function ‘menu’:
menu.c:416:13: warning: array subscript has type ‘char’
menu.c:417:16: warning: array subscript has type ‘char’
menu.c:418:16: warning: array subscript has type ‘char’
menu.c:421:13: warning: array subscript has type ‘char’
menu.c:422:21: warning: array subscript has type ‘char’
menu.c:425:13: warning: array subscript has type ‘char’
menu.c:426:21: warning: array subscript has type ‘char’
kos-cc  -c font.c -o font.o
kos-cc  -c ../consoles/sms/93c46.c -o ../consoles/sms/93c46.o
kos-cc  -c ../consoles/sms/mappers.c -o ../consoles/sms/mappers.o
kos-cc  -c ../cpu/CrabZ80/CrabZ80.c -o ../cpu/CrabZ80/CrabZ80.o
kos-cc  -c ../sound/sn76489.c -o ../sound/sn76489.o
kos-cc  -c ../consoles/sms/terebi.c -o ../consoles/sms/terebi.o
kos-cc  -c ../consoles/sms/tms9918a.c -o ../consoles/sms/tms9918a.o
kos-cc  -c ../consoles/sms/smsmem-gg.c -o ../consoles/sms/smsmem-gg.o
kos-cc  -c ../consoles/sms/mapper-93c46.c -o ../consoles/sms/mapper-93c46.o
kos-cc  -c ../consoles/sms/mapper-korean.c -o ../consoles/sms/mapper-korean.o
kos-cc  -c ../consoles/sms/mapper-codemasters.c -o ../consoles/sms/mapper-codemasters.o
kos-cc  -c ../consoles/sms/mapper-sega.c -o ../consoles/sms/mapper-sega.o
kos-cc  -c ../consoles/sms/mapper-sg1000.c -o ../consoles/sms/mapper-sg1000.o
kos-cc  -c ../consoles/sms/cheats.c -o ../consoles/sms/cheats.o
../consoles/sms/cheats.c: In function ‘sms_cheat_read’:
../consoles/sms/cheats.c:129:9: warning: array subscript has type ‘char’
kos-cc  -c ../consoles/sms/sdscterminal.c -o ../consoles/sms/sdscterminal.o
kos-cc  -c ../utils/list.c -o ../utils/list.o
kos-cc  -c ../utils/minizip/ioapi.c -o ../utils/minizip/ioapi.o
kos-cc  -c ../utils/minizip/unzip.c -o ../utils/minizip/unzip.o
kos-cc  -c ../sound/ym2413.c -o ../sound/ym2413.o
kos-cc  -c ../consoles/sms/mapper-koreanmsx.c -o ../consoles/sms/mapper-koreanmsx.o
kos-cc -o crabemu.elf main.o sound.o palmenu.o ../consoles/sms/sms.o ../consoles/sms/smsmem.o ../consoles/sms/smsvdp.o ../consoles/sms/smsz80.o menu.o font.o ../consoles/sms/93c46.o ../consoles/sms/mappers.o ../cpu/CrabZ80/CrabZ80.o ../sound/sn76489.o ../consoles/sms/terebi.o ../consoles/sms/tms9918a.o ../consoles/sms/smsmem-gg.o ../consoles/sms/mapper-93c46.o ../consoles/sms/mapper-korean.o ../consoles/sms/mapper-codemasters.o ../consoles/sms/mapper-sega.o ../consoles/sms/mapper-sg1000.o ../consoles/sms/cheats.o ../consoles/sms/sdscterminal.o ../utils/list.o ../utils/minizip/ioapi.o ../utils/minizip/unzip.o ../sound/ym2413.o ../consoles/sms/mapper-koreanmsx.o -lpng -lz -lbz2 -lm
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: cannot find -lpng
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: cannot find -lz
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: cannot find -lbz2
collect2: ld returned 1 exit status
make: *** [crabemu.elf] Error 1
ImageImageImageImage
User avatar
Indiket
DC Developer
DC Developer
Posts: 99
Joined: Sun Sep 05, 2010 5:44 am
Has thanked: 0
Been thanked: 0

Re: CrabEMU need help compiling...

Post by Indiket »

So, following the logical next step, did you also compile kos-ports? It contains your missing libraries (bz2, png, zlib) among other useful ones.
Just start your dreamcast environment, and go to kos-ports -> make. After that, you will successfully compile CrabEmu.

Happy new year!!
Last edited by Indiket on Sat Dec 31, 2011 5:19 pm, edited 1 time in total.
Stryfe
Psychotic DCEmu
Psychotic DCEmu
Posts: 577
Joined: Mon Aug 11, 2008 9:34 am
Location: Nowhere U.S.A.
Has thanked: 0
Been thanked: 0

Re: CrabEMU need help compiling...

Post by Stryfe »

*DOUBLE-FACEPALM*

Thanks for the heads up Inkidet.

!Feliz ano nuevo!

Well... I compiled the kos-ports, but there are still errors present.

Code: Select all

# make
rm -f crabemu.bin crabemu.elf
kos-cc -o crabemu.elf main.o sound.o palmenu.o ../consoles/sms/sms.o ../consoles/sms/smsmem.o ../consoles/sms/smsvdp.o ../consoles/sms/smsz80.o menu.o font.o ../consoles/sms/93c46.o ../consoles/sms/mappers.o ../cpu/CrabZ80/CrabZ80.o ../sound/sn76489.o ../consoles/sms/terebi.o ../consoles/sms/tms9918a.o ../consoles/sms/smsmem-gg.o ../consoles/sms/mapper-93c46.o ../consoles/sms/mapper-korean.o ../consoles/sms/mapper-codemasters.o ../consoles/sms/mapper-sega.o ../consoles/sms/mapper-sg1000.o ../consoles/sms/cheats.o ../consoles/sms/sdscterminal.o ../utils/list.o ../utils/minizip/ioapi.o ../utils/minizip/unzip.o ../sound/ym2413.o ../consoles/sms/mapper-koreanmsx.o -lpng -lz -lbz2 -lm
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(cache.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(cache.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(cache.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(entry.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(entry.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(entry.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(thdswitch.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(thdswitch.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(thdswitch.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(dcload-syscall.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(dcload-syscall.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(dcload-syscall.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(itlb.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(itlb.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(itlb.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(matrix.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(matrix.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(matrix.o)
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(execasm.o): compiled for a big endian system and target is little endian
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(execasm.o): uses instructions which are incompatible with instructions used in previous modules
/root/Dreamcast/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: failed to merge target specific data of file /root/Dreamcast/cadcdev/kos/lib/dreamcast/libkallisti.a(execasm.o)
collect2: ld returned 1 exit status
make: *** [crabemu.elf] Error 1
Do I need to recompile GCC with a different endian parameter?
ImageImageImageImage
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: CrabEMU need help compiling...

Post by BlueCrab »

It looks like for some reason you didn't set GCC to default to a little endian system, and somehow when KOS built it didn't pick up the -ml flag that would set that. Make sure that after you source environ.sh that the KOS_CFLAGS environment variable has -ml -m4-single-only in it. Then try rebuilding KOS (make clean && make).

As an aside, this really should probably be in the programming forum, so I'm moving it there now...
Stryfe
Psychotic DCEmu
Psychotic DCEmu
Posts: 577
Joined: Mon Aug 11, 2008 9:34 am
Location: Nowhere U.S.A.
Has thanked: 0
Been thanked: 0

Re: CrabEMU need help compiling...

Post by Stryfe »

The variable seemed to be set properly.

Code: Select all

~ # echo $KOS_CFLAGS
-O2 -fomit-frame-pointer -ml -m4-single-only -fno-crossjumping -I/root/Dreamcast/cadcdev/kos/../kos-ports/include -I/root/Dreamcast/cadcdev/kos/include -I/root/Dreamcast/cadcdev/kos/kernel/arch/dreamcast/include -I/root/Dreamcast/cadcdev/kos/addons/include -D_arch_dreamcast -D_arch_sub_pristine -Wall -g -fno-builtin -fno-strict-aliasing
I was getting errors with make clean, so I simply deleted the directory followed by updating the svn.

Well, the end result worked. I've finally compiled my first KOS binary.

Thanks BlueCrab. 8-)
ImageImageImageImage
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: CrabEMU need help compiling...

Post by BlueCrab »

Glad you got it working. :)
Post Reply