Unable to compile KOS examples

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
User avatar
Maturion
Moderator
Moderator
Posts: 619
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Oct 12, 2007 1:52 pm
Location: Munich, Germany
Has thanked: 0
Been thanked: 0
Contact:

Unable to compile KOS examples

Post by Maturion »

After a long, long break, I decided to get back into Dreamcast development. I'm on a 64 bit machine running Linux Mint.
I just compiled a DC toolchain using the dc-chain download script and Makefile. Building the toolchain seems to have worked and building KOS seems to work without errors, too.

I'm unable to compile any KOS examples, however.

Here's what I get when I try to compile the "hello" example:

Code: Select all

rm -f hello.elf romdisk.*
kos-cc  -c hello.c -o hello.o
/home/matthias/workspace/dcdev/kallistios/utils/genromfs/genromfs -f romdisk.img -d romdisk -v -x .svn
0    rom 56d9d3c2         [0xffffffff, 0xffffffff] 37777777777, sz     0, at 0x0     
1    .                    [0x806     , 0xba0ccb  ] 0040755, sz     0, at 0x20    
1    ..                   [0x806     , 0xba0cc8  ] 0040755, sz     0, at 0x40     [link to 0x20    ]
1    .keepme              [0x806     , 0xba0ccc  ] 0100644, sz     0, at 0x60    
/home/matthias/workspace/dcdev/kallistios/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
kos-cc -o hello.elf hello.o romdisk.o
/home/matthias/workspace/dcdev/kallistios/lib/dreamcast/libkallisti.a(init.o): In Funktion `arch_shutdown':
/home/matthias/workspace/dcdev/kallistios/kernel/arch/dreamcast/kernel/init.c:257: Undefined reference to `_fini'
/home/matthias/workspace/dcdev/kallistios/lib/dreamcast/libkallisti.a(init.o): In function `arch_main':
/home/matthias/workspace/dcdev/kallistios/kernel/arch/dreamcast/kernel/init.c:209: Undefined reference to `_init'
collect2: Fehler: ld gab 1 als Ende-Status zurück
make: *** [hello.elf] Fehler 1

I tried to compile kos-ports after that. Some did compile, others didn't. I tried to use kos-ports/utils/build-all.sh and it failed when it tried to compile libopus:

Code: Select all

File "opus-1.1.1.tar.gz" is ok.
Unpacking opus-1.1.1.tar.gz ...
Copying KOS files...
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for sh-elf-strip... sh-elf-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... sh-unknown-elf
checking how to print strings... printf
checking for style of include used by make... GNU
checking for sh-elf-gcc... kos-cc
checking whether the C compiler works... no
configure: error: in `/home/matthias/workspace/dcdev/kos-ports/opus/build/opus-1.1.1':
configure: [b]error: C compiler cannot create executables[/b]
What am I doing wrong?
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: Unable to compile KOS examples

Post by BlueCrab »

I think I know what's going wrong... Do me a favor and run "kos-cc -v" in a terminal and give me the output.

I have a feeling that the fact that you're using of the German locale has screwed up detection of your GCC version, and thus it's using incorrect compiler flags...

EDIT: Never mind, I just confirmed that that is exactly what the problem is... Now, what's the best way to fix it...

As a quick fix, you can open up the environ_base.sh file, go down to line 42, and change that to just be KOS_GCCVER="4.7.3" (I'm assuming that's what you built, if you didn't change anything in dc-chain). Then you should be able to build Opus and the examples properly.

Oddly enough, I haven't seen any other languages (other than German) that break that detection. For some reason, in German (and no other languages I've tested), the last line of the output of "kos-cc -v" says gcc-Version 4.7.3 (GCC), whereas every other language I've tested has a space instead of that hyphen. It even works fine with a Japanese locale set, for instance...

EDIT 2: Fixed a much better way in commit 456ca8.
Post Reply