[Help] - Compile Daedalus with the most recent KOS Version.

Hi everyone, I´m trying to compile Daedalus for the Dreamcast using the most recent KOS version. The makefile that comes with the source code is a litlle bit messy and it contains very old libraries (Example: -lk++).

Does someone could help me get it working with a new KOS version? It´s for an experiment! Thanks.

Edit:

Update 1 -
Emulator compiled with new libraries, VMU ICON for Mario 64, Emulator booting Mario 64 automatically, speed improved a bit.



GitHub link: https://github.com/TItanGuy99/Daedalus-Dreamcast

My goal is try to achieve at least 15 fps for Mario 64 (Currently between 4.5/6.5 FPS in game), any help would be welcome! Next step I'll try to improve some routines in the CPU code!
Blue crab/Lawrence Sebald is probably the best person to ask for help: https://github.com/ljsebald
Thanks brother, sent him a message!
The graphics are actually pretty good for the build floating around, aside from the 2fps frame rate with no sound

SM64 looks a lot sharper on VGA

It'd be nice to see even 20fps with sound. but if it was ever full speed, playing DK64 or conker on dreamcast would be off the chain

though i suppose the only hope for something llike that is A LOT of ASM, using DirectX\Direct3D via Windows CE for dll 'plugin' support for graphics, ARM SPU, maple, etc. cool prospect though
That suddenly reminded me of early N64 emulation on the PSP. good times.
Ok, I think I´m close now, I redid the makefile and now its just giving me an error -lk++ not found! I think it was removed in the new KOS. I need to know with what I will replace it. If someone has some hint let me know.

Here is my makefile updated:

###############################################################################
# This section can be adapted to the respective project
###############################################################################

# Compilerdefinition
CC = sh-elf-gcc
CPP = sh-elf-g++
AS = sh-elf-as
RM = del
MKDIR = C:\cygwin\bin\mkdir

# File to create
BIN = DaedalusDC.elf

# output directory
OUTPUT = -I"C:/cygwin/home/luiz_/dc/kos/Projects/my_game/obj" \

# Directories with source code files
SOURCES = -I"C:/cygwin/home/luiz_/dc/kos/Projects/my_game/src" \
-I"C:/cygwin/home/luiz_/dc/kos/Projects/my_game/src/math/matrix" \
-I"C:/cygwin/home/luiz_/dc/kos/Projects/my_game/src/math/plane" \
-I"C:/cygwin/home/luiz_/dc/kos/Projects/my_game/src/math/vector" \

# Include directories for the C compiler
INCS = -I"C:/cygwin/home/luiz_/dc/kos/include" \
-I"C:/cygwin/home/luiz_/dc/kos/addons/include" \
-I"C:/cygwin/home/luiz_/dc/kos/kernel/arch/dreamcast/include" \
-I"C:/cygwin/home/luiz_/dc/kos-ports/include" \
-I"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/include" \
-I"src"

# Include directories for the C ++ compiler
CXXINCS = -I"C:/cygwin/home/luiz_/dc/kos/include" \
-I"C:/cygwin/home/luiz_/dc/kos/addons/include" \
-I"C:/cygwin/home/luiz_/dc/kos/kernel/arch/dreamcast/include" \
-I"C:/cygwin/home/luiz_/dc/kos-ports/include" \
-I"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/include" \
-I"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/include/c++/4.7.3" \
-I"src"

# Library Directories
LIBS = -L"C:/cygwin/home/luiz_/dc/kos/lib/dreamcast" \
-L"C:/cygwin/home/luiz_/dc/kos/addons/lib/dreamcast" \
-L"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/lib"

# Further settings for the assembler
ASFLAGS = -little

# Further settings for the C compiler
CFLAGS = -Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls -D_arch_dreamcast

# Further settings for the C ++ compiler
CXXFLAGS = -Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls -D_arch_dreamcast

# Additional settings for the linker
LDFLAGS = -Wall -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 -Wl,--start-group -lk++ -lstdc++ -lparallax -lconio -lm -lkallisti -lc -lgcc -Wl,--end-group

###############################################################################
# This section does not need to be customized
###############################################################################

