DC-chain / Kos 2.0 Installation Errors

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.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

DC-chain / Kos 2.0 Installation Errors

Post by PH3NOM »

Whats up guys.

I have not touched and code on DC for the last month or so, ever since I installed my new OS and have not yet re-installed the DC tool chain.

Since Dev Iso R4 is no longer hosted on this site, I decided to break down and install kos 2.0 from the ground up.

First, I installed Cygwin.

Next, I downloaded kos 2.0, newlib-2.0, gcc-4.7.3, and binutils-2.23.2. To be certain, the newlib version I am using is "newlib-linaro-2.0.0-2013.06.tar".

Running the kos/utils/dc-chain makefile, the patch seems to run fine, but it fails to build-sh4.
Image

Any help will be appreciated!
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

Just remove -j4 from makejobs variable in Makefile. I think it help you, I'm build all fine.

I say the problem is more serious :)
After build the KOS on gcc 4.8.2 it works very not stably... setting video mode broken and maybe even a problem with mutex/thread (but I'm not sure yet).
When DC connected to composite cable, then why in this place, a condition that is triggered cable VGA, so the video only works with VGA connection:

Code: Select all

    /* If we're on a VGA box, disable vertical smoothing */
    if(vid_mode->cable_type == CT_VGA) {
        dbglog(DBG_KDEBUG, "pvr: disabling vertical scaling for VGA\n");

        if(pvr_state.fsaa)
            PVR_SET(PVR_SCALER_CFG, 0x10400);
        else
            PVR_SET(PVR_SCALER_CFG, 0x400);
    }
    else {
        dbglog(DBG_KDEBUG, "pvr: enabling vertical scaling for non-VGA\n");

        if(pvr_state.fsaa)
            PVR_SET(PVR_SCALER_CFG, 0x10401);
        else
            PVR_SET(PVR_SCALER_CFG, 0x401);
    }
I don't touch anything, kos does it himself.
I think variable vid_mode is crashed on some place. And not only it global variable...
Last edited by SWAT on Thu Dec 05, 2013 9:24 pm, edited 2 times in total.
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

Well, first of all, you're not using an official version of newlib. I have no idea if that particular tarball you've downloaded has changed anything significant, but I wouldn't necessarily want to chance it. Get the real version of newlib, which the download.sh script in dc-chain will do for you (or at least point you to the right place to get it).

Second, there's a known issue with the bfd.texinfo file (which is actually why your build is failing) and newer versions of the tool used with it. This was discussed in this topic recently, and the solution is in this post specifically. To save you from having to click on the link, here's that post:
BlueCrab wrote:That's a bug in the binutils texinfo files. I never build them with my builds, so I had never noticed that issue...

Re-run the unpack.sh script, then run the following two commands before doing the make:

Code: Select all

sed -e 's/ @colophon/ @@colophon/' -e 's/doc@cygnus.com/doc@@cygnus.com/' binutils-2.23.2/bfd/doc/bfd.texinfo > binutils-2.23.2/bfd/doc/bfd.texinfo2
mv binutils-2.23.2/bfd/doc/bfd.texinfo2 binutils-2.23.2/bfd/doc/bfd.texinfo
This will be fixed in the git when I update the dc-chain Makefile again.
As stated in that post, it is fixed on the git repository, so any future releases of KOS (after 2.0.0) won't have that problem. :wink:
Just to be clear, this has nothing to do with using multiple jobs for make or with any GCC 4.8.x related bugs (which I haven't seen any of myself, but that's beside the point anyway, since you're not using GCC 4.8.x).
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

Sorry for offtopic, I'm just saying of bug in 4.8.2 for you BlueCrab. You use it by default in dc-chain.
With 4.7.3 I'm not have this bug.
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

Someone else was reporting a similar issue with trying to use PAL50 modes and it deciding to use VGA instead, but I'm pretty sure that this person wasn't trying to use GCC 4.8.x. That was covered in this topic. Eventually he got everything working, but I dunno what he did to fix it. I'm guessing something got built wrong somewhere along the way, and rebuilding the toolchain fixed it for him.

That said, yes, the Git version of KOS has 4.8.2 as the GCC version, and it works fine for me. I haven't had any issues using it thus far, and being that the other person who has reported a similar problem wasn't using 4.8.x, I'm going to guess there's something else wrong that isn't related to GCC itself.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

Possible. With video modes have any strange problems for a long time, after start using 4.x in principle. This problem is very difficult to catch. May want to disable some optimizations?
As far as I understood from this topic, he eventually build it up on the old compilers of DCDev r4...
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

It was my understanding that he got a newer compiler working, since he said that went OK on his machine itself, just not in a VM.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

Do not you think it is very strange? :)
I have tried to build code under linux and under cygwin, no difference. And how can there be a virtual machine is to blame I do not understand. I think he did something on that he did not pay attention unfortunately... Perhaps when linking something to interchange places for object files/libs or something. It's not fix a problem, it's just fortune.
Image
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

I'm just compile example on 4.8.2...

Code: Select all

thd: pre-emption enabled, HZ=100
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
  DMA Buffer at ac0b7fe0
vid_set_mode: 640x480 NTSC
fs_romdisk: mounting image at 0x8c0419b8 at /rd
dc-load console support enabled
maple: attached devices:
  B0: Dreamcast Controller          (01000000: Controller)
  B1: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
  B2: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
Use the DPAD to move the modifier square around (it starts at (320, 240))
Press Start to exit.
pvr: disabling vertical scaling for VGA
kmg_to_img: file '/rd/fruit.kmg' is incompatible:
   magic 00474d4b version 0 platform 1
Failed to load /rd/fruit.kmg
arch: shutting down kernel
maple: final stats -- device count = 3, vbl_cntr = 20, dma_cntr = 18
vid_set_mode: 640x480 NTSC
fs_romdisk: unmounting image at 0x8c0419b8 from /rd
Aaaaand 2 errors!
"disabling vertical scaling for VGA" (DC uses composite cable! Why he thinks that the cable VGA?)
"file '/rd/fruit.kmg' is incompatible" (Why it's hapen?)

I think that the network stack do not work for me for the same reason, since version 4.5.2.
I talked about this 2 year ago, I still have not found cause.
This is a complex glitch cause must be sought not in the specific code...
I have attached two examples, please try them on your hardware.
Attachments
examples.7z
(719.28 KiB) Downloaded 134 times
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

For the time being, I've rolled back the GCC version used by dc-chain in the git repository until I have a chance to actually sit down and investigate what's going on.
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

So, the problem about fruit.kmg being incompatible is actually an issue with an incompatibility between your host machine (PC) compiler and the code for vqenc. Basically, that particular tool assumes that you're using a machine where sizeof(unsigned long) == 4 and sizeof(unsigned int) == 4. This would not be true on a 64-bit machine compiling 64-bit binaries. I've fixed that in the git repository.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: DC-chain / Kos 2.0 Installation Errors

Post by PH3NOM »

BlueCrab wrote:Well, first of all, you're not using an official version of newlib. I have no idea if that particular tarball you've downloaded has changed anything significant, but I wouldn't necessarily want to chance it. Get the real version of newlib, which the download.sh script in dc-chain will do for you (or at least point you to the right place to get it).

Second, there's a known issue with the bfd.texinfo file (which is actually why your build is failing) and newer versions of the tool used with it. This was discussed in this topic recently, and the solution is in this post specifically. To save you from having to click on the link, here's that post:
BlueCrab wrote:That's a bug in the binutils texinfo files. I never build them with my builds, so I had never noticed that issue...

Re-run the unpack.sh script, then run the following two commands before doing the make:

Code: Select all

sed -e 's/ @colophon/ @@colophon/' -e 's/doc@cygnus.com/doc@@cygnus.com/' binutils-2.23.2/bfd/doc/bfd.texinfo > binutils-2.23.2/bfd/doc/bfd.texinfo2
mv binutils-2.23.2/bfd/doc/bfd.texinfo2 binutils-2.23.2/bfd/doc/bfd.texinfo
This will be fixed in the git when I update the dc-chain Makefile again.
As stated in that post, it is fixed on the git repository, so any future releases of KOS (after 2.0.0) won't have that problem. :wink:
Just to be clear, this has nothing to do with using multiple jobs for make or with any GCC 4.8.x related bugs (which I haven't seen any of myself, but that's beside the point anyway, since you're not using GCC 4.8.x).
Thanks for the responses guys!

You are right as usual Mr. BlueCrab! Everything seems to be building right now. With any luck, I will post back later when I actually get to compiling some code under the new tool chain.

EDIT #1:
It seems to have hit another snag, specifically during build-sh4-gcc-pass2
Image
I have gotten things to work by disabling the objective c support
Line 56 in the Makefile, I had to change this

Code: Select all

pass2_languages=c,c++,objc,obj-c++
to

Code: Select all

pass2_languages=c,c++
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

PH3NOM, Cygwin seems to have all kinds of nasty issues lately for some reason. That said, I haven't actually tried compiling 4.7.3 on Cygwin, but I did build 4.8.2 with it and it seemed to work without issue. Of course, unless you're planning on using Objective C, you're fine just working around it in the way you did. :wink:

Onto SWAT's issue... So, I'm pretty sure I have that VGA detection issue sorted out as well. I realized after I posted that I hadn't had any issues that I was running my DC off of a VGA box every time I've tested it with 4.8.2. So, I hooked it up via a composite cable and, sure enough, ran into the same bug. Anyway, it was a really silly issue, and thus easily fixed. Basically, there's a function that detects the video cable type attached by reading some registers. Well, those reads should have been done through a volatile pointer, which wasn't the case in the code. So, I fixed that and the problem disappeared. This might well have fixed that other person's issue too, although I suppose unless he comes back, we'll never know. :roll:
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: DC-chain / Kos 2.0 Installation Errors

Post by PH3NOM »

Had another tool chain error, on the fixup phase it threw an error about permission denied.
The solution was to run the Cygwin terminal as administrator, as I am using Windows 8.

Now, I have successfully built the dc-chain, and set the

Code: Select all

. ./environ.sh
based on the /doc/environ.sh.sample but edited for my working directory.

Attempting to build KOS begins nicely, but then throws an error when it gets to building the sound code:
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

64-bit Cygwin seems to be quite unstable. I'd recommend not using a 64-bit version of Cygwin until they fix the various problems it seems to have. See this topic for other issues that seem to happen earlier in the process on a 64-bit Cygwin.

If you want specifics of what to install in a 32-bit Cygwin to make things work, I posted what worked for me in this post. Mind you, I didn't actually use this Cygwin toolchain beyond compiling KOS (it was built on a machine at my work, so I didn't have a Dreamcast around to test it out more thoroughly), but it did work for building KOS when I used a 32-bit version of Cygwin.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: DC-chain / Kos 2.0 Installation Errors

Post by PH3NOM »

BlueCrab wrote:64-bit Cygwin seems to be quite unstable. I'd recommend not using a 64-bit version of Cygwin until they fix the various problems it seems to have. See this topic for other issues that seem to happen earlier in the process on a 64-bit Cygwin.

If you want specifics of what to install in a 32-bit Cygwin to make things work, I posted what worked for me in this post. Mind you, I didn't actually use this Cygwin toolchain beyond compiling KOS (it was built on a machine at my work, so I didn't have a Dreamcast around to test it out more thoroughly), but it did work for building KOS when I used a 32-bit version of Cygwin.
Okay, since this has been a logistical nightmare regarding 32bit/64bit, and I just got things working, I will post my own tutorial for how to build a working KOS 2.0 Dreamcast Tool Chain / Compiler.

Image

1.) Install Cygwin 32bit, setup-x86.exe from here http://cygwin.com/install.html
1.a) Click next twice, making sure to install from internet.
1.b) Chose install directory. I chose d:\cygwin. Click next.
1.c) Chose download directory. Does not effect install directory. Click next 3 times.
1.d) Chose packages to install. I chose Devel, Libs, and Utils. Your screen should look like this:
Image
1.e) Click next. When the download and install is completed ( this can take some time ), Cygwin should be good to go.

