DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Thu Sep 18, 2014 10:49 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun Nov 20, 2011 9:33 am 
Offline
Mental DCEmu
Mental DCEmu
User avatar

Joined: Wed Mar 30, 2011 10:13 am
Posts: 308
Todays I've met a problem while installing KOS on new Cygwin installation.
I've downloaded cygwin with all needed packets, then I've downloaded Kos and kos ports from svn repository.
The problems started when:
Dc-chain:
1. I tried to run download.sh
It has an mistake in a script, because version 2.20 of binutils were succesfully removed from repository, and now placed with some alpha versions (2.20.1a). So I downloaded needed packets by myself, I've choosen version 2.8 for installation.
2. After unpacking all needed archives, I met next problem: make didn't work. So I asked SWAT and he tells that I need a 'patch utility'. I've installed patch and by now I still have an errors with 'make'.

Can any of you write the full list of needed actions, in order, of what I exactly need to do to install (and compile) KOS on my new cygwin installation and what packets may I need, using the latest versions of newlib, gcc, and binutils.
Image
Thank you.

Add:: my makefile, i've slightly modified it, dunno right or wrong, please take a look at first strings, maybe I've made a mistake somewhere, maybe it need some other changes?
Code:
#!/bin/bash
# Dreamcast toolchain makefile    by Jim Ursetto
# adapted from Stalin's build script version 0.3
#
# Interesting parameters:
# erase=0|1                     Erase build directories on the fly to save space
# thread_model=posix|single|kos Set gcc threading model
# verbose=0|1                   Display 
#
# Interesting targets (you can 'make' any of these):
# all: patch build
# patch: patch-gcc patch-newlib patch-kos
# build: build-sh4 build-arm
# build-sh4: build-sh4-binutils build-sh4-gcc
# build-arm: build-arm-binutils build-arm-gcc
# build-sh4-gcc: build-sh4-gcc-pass1 build-sh4-newlib build-sh4-gcc-pass2
# build-arm-gcc: build-arm-gcc-pass1
# build-sh4-newlib: build-sh4-newlib-only fixup-sh4-newlib
# gdb
# insight

# User configuration
sh_target=sh-elf
arm_target=arm-elf
sh_prefix  := usr/local/dc/kos/kos/utils/dc-chain/$(sh_target)
arm_prefix := usr/local/dc/kos/kos/utils/dc-chain/$(arm_target)
# kos_root: KOS subversion root (contains kos/ and kos-ports/)
kos_root= /usr/local/dc/kos/
# kos_base: equivalent of KOS_BASE (contains include/ and kernel/)
kos_base=$(kos_root)/kos
binutils_ver=2.9
gcc_ver=4.5.2
newlib_ver=1.19.0
gdb_ver=6.7.1
insight_ver=6.7.1
# With GCC 4.x versions, the patches provide a kos thread model, so you should
# use it. With 3.4.6, you probably want posix here. If you really don't want
# threading support for C++ (or Objective C/Objective C++), you can set this to
# single (why you would is beyond me, though).
thread_model=kos
erase=0
verbose=1
# Set the languages to build for pass 2 of building gcc for sh-elf. The default
# here is to build C, C++, Objective C, and Objective C++. You may want to take
# out the latter two if you're not worried about them and/or you're short on
# hard drive space.
pass2_languages=c,c++

# Makefile variables
install=$(prefix)/bin
pwd := $(shell pwd)
patches := $(pwd)/patches
logdir := $(pwd)/logs
PATH := $(sh_prefix)/bin:$(arm_prefix)/bin:$(PATH)
binutils_dir=binutils-$(binutils_ver)
gcc_dir=gcc-$(gcc_ver)
newlib_dir=newlib-$(newlib_ver)

all: patch build

# ---- patch {{{
binutils_patches    := $(wildcard $(patches)/binutils-$(binutils_ver)*.diff)
gcc_patches    := $(wildcard $(patches)/gcc-$(gcc_ver)*.diff)
newlib_patches := $(wildcard $(patches)/newlib-$(newlib_ver)*.diff)
kos_patches    := $(wildcard $(patches)/kos-*.diff)

patch_targets=patch-binutils patch-gcc patch-newlib patch-kos

patch: $(patch_targets)
patch-binutils: $(binutils_patches)
patch-gcc: $(gcc_patches)
patch-newlib: $(newlib_patches)
patch-kos: $(kos_patches)