# Create a list of all files that need to be compiled
ASSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.s))
CSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
CPPSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp))

# Create a list of the object files created during compilation
ASOBJ = $(patsubst %.s, %.o, $(ASSRC))
COBJ = $(patsubst %.c, %.o, $(CSRC))
CPPOBJ = $(patsubst %.cpp, %.o, $(CPPSRC))
OBJ = $(ASOBJ) $(COBJ) $(CPPOBJ)

# Specify that the object files are also searched for in the output directory
vpath %.o $(OUTPUT)

# Assemble all Assembler source code files
%.o: %.s
$(MKDIR) -p $(dir $(OUTPUT)/$*.o)
$(AS) $(ASFLAGS) $*.s -o $(OUTPUT)/$*.o

# Compile all C source code files into object files
%.o: %.c
$(MKDIR) -p $(dir $(OUTPUT)/$*.o)
$(CC) $(CFLAGS) $(INCS) -c $*.c -o $(OUTPUT)/$*.o

# Compile all C ++ source code files into object files
%.o: %.cpp
$(MKDIR) -p $(dir $(OUTPUT)/$*.o)
$(CPP) $(CXXFLAGS) $(CXXINCS) -c $*.cpp -o $(OUTPUT)/$*.o

# All object files and external libraries link to the output file
$(BIN): $(OBJ)
$(CPP) -o $(BIN) startup.o $(patsubst %, $(OUTPUT)/%, $(OBJ)) $(LIBS) $(LDFLAGS)

clean:
-rm -f main.elf $(OBJS)
-rm -f romdisk.*

dist:
-rm -f $(OBJS)
-rm -f romdisk.*
$(KOS_STRIP) startup.elf

rm-elf:
-rm -f startup.elf
-rm -f romdisk.*







Here is the error I´m getting:

$ make
sh-elf-g++ -o DaedalusDC.elf startup.o -L"C:/cygwin/home/luiz_/dc/kos/lib/dreamcast" -L"C:/cygwin/home/luiz_/dc/kos/addons/lib/dreamcast" -L"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/lib" -Wall -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 -Wl,--start-group -lk++ -lstdc++ -lparallax -lconio -lm -lkallisti -lc -lgcc -Wl,--end-group
/opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/bin/ld: cannot find -lk++
collect2: error: ld returned 1 exit status
make: *** [makefile:93: DaedalusDC.elf] Error 1
You may get an old version of KOS to check what's actually used from k++ then find the corresponding header in the current version. You could still try to simply not include it and see if it works, maybe it is obsolete now.
If I remove -lk++ I get this error:

