KOS In Unix systems

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.
N64VSNES
DCEmu Freak
DCEmu Freak
Posts: 65
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Apr 10, 2011 12:05 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by N64VSNES »

Okay it ended with this:

Code: Select all

make[5]: Entering directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/thumb/libgcc'
/bin/bash ../../../../gcc-4.5.2/libgcc/../mkinstalldirs /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb
mkdir -p -- /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb
/usr/bin/install -c -m 644 libgcc.a /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/
chmod 644 /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/libgcc.a
/opt/toolchains/dc/arm-elf/arm-elf/bin/ranlib /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/libgcc.a
/usr/bin/install -c -m 644 libgcov.a /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/
chmod 644 /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/libgcov.a
/opt/toolchains/dc/arm-elf/arm-elf/bin/ranlib /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/libgcov.a
parts="crtbegin.o crtend.o crti.o crtn.o";				\
	for file in $parts; do					\
	  rm -f /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/$file;	\
	  /usr/bin/install -c -m 644 $file /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/thumb/;	\
	done
make[5]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/thumb/libgcc'
make[5]: Entering directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/fpu/libgcc'
/bin/bash ../../../../gcc-4.5.2/libgcc/../mkinstalldirs /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu
mkdir -p -- /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu
/usr/bin/install -c -m 644 libgcc.a /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/
chmod 644 /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/libgcc.a
/opt/toolchains/dc/arm-elf/arm-elf/bin/ranlib /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/libgcc.a
/usr/bin/install -c -m 644 libgcov.a /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/
chmod 644 /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/libgcov.a
/opt/toolchains/dc/arm-elf/arm-elf/bin/ranlib /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/libgcov.a
parts="crtbegin.o crtend.o crti.o crtn.o";				\
	for file in $parts; do					\
	  rm -f /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/$file;	\
	  /usr/bin/install -c -m 644 $file /opt/toolchains/dc/arm-elf/lib/gcc/arm-elf/4.5.2/fpu/;	\
	done