2.) Run 32bit Cygwin Terminal as administrator
Image

3.) Download kos-2.0.0-src.tar.gz from here http://sourceforge.net/projects/cadcdev ... ios/2.0.0/
3.a) Create a folder /dc/ in your /Cygwin/usr/local/ folder
3.b) Create a folder /kos/ in your /Cygwin/usr/local/dc/ folder
3.c) Extract the contents of /kos-2.0.0-src/ into your /Cygwin/usr/local/dc/kos/ folder

4.) Install the DC-Chain
4.a) Download this patch I made thanks to BlueCrab and extract into your dc-chain folder
dc-chain-kos-2.0.zip
Makefile and patch for building KOS 2.0 on Cygwin 32bit / Windows 8
(3.5 KiB) Downloaded 382 times
4.b) In cygwin, navigate to your dc-chain folder. Since I installed the chain on my d:, my command is

Code: Select all

cd d:/cygwin/usr/local/dc/kos/utils/dc-chain
4.c) Download the libs needed by dc-chain by running the script with this command:

Code: Select all

./download.sh
4.d) Extract the libs needed by dc-chain by running the script with this command:

Code: Select all

./unpack.sh
4.e) Patch the default kos install by running the script with this command:

Code: Select all

./patch.sh
4.f) Build the dc-chain with this command