sh-elf-g++ -o DaedalusDC.elf startup.o -L"C:/cygwin/home/luiz_/dc/kos/lib/dreamcast" -L"C:/cygwin/home/luiz_/dc/kos/addons/lib/dreamcast" -L"C:/cygwin/opt/toolchains/dc/sh-elf/sh-elf/lib" -Wall -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 -Wl,--start-group -lstdc++ -lparallax -lconio -lm -lkallisti -lc -lgcc -Wl,--end-group
C:/cygwin/home/luiz_/dc/kos/lib/dreamcast/libkallisti.a(init.o): In function `arch_shutdown':
/opt/toolchains/dc/kos/kernel/arch/dreamcast/kernel/init.c:257: undefined reference to `_fini'
C:/cygwin/home/luiz_/dc/kos/lib/dreamcast/libkallisti.a(init.o): In function `arch_main':
/opt/toolchains/dc/kos/kernel/arch/dreamcast/kernel/init.c:209: undefined reference to `_init'
/opt/toolchains/dc/kos/kernel/arch/dreamcast/kernel/init.c:209: undefined reference to `_main'
collect2: error: ld returned 1 exit status
make: *** [makefile:93: DaedalusDC.elf] Error 1
Going to check that, tks bro!
You won't like it, but I found this post by Mr. Sebald that says it's obsolete and should be deleted from the makefile.

So you might have to fix those compilation errors in the end.
I found someone with a similar error: https://dcemulation.org/phpBB/viewtopic.php?f=29&t=103928

So you might have a problem with the detection of your gcc version, or something funky with the compiler flags.
That Makefile looks extremely complicated for what you probably need to do...

A normal Makefile for something built with KOS should not require all of that cruft these days... For instance, here's the Makefile for a little DNS server I made for the Sylverant PSO Server:
Code:
#
# Sylverant DNS Server
# Dreamast Makefile
#
# Why? Because I can.
#

TARGET = pso_dns.elf
OBJS = pso_dns.o romdisk.o
KOS_ROMDISK_DIR = romdisk
KOS_CFLAGS += -Wno-char-subscripts

all: $(TARGET)

$(TARGET): $(OBJS)
    kos-cc -o $(TARGET) $(OBJS)
    -rm -f romdisk.*
    -rm -rf romdisk

romdisk:
    mkdir romdisk
    cp pso_dns.conf.sample romdisk/pso_dns.conf

romdisk.img: romdisk

clean:
    -rm -f $(OBJS) $(TARGET) romdisk.*
    -rm -fr romdisk

.PHONY: clean all

include $(KOS_BASE)/Makefile.rules

Usually, that's pretty much all there is to it. You certainly shouldn't have to list out all the compiler's built-in include directories or any of KOS' either. Anyway, here's a stab at what you're probably looking for... For simplicity, this assumes that you're building out of the src directory (so you should put the Makefile there).
Code:
TARGET = DaedalusDC.elf

SOURCES = . math/matrix math/plane math/vector

# Create a list of all files that need to be compiled
ASSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.s))
CSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
CPPSRC = $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp))

# Create a list of the object files created during compilation
ASOBJ = $(patsubst %.s, %.o, $(ASSRC))
COBJ = $(patsubst %.c, %.o, $(CSRC))
CPPOBJ = $(patsubst %.cpp, %.o, $(CPPSRC))

# You need to put all your object files that should be compiled here. All the
# voodoo work up above should hopefully fill in all of the variables used here
# and make a complete list here... All of that stuff was used directly from your
# old Makefile, for reference.
OBJS = $(ASOBJ) $(COBJ) $(CPPOBJ)

# This shouldn't be needed, unless you're including things out of the src
# directory with #include <file.h> instead of #include "file.h". But, since you
# had this here before effectively, it shouldn't hurt to include it.
KOS_CFLAGS += -I.

# This list of libraries taken directly from your old Makefile, with ones you
# definitely don't need removed from it. I obviously can't comment on whatever
# you have left here.
LIBS = -lparallax -lconio -lm

all: $(TARGET)

$(TARGET): $(OBJS)
    kos-c++ -o $(TARGET) $(OBJS) $(LIBS)

clean:
    -rm -f $(OBJS) $(TARGET)

.PHONY: clean all

# This includes all the KOS magic for you, including rules to build .o files out
# of .c, .cpp, and .s files.
include $(KOS_BASE)/Makefile.rules
I (obviously) haven't tested this Makefile out, but it looks sane enough...
Ohh man thanks a lot! You are the best!
post the results of the compile dude
I will do that tonight bro!
I got this:


/home/luiz_/dc/kos/lib/dreamcast/libkallisti.a(init.o): In function `arch_main':
/opt/toolchains/dc/kos/kernel/arch/dreamcast/kernel/init.c:209: undefined reference to `_main'
collect2: error: ld returned 1 exit status
make: *** [makefile:34: DaedalusDC.elf] Error 1



I know cygwin sucks, Im going to install KOS on Ubuntu and try it tonight.

Edit: Other projects I can compile. But Ill install in linux anyway.
LoL, I got it working! Thanks a lot, Im going to post the results here soon!
!?!
I got it compiled and it is running now! I´m doing my tests If I get any improvement Ill post it here.
Update 1 -
Emulator compiled with new libraries, VMU ICON for Mario 64, Emulator booting Mario 64 automatically, speed improved a bit.



GitHub link: https://github.com/TItanGuy99/Daedalus-Dreamcast

My goal is try to achieve at least 15 fps for Mario 64 (Currently between 4.5/6.5 FPS in game), any help would be welcome! Next step I'll try to improve some routines in the CPU code!

Original thread: https://assemblergames.com/threads/help-compile-daedalus-with-the-most-recent-kos-version.68107/