$(newlib_patches):
   cd $(newlib_dir); patch -p1 < $@

$(binutils_patches):
   cd $(binutils_dir); patch -p1 < $@

$(gcc_patches):
   cd $(gcc_dir); patch -p1 < $@

$(kos_patches):
   cd $(kos_root); patch -p1 < $@

# ---- }}}

# ---- build {{{

build: build-sh4 build-arm
build-sh4: build-sh4-binutils build-sh4-gcc
build-arm: build-arm-binutils build-arm-gcc
build-sh4-gcc: build-sh4-gcc-pass1 build-sh4-newlib build-sh4-gcc-pass2
build-arm-gcc: build-arm-gcc-pass1
   $(clean_arm_hack)
build-sh4-newlib: build-sh4-newlib-only fixup-sh4-newlib

# Ensure that, no matter where we enter, prefix and target are set correctly.
build_sh4_targets=build-sh4-binutils build-sh4-gcc build-sh4-gcc-pass1 build-sh4-newlib build-sh4-newlib-only build-sh4-gcc-pass2
build_arm_targets=build-arm-binutils build-arm-gcc build-arm-gcc-pass1
$(build_sh4_targets): prefix = $(sh_prefix)
$(build_sh4_targets): target = $(sh_target)
$(build_sh4_targets): extra_configure_args = --with-multilib-list=m4-single-only,m4-nofpu,m4 --with-endian=little --with-cpu=m4-single-only
$(build_arm_targets): prefix = $(arm_prefix)
$(build_arm_targets): target = $(arm_target)
$(build_arm_targets): extra_configure_args = --with-arch=armv4

# To avoid code repetition, we use the same commands for both
# architectures.  But we can't create a single target called
# build-binutils for both sh4 and arm, because phony targets
# can't be run multiple times.  So we create multiple targets.
build_binutils     = build-sh4-binutils  build-arm-binutils
build_gcc_pass1    = build-sh4-gcc-pass1 build-arm-gcc-pass1
build_newlib       = build-sh4-newlib-only
build_gcc_pass2    = build-sh4-gcc-pass2

# Here we use the essentially same code for multiple targets,
# differing only by the current state of the variables below.
$(build_binutils): build = build-binutils-$(target)-$(binutils_ver)
$(build_binutils): src_dir = binutils-$(binutils_ver)
$(build_binutils): log = $(logdir)/$(build).log
$(build_binutils): logdir
   @echo "+++ Building $(src_dir) to $(build)..."
   -mkdir -p $(build)
   > $(log)
   cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --enable-install-libbfd $(to_log)
   make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
   $(clean_up)

$(build_gcc_pass1) $(build_gcc_pass2): build = build-gcc-$(target)-$(gcc_ver)
$(build_gcc_pass1) $(build_gcc_pass2): src_dir = gcc-$(gcc_ver)
$(build_gcc_pass1): log = $(logdir)/$(build)-pass1.log
$(build_gcc_pass1): logdir
   @echo "+++ Building $(src_dir) to $(build) (pass 1)..."
   -mkdir -p $(build)
   > $(log)
   cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) $(to_log)
   make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)

$(build_newlib): build = build-newlib-$(target)-$(newlib_ver)
$(build_newlib): src_dir = newlib-$(newlib_ver)
$(build_newlib): log = $(logdir)/$(build).log
$(build_newlib): logdir
   @echo "+++ Building $(src_dir) to $(build)..."
   -mkdir -p $(build)
   > $(log)
   cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(extra_configure_args) $(to_log)
   make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
   $(clean_up)

fixup-sh4-newlib: newlib_inc=$(DESTDIR)$(sh_prefix)/$(sh_target)/include
fixup-sh4-newlib:
   @echo "+++ Fixing up sh4 newlib includes..."
# KOS pthread.h is modified
# to define _POSIX_THREADS
# pthreads to kthreads mapping
# so KOS includes are available as kos/file.h
# kos/thread.h requires arch/arch.h
# arch/arch.h requires dc/video.h
   cp $(kos_base)/include/pthread.h $(newlib_inc)
   cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys
   cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys
   ln -nsf $(kos_base)/include/kos $(newlib_inc)
   ln -nsf $(kos_base)/kernel/arch/dreamcast/include/arch $(newlib_inc)
   ln -nsf $(kos_base)/kernel/arch/dreamcast/include/dc   $(newlib_inc)