Code: Select all

make
5.) Configure the environment and compile KOS
5.a) Download this environ.sh and extract into your /Cygwin/usr/local/dc/kos/ folder
environ.sh.rar
eniron.sh for building kos 2.0
(1.4 KiB) Downloaded 285 times
5.b) Navigate to your kos directory in Cygwin. Since I installed the chain on my d:, my command is

Code: Select all

cd d:/cygwin/usr/local/dc/kos
5.c) Configure your environment by running this command:

Code: Select all

. ./environ.sh
5.d) Build KOS by running the command

Code: Select all

make
That's All! When kos is built, you are ready to start compiling your own code for the Dreamcast using Kos 2.0 and GCC 4.7.3.

I hope that helps!
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: DC-chain / Kos 2.0 Installation Errors

Post by SWAT »

BlueCrab wrote:Well, those reads should have been done through a volatile pointer, which wasn't the case in the code.
I thought so :) Thanks! But I think that this is not the end of gcc 4.8.3 bugs features ;)
I'll let you know if I find out something else.
Image
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

SWAT wrote:
BlueCrab wrote:Well, those reads should have been done through a volatile pointer, which wasn't the case in the code.
I thought so :) Thanks! But I think that this is not the end of gcc 4.8.3 bugs features ;)
I'll let you know if I find out something else.
Yeah... I wouldn't be surprised if there aren't other places in the code that have the same problem. In fact, I'd actually be very surprised if there wasn't at least one other place where such things are happening. :lol:
HUCAST
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 15
Joined: Mon Feb 09, 2015 9:06 am
Has thanked: 0
Been thanked: 0

Re: DC-chain / Kos 2.0 Installation Errors

Post by HUCAST »

Where can I download dc-chain?

What I don't understand with DC development is how there is no real SDK for it, I mean like KOS but only 1 kit packed together with everything needes to make a DC game + a Manual (How to make a code a DC game)

It would make DC dev'ing way more handy.
Last edited by HUCAST on Thu Feb 12, 2015 2:40 pm, edited 1 time in total.
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: DC-chain / Kos 2.0 Installation Errors

Post by BlueCrab »

It's included in KOS -- in utils/dc-chain.
Post Reply