make[5]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/fpu/libgcc'
make[4]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/libgcc'
make[3]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2/arm-elf/libgcc'
make[2]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2'
make[1]: Leaving directory `/home/nico/cadcdev/kos/utils/dc-chain/build-gcc-arm-elf-4.5.2'
After like 3 hours of compiling :lol:

Looks like success, right? :grin:

EDIT:
Also, this environ script, isn't that just something to allow both x86/Sh4 architectures to be supported or am I talking jibberish? :?
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: KOS In Unix systems

Post by Stryfe »

I personally compiled this on a x86_64 system. I'm pretty sure all sourcing the environ.sh file does is set certain environmental variables by calling the export command.
ImageImageImageImage
N64VSNES
DCEmu Freak
DCEmu Freak
Posts: 65
Joined: Sun Apr 10, 2011 12:05 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by N64VSNES »

Stryfe wrote:I personally compiled this on a x86_64 system. I'm pretty sure all sourcing the environ.sh file does is set certain environmental variables by calling the export command.
So all I need to do is run the script? :?
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: KOS In Unix systems

Post by Stryfe »

I just followed the instructions from the 'cadcdev/kos/doc/README' file under the 'BUILDING' section. Edit the sample file to reflect the desired platform. It was DC for me, but maybe N64 for you?

At that point open a terminal, or console window, and run 'source environ.sh', where the environ.sh file is located in the cadcdev/kos directory.

Whilst still in the same terminal/console, navigate to the make directories of kos, kos-ports, and the toolchain to run make. That's how I did it anyways.
ImageImageImageImage
N64VSNES
DCEmu Freak
DCEmu Freak
Posts: 65
Joined: Sun Apr 10, 2011 12:05 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by N64VSNES »

Stryfe wrote:I just followed the instructions from the 'cadcdev/kos/doc/README' file under the 'BUILDING' section. Edit the sample file to reflect the desired platform. It was DC for me, but maybe N64 for you?

At that point open a terminal, or console window, and run 'source environ.sh', where the environ.sh file is located in the cadcdev/kos directory.

Whilst still in the same terminal/console, navigate to the make directories of kos, kos-ports, and the toolchain to run make. That's how I did it anyways.
DC of course :wink:
Thanks for the advice, I'll see what I can break :lol:

EDIT:
I have to admit, I'm a little confused here. All these paths such as KOS_BASE, should they be changed?
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: KOS In Unix systems

Post by Stryfe »

Yes. I changed the uncommented parameters to reflect where the kos directory, and toolchain directories could be found.

For instance, I changed the following.

Code: Select all

export KOS_BASE="/usr/local/home/bard/prj/svn/kos"
TO

Code: Select all

export KOS_BASE="$HOME/Dreamcast/cadcdev/kos"
AND

Code: Select all

export KOS_CC_BASE="/usr/local/dc/sh-elf"
TO

Code: Select all

export KOS_CC_BASE="$HOME/Dreamcast/toolchains/dc/sh-elf"
etc...

I changed the default install directories for the toolchains in their makefile obviously, but it appears from about 5 posts back, you kept it at the defaults.

/home/nico/cadcdev/kos/utils/dc-chain/MAKEFILE
<snip>

Code: Select all

sh_prefix  := /opt/toolchains/dc/$(sh_target)
arm_prefix := /opt/toolchains/dc/$(arm_target)
If I did it wrong, I'm sure someone will correct me.

EDIT;
Yeah, I think I built the toolchains before anything else without the environ.sh. You then specify their paths in the environ.sh file.
ImageImageImageImage
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has thanked: 0
Been thanked: 2 times

Re: KOS In Unix systems

Post by Chilly Willy »

Chilly Willy wrote:
BlueCrab wrote:That page is extremely old and doesn't reflect the current state of things at all, unfortunately. Now that you pointed out that its still there like that, I'll go and get rid of it before anyone else gets confused. :wink:

Basically, what you need to do is to get KOS from the SVN:

Code: Select all

svn co https://cadcdev.svn.sourceforge.net/svnroot/cadcdev cadcdev
Um - when do you plan to add SD support to the "official" repo? Most of us can't use it until you do. I'm using the repo from emuforge as that has SD card support. I'm sure many others are as well. That also has Chui's Allegro port as well.
Bump
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: KOS In Unix systems

Post by BlueCrab »

Hijacking other people's topics to ask unrelated questions isn't likely to get me to answer them.
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has thanked: 0
Been thanked: 2 times

Re: KOS In Unix systems

Post by Chilly Willy »

It is entirely on topic - the topic was on building kos, and part of that is WHERE to get kos from. Depending on which repo you use, you will have different capabilities, which I am pointing out. If you use the cadcdev repo, you can't use SD cards. So naturally that leads to the question of when SD card support will come to the cadcdev repo.

Sometimes you get a bit crabby, but we still love our crabby overlord anyway! :grin:
N64VSNES
DCEmu Freak
DCEmu Freak
Posts: 65
Joined: Sun Apr 10, 2011 12:05 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by N64VSNES »

Well it seems I'm very nearly there with this :grin:

I managed to source the environ script just fine, and I nearly got and example to compile.. (Nearly).

Code: Select all

nico@ubuntu:~/cadcdev/kos/examples/dreamcast/pvr/texture_render$ make
rm -f texture_render.elf
rm -f texture_render.bin
kos-cc  -c ta.c -o ta.o
ta.c: In function ‘draw_textured’:
ta.c:151:12: warning: unused variable ‘tmp’
/opt/toolchains/dc/sh-elf/bin/sh-elf-gcc -O2 -fomit-frame-pointer -ml -m4-single-only -fno-crossjumping -I/home/nico/cadcdev/kos//../kos-ports/include -I/home/nico/cadcdev/kos//include -I/home/nico/cadcdev/kos//kernel/arch/dreamcast/include -I/home/nico/cadcdev/kos//addons/include -D_arch_dreamcast -D_arch_sub_pristine -Wall -g -fno-builtin -fno-strict-aliasing  -ml -m4-single-only -Wl,-Ttext=0x8c010000 -T/home/nico/cadcdev/kos//utils/ldscripts/shlelf.xc -nodefaultlibs -L/home/nico/cadcdev/kos//lib/dreamcast -L/home/nico/cadcdev/kos//addons/lib/dreamcast -o texture_render.elf  \
		ta.o  -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group
/opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.5.2/../../../../sh-elf/bin/ld: cannot find -lkallisti
collect2: ld returned 1 exit status
make: *** [texture_render.bin] Error 1
I would put forth a idea or two but I truly have none lol.
I'm guessing I've missed something obvious again though?
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: KOS In Unix systems

Post by Stryfe »

Have you double checked your paths? Without knowing what sample you've compiled, my first 'guess' might the double solidus I've bolded.
/home/nico/cadcdev/kos//utils/ldscripts/shlelf.xc
I don't mean to sound like an expert either, but once you've run 'source environ.sh', you can check any set variables with the echo command.

Examples:

Code: Select all

# echo $KOS_LOADER
dc-tool -x

Code: Select all

# echo $KOS_MAKE
make

Code: Select all

# echo $KOS_BASE
/root/Dreamcast/cadcdev/kos
Etc...
ImageImageImageImage
N64VSNES
DCEmu Freak
DCEmu Freak
Posts: 65
Joined: Sun Apr 10, 2011 12:05 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by N64VSNES »

Yeah, I changed all the paths and they appear to be correct.

Here's the environ.sh file:

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/nico/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="/usr/local/dc/dc-elf"
#export KOS_CC_PREFIX="dc"
export KOS_CC_BASE="/opt/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="/opt/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:/usr/local/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
Looks okay, right?
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: KOS In Unix systems

Post by BlueCrab »

You don't need the slash at the end of the KOS_BASE.

But anyway, what's probably wrong with your setup, since its saying you're missing -lkallisti is that you didn't build KOS itself. source the environ script, then cd to $KOS_BASE and run make.
root670
DCEmu Newbie
DCEmu Newbie
Posts: 4
Joined: Mon Jan 02, 2012 2:17 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by root670 »

I'm having similar problems trying to get the toolchain to build. I'm running Ubuntu 11.10 x64. I grabbed the latest revision with SVN and ran the download.sh script, followed by the unpack.sh script. Before running make, I changed the prefixes to this:

Code: Select all

sh_prefix  := $(HOME)/Dreamcast/dc/toolchain/$(sh_target)
arm_prefix := $(HOME)/Dreamcast/dc/toolchain/$(arm_target)
I ensured that I had build-essential, binutils, make, gcc, GMP, MPFR, MPC, etc. installed before running make. After a few minutes, it came back with an error.

Here's the log for the the newlib portion: http://pastebin.com/hxVnUgYz. This is the error that killed the whole thing at the end:

Code: Select all

checking for suffix of object files... configure: error: in `/home/wes/kos/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/libc/machine/sh':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
configure: error: ../../../../../../newlib-1.19.0/newlib/libc/machine/sh/configure failed for sh
configure: error: ../../../../../newlib-1.19.0/newlib/libc/machine/configure failed for machine
configure: error: ../../../../newlib-1.19.0/newlib/libc/configure failed for libc
I would really appreciate it if someone could give me a hand with this ;) Here's the other logs if those need to be looked at: http://pastebin.com/XRcHaNuK & http://pastebin.com/4nTkcR9z
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: KOS In Unix systems