$(build_gcc_pass2): log = $(logdir)/$(build)-pass2.log
$(build_gcc_pass2): logdir
   @echo "+++ Building $(src_dir) to $(build) (pass 2)..."
   -mkdir -p $(build)
   > $(log)
   cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib --disable-libssp --disable-tls \
      --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) $(to_log)
   make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
   $(clean_up)

# ---- }}}}


# GDB building

gdb-$(gdb_ver).tar.bz2:
   @echo "+++ Downloading GDB..."
   wget -c ftp://ftp.gnu.org/gnu/gdb/gdb-$(gdb_ver).tar.bz2

unpack_gdb: gdb-$(gdb_ver).tar.bz2 unpack_gdb_stamp

unpack_gdb_stamp:
   @echo "+++ Unpacking GDB..."
   rm -f $@
   rm -rf gdb-$(gdb_ver)
   tar jxf gdb-$(gdb_ver).tar.bz2
   touch $@

build_gdb: log = $(logdir)/gdb-$(gdb_ver).log
build_gdb: logdir
build_gdb: unpack_gdb build_gdb_stamp

build_gdb_stamp:
   @echo "+++ Building GDB..."
   rm -f $@
   > $(log)
   rm -rf build-gdb-$(gdb_ver)
   mkdir build-gdb-$(gdb_ver)
   cd build-gdb-$(gdb_ver); ../gdb-$(gdb_ver)/configure \
       --prefix=$(sh_prefix) \
       --target=$(sh_target) $(to_log)
   make -C build-gdb-$(gdb_ver) $(to_log)
   touch $@

install_gdb: log = $(logdir)/gdb-$(gdb_ver).log
install_gdb: logdir
install_gdb: build_gdb install_gdb_stamp

install_gdb_stamp:
   @echo "+++ Installing GDB..."
   rm -f $@
   make -C build-gdb-$(gdb_ver) install DESTDIR=$(DESTDIR) $(to_log)
   touch $@

gdb: install_gdb


# INSIGHT building

insight-$(insight_ver).tar.bz2:
   @echo "+++ Downloading INSIGHT..."
   wget -c ftp://sourceware.org/pub/insight/releases/insight-$(insight_ver).tar.bz2

unpack_insight: insight-$(insight_ver).tar.bz2 unpack_insight_stamp

unpack_insight_stamp:
   @echo "+++ Unpacking INSIGHT..."
   rm -f $@
   rm -rf insight-$(insight_ver)
   tar jxf insight-$(insight_ver).tar.bz2
   touch $@

build_insight: log = $(logdir)/insight-$(insight_ver).log
build_insight: logdir
build_insight: unpack_insight build_insight_stamp

build_insight_stamp:
   @echo "+++ Building INSIGHT..."
   rm -f $@
   > $(log)
   rm -rf build-insight-$(insight_ver)
   mkdir build-insight-$(insight_ver)
   cd build-insight-$(insight_ver); ../insight-$(insight_ver)/configure \
       --prefix=$(sh_prefix) \
       --target=$(sh_target) $(to_log)
   make -C build-insight-$(insight_ver) $(to_log)
   touch $@

install_insight: log = $(logdir)/insight-$(insight_ver).log
install_insight: logdir
install_insight: build_insight install_insight_stamp

install_insight_stamp:
   @echo "+++ Installing INSIGHT..."
   rm -f $@
   make -C build-insight-$(insight_ver) install DESTDIR=$(DESTDIR) $(to_log)
   touch $@

insight: install_insight


# ---- support {{{

clean:
   -rm -rf build-newlib-$(sh_target)-$(newlib_ver)
   -rm -rf build-newlib-$(arm_target)-$(newlib_ver)
   -rm -rf build-gcc-$(sh_target)-$(gcc_ver)
   -rm -rf build-gcc-$(arm_target)-$(gcc_ver)
   -rm -rf build-binutils-$(sh_target)-$(binutils_ver)
   -rm -rf build-binutils-$(arm_target)-$(binutils_ver)
   -rm -rf build-gdb-$(gdb_ver) install_gdb_stamp build_gdb_stamp
   -rm -rf build-insight-$(gdb_ver) install_insight_stamp build_insight_stamp

logdir:
   @mkdir -p $(logdir)

