Page 1 of 1

I've hit a roadblock building kOS, DC toolchain... [SOLVED]

Posted: Tue Sep 23, 2014 3:19 pm
by stevepdp
Hey folks. So I finally took the plunge and decided to try building kOS.

So far, It's semi-built and I've enjoyed reading over some of the example code provided. The quality of the documentation in those examples is great, and I'm pretty surprised at how much I've been able to comprehend.

I think my DC toolchain is in a state where it's ready to be used. I was able to compile a few of the example projects so I should in theory be ready to try dcload-ip right? But dcload-ip seems to be missing.

I've followed the documentation at the kOS site very carefully. In fact, I read through it a couple of times to make sure I wasn't missing anything. Clearly I've messed up somewhere...

The environ.sh file I'm using is based on the example they provide. If I recall correctly I just modified the KOS_BASE assignment:

Code: Select all

export KOS_BASE="/Users/stevepdp/kallistios"
Here's a rough run down of the build process to date (I might be missing something here, since it was 24 hours ago):
  • Fetched the prerequisites via Homebrew
  • Git pulled both kallistios and kos-ports repositories, and pulled each of the repos inside kos-ports too.
  • Prepared /opt/toolchains directory and set up appropriate permissions so that the dc toolchain directory would write ok
  • Sourced environ.sh, everything checked out
  • Ran make against kallistios, it compiled ok
  • Went into kos-ports and again ran make in there, all tools seemed to compile ok
  • Checked /opt/toolchains/dc/, it's good and I now have the arm-eabi and sh-elf directories
  • Compiled the "hello" example and have a hello.elf ready for testing on a real Dreamcast (I think...)
  • Took a tar of everything, because I felt the environment was in a good state
Here's the rough directory structure thus far:
/opt/toolchains/dc/ -- has the two directories arm-eabi and sh-elf
/Users/stevepdp/kallistios -- is KOS_BASE
/Users/stevepdp/kos-ports -- tools compiled iirc

I have an EU Dreamcast with an HIT-400 BBA adapter hooked up. Using the DC Dev R4 media, I've loaded dcload-ip (so green!), noted the IP hex and I can ping it OK.

So that's the server side of things set up, now I'm stuck as I can't seem to get the dc-tool to fire on the Mac.

If I understand environ.sh correctly, then $KOS_LOADER should evaluate to "dc-tool -x". This works when echoing the variable in iTerm2. In fact, tab completing "echo $KOS_" reveals all the variables are there. That's good.

So, dc-tool isn't firing, and it isn't referenced in $PATH. Is this where the problem is? Am I supposed to provide dc-tool myself or is it supposed to be part of the kOS distribution?

(As I'm writing this, I've just noticed that the assignment of $PATH in environ.sh is referencing /opt/toolchains/dc/bin. This directory definitely doesn't exist on my Mac. I guess that's a good place to start...

Code: Select all

export PATH="${PATH}:${KOS_CC_BASE}/bin:/opt/toolchains/dc/bin"
Any help would be greatly appreciated.

Thanks for your time.

Re: I've hit a roadblock building kOS, DC toolchain on Maver

Posted: Wed Sep 24, 2014 2:13 am
by ac3t1ne
http://dcemulation.org/phpBB/viewtopic. ... 9&t=102800

I copied PH3NOM's instructions further down the thread and my KOS set up just fine, (just remember to get and compile kos-ports as well).

I don't know enough to help you out specifically but I think those are the best instructions on the internet :lol:

Re: I've hit a roadblock building kOS, DC toolchain on Maver

Posted: Wed Sep 24, 2014 1:56 pm
by stevepdp
Thanks ac3t1ne, I'm reading through the thread.

One thing that's just occurred to me is that I too removed the objective C lines from the dc-chain Makefile, which is probably that particular compile went smoothly.

I'll keep the thread posted, thanks again :-)

Re: I've hit a roadblock building kOS, DC toolchain on Maver

Posted: Thu Sep 25, 2014 1:17 pm
by stevepdp
Here's a run down of recent events.

I tried once again building kOS from scratch, and I ended up in a similar state where I was missing dc-tool and the /opt/toolchains/dc/bin directory. I then thought "I wonder if it'll make any difference building this on an Ubuntu 14.04 box". Of course, I ended up with a build in an almost identical state to the Mac. These were the instructions I borrowed from.

I then looked around for more information about dc-tool, and I learned that the kOS devs actually already have a repo for it here. Somehow I missed that earlier...

The clues were all here.

Code: Select all

git clone git://cadcdev.git.sourceforge.net/gitroot/cadcdev/dcload-ip
Of course, I was smiling at this point because dc-tool built on Linux with no errors. I note that apt conveniently has -dev packages, unlike homebrew. If I understand them correctly, then the -dev packages are providing header files for the compilation. I haven't yet tested dc-tool against the Dreamcast on Linux, but I was able to at least execute it and read the help info.

So far so good.

Now, I'm sitting in front of my Mac trying to achieve the same thing. I've pulled down the dc-tool sources and tried running make. The following is the tail end of the compilation error:

Code: Select all

Silver:dcload-ip stevepdp$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C host-src
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tool
gcc -O2 -DDCLOAD_VERSION=\"1.0.5\" -DDREAMCAST_IP=\"0.0.0.0\" -DHAVE_GETOPT  -o dc-tool.o -c dc-tool.c
dc-tool.c:25:10: fatal error: 'libelf.h' file not found
#include <libelf.h>
         ^
1 error generated.
make[2]: *** [dc-tool.o] Error 1
make[1]: *** [tool] Error 2
make: *** [host-src] Error 2
Alright, pretty obvious what's wrong here then. Homebrew hasn't pulled down the libelf.h header file. I was expecting that to come with the libelf package.

So close now!

Re: I've hit a roadblock building kOS, DC toolchain on Maver

Posted: Thu Sep 25, 2014 1:52 pm
by stevepdp
Thanks to the find tool, I've learned that homebrew left libelf.h at:

Code: Select all

/usr/local/Cellar/libelf/0.8.13/include/libelf/libelf.h
I've symlinked it to /usr/include/libelf.h, and low and behold dc-tool 1.0.5 is now building successfully on the Mac!

I now just need to put the binary where $KOS_LOADER expects it to be, then this setup should be complete. The only challenge now is setting up the whole environment with an IDE. But that's a battle for later this evening. I'm going to take a few of those kOS examples for a spin now :-)

Marking this post solved.

Edit: Just tested 'dc-tool -x' with the HIT-400 and the example projects are uploading smoothly.