Post by BlueCrab »

GCC failed to build in your case as well. Unfortunately, from the logs you posted, its not entirely clear as to why it did. Note the error at the end of the GCC build log, and try to find the config.log that corresponds to where it died.
root670
DCEmu Newbie
DCEmu Newbie
Posts: 4
Joined: Mon Jan 02, 2012 2:17 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by root670 »

Thanks for the quick response! Here's the GCC build log I've got: http://pastebin.com/cVzFuGGA. I see a lot of "No such file or directory" errors in the log. Could my path variable be messed up?
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: KOS In Unix systems

Post by BlueCrab »

I don't believe that its that config.log that is the problem. The one that would have more information should be the one for the target libgcc. See if you have a /home/wes/kos/kos/utils/dc-chain/build-gcc-sh-elf-4.5.2/sh-elf/libgcc directory and grab the config.log from there.
root670
DCEmu Newbie
DCEmu Newbie
Posts: 4
Joined: Mon Jan 02, 2012 2:17 pm
Has thanked: 0
Been thanked: 0

Re: KOS In Unix systems

Post by root670 »

This is the config.log from /home/wes/kos/kos/utils/dc-chain/build-gcc-sh-elf-4.5.2/sh-elf/libgcc http://pastebin.com/Ns732Kcb

Thanks again for your help
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: KOS In Unix systems

Post by Stryfe »

root670 wrote:I'm having similar problems trying to get the toolchain to build. I'm running Ubuntu 11.10 x64. I grabbed the latest revision with SVN and ran the download.sh script, followed by the unpack.sh script. Before running make, I changed the prefixes to this:

Code: Select all

sh_prefix  := $(HOME)/Dreamcast/dc/toolchain/$(sh_target)
arm_prefix := $(HOME)/Dreamcast/dc/toolchain/$(arm_target)
Have you tried the full path instead of the '$(HOME)' variable, or even just '$HOME' without brackets?
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: KOS In Unix systems

Post by BlueCrab »

Did you have an earlier attempt at building it fail, perhaps in the Newlib build phase? Because it looks like what's wrong is that the build script failed to install Newlib, and you ended up with the same issue that was happening to someone else in the thread with the "include" directory not being a directory.

Specifically, this is the part of the config.log that shows that:

Code: Select all

configure:3211: checking for suffix of object files
configure:3233: /home/wes/kos/kos/utils/dc-chain/build-gcc-sh-elf-4.5.2/./gcc/xgcc -B/home/wes/kos/kos/utils/dc-chain/build-gcc-sh-elf-4.5.2/./gcc/ -B/home/wes/Dreamcast/dc/toolchain/sh-elf/sh-elf/bin/ -B/home/wes/Dreamcast/dc/toolchain/sh-elf/sh-elf/lib/ -isystem /home/wes/Dreamcast/dc/toolchain/sh-elf/sh-elf/include -isystem /home/wes/Dreamcast/dc/toolchain/sh-elf/sh-elf/sys-include    -c -g -O2  conftest.c >&5
cc1: error: /home/wes/Dreamcast/dc/toolchain/sh-elf/sh-elf/include: not a directory
I'd recommend deleting the whole destination directory, as well as all of the intermediate build results, and trying again from scratch...

All of the troubles that randomly can creep up in things like this remind me why I usually build my toolchains without any sort of script. :?
Post Reply