# If erase=1, erase build directories on the fly.
ifeq (1,$(erase))
  define clean_up
    @echo "+++ Cleaning up $(build)..."
    -rm -rf $(build)
  endef
  # Hack to clean up ARM gcc pass 1
  define clean_arm_hack
    @echo "+++ Cleaning up build-gcc-$(arm_target)-$(gcc_ver)..."
    -rm -rf build-gcc-$(arm_target)-$(gcc_ver)
  endef
endif

# If verbose=1, display output to screen as well as log files
ifeq (1,$(verbose))
  to_log = 2>&1 | tee -a $(log)
else
  to_log = >> $(log) 2>&1
endif

# ---- }}}

# ---- phony targets {{{

.PHONY: $(patch_targets)
.PHONY: $(newlib_patches) $(binutils_patches) $(gcc_patches) $(kos_patches)
.PHONY: all build patch build-sh4 build-arm $(build_sh4_targets) $(build_arm_targets) clean
.PHONY: build-binutils build-newlib build-gcc-pass1 build-gcc-pass2 fixup-sh4-newlib
.PHONY: gdb install_gdb build_gdb unpack_gdb
.PHONY: insight install_insight build_insight unpack_insight

# ---- }}}}

# vim:tw=0:fdm=marker:fdc=2:fdl=1

_________________
How do I try to build a Dreamcast toolchain:
Image


Top
 Profile  
 
PostPosted: Sun Nov 20, 2011 6:55 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
RyoDC wrote:
1. I tried to run download.sh
It has an mistake in a script, because version 2.20 of binutils were succesfully removed from repository, and now placed with some alpha versions (2.20.1a). So I downloaded needed packets by myself, I've choosen version 2.8 for installation.


Holy crap, Dude!! :o

Why did you decide to go with such an ANCIENT version of binutils?? If 2.20 isn't available, just use 2.20.1 or maybe 2.21.1. You DO realize 2.8 is from 1997, right? :lol: I don't think it would work with any recent version of gcc at all!


Top
 Profile  
 
PostPosted: Mon Nov 21, 2011 4:08 am 
Offline
Mental DCEmu
Mental DCEmu
User avatar

Joined: Wed Mar 30, 2011 10:13 am
Posts: 308
So, lower the index, newer the version, or what?

_________________
How do I try to build a Dreamcast toolchain:
Image


Top
 Profile  
 
PostPosted: Mon Nov 21, 2011 11:21 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
RyoDC wrote:
So, lower the index, newer the version, or what?


:facepalm:

Larger numbers == later versions... EVERYONE knows that!

"Firefox 1 is OBVIOUSLY newer the Firefox 7!" :roll: :lol:

Sorry, just had to get that out of my system. If you had any doubts, you could have looked at the dates the files were uploaded given on the same line as the filename.

Anywho, the first number before any decimal point is called the MAJOR VERSION NUMBER; the number after the first decimal point is called the MAJOR REVISION NUMBER; the number after the second decimal point (not always present) is called the MINOR REVISION NUMBER. There might also be a BUILD NUMBER in place of the minor revision. Numbers increase to show a newer version, with the numbers below the increasing number resetting as it increases.

Examples of increasing releases:
Project A
0.1
0.2
0.5
1.0
1.1
1.7

Project B
1.0.1
1.0.5
1.1.0
1.1.8
1.1.10
1.1.13
1.2.2

Project C
0.0.31
0.1.15
0.3.983
0.4.0
0.7.101
0.7.102
1.0.0
1.0.883
1.1.57

Project D
1
2
3
4
5
7


Top
 Profile  
 
PostPosted: Mon Nov 21, 2011 1:00 pm 
Offline
Mental DCEmu
Mental DCEmu
User avatar

Joined: Wed Mar 30, 2011 10:13 am
Posts: 308
Damn man are you joking at me??? Of course I know that shit too. But what the way did you decided that version 2.8.0 is not older then 2.2.0? Can't stand this, sorry.
Not 2.0.8, 2.8.0!!!

"i've got that nerd rage..."

Quote:
Sorry, just had to get that out of my system. If you had any doubts, you could have looked at the dates the files were uploaded given on the same line as the filename.

Damn they were unsorted sorry man, hate hate them

Anyway, that shit doesn't seem to be working. even when i have uploaded swat compilers, it's not going to bring me anywhere.

Image

_________________
How do I try to build a Dreamcast toolchain:
Image


Top
 Profile  
 
PostPosted: Tue Nov 22, 2011 9:56 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
What confuses you about 2.20 being newer than 2.8. Not 2.2.0, 2.20!! :grin:

I think you read that script wrong way back at the start - the script in no way used 2.2.0, but 2.20. NO ONE would use 2.2.0 these days! How old 2.2.0 would be should have tipped you off that you were reading it wrong. :wink:


Top
 Profile  
 
PostPosted: Tue Nov 22, 2011 11:18 am 
Offline
Mental DCEmu
Mental DCEmu
User avatar

Joined: Wed Mar 30, 2011 10:13 am
Posts: 308
Yeah man, you're right. Just've worked 'bout 12 hours and didn't mentioned that (eyes were too tired).
Anyway, after I past these step, I dunno how to get my cygwin system to work.
I don't understand the principles of how this stuff get to work.
As far as I understand, to compile progs on KOS i just need: 1. Linux environment (shell, commands, fs, system calls compatibility, architecture) 2. Compiler for SH4 microprocessors (GCC in our case) 3. KOS headers and libraries 4. Way to put this all in one working chain.
Dunno what I do wrong, I'm lack of information, but I can't get the 4 item, to put it on.

Well, maybe this helps me to set out the compiler: http://gcc.gnu.org/install/configure.html

What is newlib? How the KOS patch it?

_________________
How do I try to build a Dreamcast toolchain:
Image


Top
 Profile  
 
PostPosted: Tue Nov 22, 2011 11:57 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
RyoDC wrote:
Yeah man, you're right. Just've worked 'bout 12 hours and didn't mentioned that (eyes were too tired).


No problem - we've ALL been there before. :grin:

Quote:
Anyway, after I past these step, I dunno how to get my cygwin system to work.
I don't understand the principles of how this stuff get to work.
As far as I understand, to compile progs on KOS i just need: 1. Linux environment (shell, commands, fs, system calls compatibility, architecture) 2. Compiler for SH4 microprocessors (GCC in our case) 3. KOS headers and libraries 4. Way to put this all in one working chain.
Dunno what I do wrong, I'm lack of information, but I can't get the 4 item, to put it on.

Well, maybe this helps me to set out the compiler: http://gcc.gnu.org/install/configure.html


Have you tried this thread?

viewtopic.php?f=29&t=100843

That shows how to setup the toolchain in Windows on mingw, but it should be nearly the same with cygwin.


Quote:
What is newlib? How the KOS patch it?


Newlib gives you the libc and libm libraries. There is a patch for it for kos in the dc-chain/patches directory. The makefile in dc-chain will patch gcc and newlib as needed using those patches. It's important that you use versions that have patches. For example, in the patches directory you will find a patch for gcc 4.5.2, but not 4.6.1, so don't change the makefile to try to use gcc 4.6.1 as there is no patch for it. Notice the binutils needs no patching.


Top
 Profile  
 
PostPosted: Sun May 20, 2012 11:00 am 
Offline
DCEmu Ex-Mod
DCEmu Ex-Mod
User avatar

Joined: Sun Nov 04, 2001 4:12 pm
Posts: 3549
Location: Hell, Brazil
Simple question, what's the complete list of Cygwin packages necessary for Dreamcast development?

I've already got the latest Cygwin version installed, and would like to get the latest version of KOS in there as well.

_________________
Makaqu engine blog / website.
Image
⇈ ⇊ ⇆ ⇆ B A Start


Top
 Profile  
 
PostPosted: Sun May 27, 2012 3:51 am 
Offline
Mental DCEmu
Mental DCEmu
User avatar

Joined: Wed Mar 30, 2011 10:13 am
Posts: 308
I've seen there those lists of packets, needed for successful building of Dreamcast-related things, but I can't remember where did I saw it :(

_________________
How do I try to build a Dreamcast toolchain:
Image


Top
 Profile  
 
PostPosted: Sun May 27, 2012 5:23 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 78
I think with the next list (and their dependences) will be enough to create your Dreamcast environment:

binutils, bison, crypt, db4.2, expat, flex, gcc4(4.7.2), gcc4-g++, gettext-devel, git,

libgmp-devel (5.1.1-1), libgmp10, libmpfr-devel, (libmpfr1 + libmpfr4),
libmpc-devel, (libmpc1 + libmpc3),

libjpeg-devel, libiconv, libpng12-devel, make, libneon26, patch, patchutils, subversion, termcap, wget, automake, libtool, openssl, openssl-devel, readline, gettext-devel, libxml2

Notice that there are some packets not really necessary (i.e. openssl), but I think it won't hurt you :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group