Help building Kos 2.0/Dc-chain

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.
frozenbinarystudio
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 13
Joined: Wed Aug 17, 2016 2:01 pm
Has liked: 0
Been liked: 0

Help building Kos 2.0/Dc-chain

Post by frozenbinarystudio » Wed Aug 17, 2016 2:31 pm

Hey all.

I have been attempting and failing to build Kos for some time now (about 2 weeks) and I have hit a wall. My apologies for maybe traversing areas already explored but I tried to find the answer on my own and could not.

Please allow me to explain what I have done so far.

First I am using Kos 2.0 (and ports) I downloaded from here if that helps

I started with this post by PH3NOM which got me pretty far in the chain. I followed the instructions, with the addition of adding the --disable-werror flag to the dc-chain makefile as described here. I also had to disable Avast DeepScan as it was running every script in a sandbox (you have no idea how annoying that was).

Problem was this still didn't work! I had to do some more searching and found a Makefile for the dc-chain here that worked (I think... it completed!). The complete Makefile below, with some minor alterations (such as using the default versions of GCC, BinUtils, Newlib the scripts download for you, adding the above flag, only running one worker thread).

All well and good. I go to run the environ.sh script in the kos base dir and ran the top level makefile, only altering the location of my $KOS_BASE to match my installation. I seemed to encounter this issue, least according to the log below. I confirmed I do not have an sh-elf-g++.exe anywhere on my computer, which it is complaining about.

I took BlueCrabs advice and blew away the kos base dir and the opt/toolchains/dc folder in case there were any leftover artifacts from a bad build and encountered the same error using a clean set of sources. I seen reference to conflicting GCC versions which may be my issue (I hope) yet I am too green of a developer to know how to resolve this myself.

Thankfully I kept all the dc-chain logs in addition to saving the logs of the kos base make operation, so feel free to ask for them if required.

I appreciate the documentation on this forum as it has been very helpful to do this on my own. I just wish I could complete the process. It'd be awesome to be able to actually compile some code to push to my DC sometime soon!

kos base make log

Code: Select all

Maple@LAPTOP-4R4BAJ2G ~/dc/kos
$ make
for i in utils libk++ kernel addons ; do make -C $i || exit -1; done
make[1]: Entering directory '/home/Maple/dc/kos/utils'
for i in genromfs wav2adpcm vqenc gba-crcfix; do make -C $i; done
make[2]: Entering directory '/home/Maple/dc/kos/utils/genromfs'
cc -O2 -Wall    -c -o genromfs.o genromfs.c
cc   genromfs.o   -o genromfs
make[2]: Leaving directory '/home/Maple/dc/kos/utils/genromfs'
make[2]: Entering directory '/home/Maple/dc/kos/utils/wav2adpcm'
cc -O2 -Wall     wav2adpcm.c   -o wav2adpcm
make[2]: Leaving directory '/home/Maple/dc/kos/utils/wav2adpcm'
make[2]: Entering directory '/home/Maple/dc/kos/utils/vqenc'
cc -O2 -Wall -DINLINE=inline    -c -o vqenc.o vqenc.c
cc -O2 -Wall -DINLINE=inline    -c -o get_image.o get_image.c
cc -O2 -Wall -DINLINE=inline    -c -o get_image_jpg.o get_image_jpg.c
cc -O2 -Wall -DINLINE=inline    -c -o get_image_png.o get_image_png.c
cc -O2 -Wall -DINLINE=inline    -c -o readpng.o readpng.c
cc -o vqenc vqenc.o get_image.o get_image_jpg.o get_image_png.o readpng.o -lpng -ljpeg -lz -lm
make[2]: Leaving directory '/home/Maple/dc/kos/utils/vqenc'
make[2]: Entering directory '/home/Maple/dc/kos/utils/gba-crcfix'
cc -O2 -Wall -DINLINE=inline    -c -o gba-crcfix.o gba-crcfix.c
cc   gba-crcfix.o   -o gba-crcfix
make[2]: Leaving directory '/home/Maple/dc/kos/utils/gba-crcfix'
make[1]: Leaving directory '/home/Maple/dc/kos/utils'
make[1]: Entering directory '/home/Maple/dc/kos/libk++'
kos-c++   -c mem.cc -o mem.o
/home/Maple/dc/kos/utils/gnu_wrappers/kos-cc: line 50: /opt/toolchains/dc/sh-elf/bin/sh-elf-g++: No such file or directory
make[1]: *** [/home/Maple/dc/kos/Makefile.rules:14: mem.o] Error 127
make[1]: Leaving directory '/home/Maple/dc/kos/libk++'
make: *** [Makefile:23: all] Error 255
dc-chain Makefile

Code: Select all

#!/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
# makejobs=-jn						Set the number of jobs for calls to make to n
#
# 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-eabi
sh_prefix  := /opt/toolchains/dc/$(sh_target)
arm_prefix := /opt/toolchains/dc/$(arm_target)
# kos_root: KOS Git root (contains kos/ and kos-ports/)
kos_root=$(CURDIR)/../../..
# kos_base: equivalent of KOS_BASE (contains include/ and kernel/)
kos_base=$(CURDIR)/../..
binutils_ver=2.23.2
gcc_ver=4.7.3
newlib_ver=2.0.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=1
verbose=1

# Set this value to -jn where n is the number of jobs you want to run with make.
# If you only want one job, just set this to nothing (i.e, "makejobs=").
# Tracking down problems with multiple make jobs is much more difficult than
# with just one running at a time. So, if you run into trouble, then you should
# clear this variable and try again with just one job running.
makejobs=

# 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++,objc,obj-c++
pass2_languages=c,c++

# Change this if you don't have Bash installed in /bin
SHELL = /bin/bash

# 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-arm-libgcc
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-arm-libgcc
$(build_sh4_targets): prefix = $(sh_prefix)
$(build_sh4_targets): target = $(sh_target)
$(build_sh4_targets): thread_model = kos
$(build_sh4_targets): extra_configure_args = --disable-libssp --disable-tls --disable-nls --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): thread_model = posix
$(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
build_arm_libgcc	= build-arm-libgcc

# 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) --disable-werror $(to_log)
	make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
	make -C $(build)/bfd install DESTDIR=$(DESTDIR) $(to_log)
	$(clean_up)

$(build_arm_libgcc): build = build-arm-libgcc
$(build_arm_libgcc): src_dir = gcc-$(gcc_ver)
$(build_arm_libgcc): log = $(logdir)/$(build).log
$(build_arm_libgcc): logdir
	@echo "+++ Building $(src_dir) to $(build)..."
	-mkdir -p $(build)
	> $(log)
	cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror --without-headers \
		--with-newlib --enable-languages=c $(extra_configure_args) $(to_log)
	make -C $(build) all-target-libgcc install-target-libgcc DESTDIR=$(DESTDIR) $(to_log)

$(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) --disable-werror --without-headers \
		--with-newlib --enable-languages=c $(extra_configure_args) $(to_log)
	make -C $(build) all-gcc install-gcc 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) --disable-werror $(to_log)
	make -C $(build) all install CC_FOR_TARGET=$(install)/$(target)-gcc AS_FOR_TARGET=$(install)/$(target)-as \
		LD_FOR_TARGET=$(install)/$(target)-ld AR_FOR_TARGET=$(install)/$(target)-ar \
		RANLIB_FOR_TARGET=$(install)/$(target)-ranlib 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) --disable-werror --with-newlib \
		--enable-threads=$(thread_model) --enable-languages=c,c++,objc,obj-c++ $(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
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 3:58 am

could be a permission error when making /opt/toolchains/, I've seen this problem before.

when you build kos, try doing sudo make instead of just make.

(or if you're on windows, run cygwin as admin)
Still Thinking!~~
111
DCEmu Junior
DCEmu Junior
Posts: 37
Joined: Thu Jul 07, 2016 7:11 pm
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by 111 » Thu Aug 18, 2016 6:20 am

try this guide:
http://www.dcdev.org/howtos/compile-kos.htm

worked (almost) perfectly for me (aside from kos-ports part, you should manually build whatever you want with "make install clean").
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 6:44 am

Would anybody be so kind to make a batch script that does this? I've done this for Linux as you can see in the install guide in the wiki (link in my signature).
I put ph3n0m's guide there for Windows but I can't test it.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: Help building Kos 2.0/Dc-chain

Post by BlueCrab » Thu Aug 18, 2016 9:07 am

You're missing the C++ compiler which means one of two things:

1. The dc-chain Makefile errored out on building the second pass of GCC.
2. The dc-chain Makefile errored out on building Newlib.

Being that you're on Cygwin (otherwise, why would it be looking for .exe files), I'm going to guess it's the latter. Post the log from when it built Newlib (you probably only need like the last 20 lines or so).

If I'm correct that you're on Cygwin, what version of Cygwin are you using? Also, are you using the 32-bit or 64-bit version? I know that the 64-bit version had a lot of bugs in the past, so if you're using it, I'd highly recommend trying with the 32-bit version instead.
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has liked: 0
Been liked: 2 times

Re: Help building Kos 2.0/Dc-chain

Post by Chilly Willy » Thu Aug 18, 2016 11:25 am

And if it gets too hard to build in cygwin, you can always install linux in a virtual environment and build it that way. I know at least one person that did that. It's the only thing they use the VE for - building and using cross-compilers for various retro devices. BlueCrab's done a great job keeping the linux side working - especially with those pesky shells. :grin:
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: Help building Kos 2.0/Dc-chain

Post by BlueCrab » Thu Aug 18, 2016 11:54 am

Chilly Willy wrote:BlueCrab's done a great job keeping the linux side working - especially with those pesky shells. :grin:
Especially since I don't use Linux on a regular basis. :lol:
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 3:42 pm

bogglez wrote:Would anybody be so kind to make a batch script that does this? I've done this for Linux as you can see in the install guide in the wiki (link in my signature).
I put ph3n0m's guide there for Windows but I can't test it.
I've got a tutorial I'm working on that is currently 33 pages long, and 10 of those pages are dedicated to building the tool chain in extreme detail. Both windows and linux :D
Still Thinking!~~
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 3:57 pm

ThePerfectK wrote:
bogglez wrote:Would anybody be so kind to make a batch script that does this? I've done this for Linux as you can see in the install guide in the wiki (link in my signature).
I put ph3n0m's guide there for Windows but I can't test it.
I've got a tutorial I'm working on that is currently 33 pages long, and 10 of those pages are dedicated to building the tool chain in extreme detail. Both windows and linux :D
I'm thinking more among the lines of "I have no idea wtf I'm doing but when I double click this I have a standard development environment with reasonable defaults" for beginners.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: Help building Kos 2.0/Dc-chain

Post by BlueCrab » Thu Aug 18, 2016 4:49 pm

bogglez wrote:
ThePerfectK wrote:
bogglez wrote:Would anybody be so kind to make a batch script that does this? I've done this for Linux as you can see in the install guide in the wiki (link in my signature).
I put ph3n0m's guide there for Windows but I can't test it.
I've got a tutorial I'm working on that is currently 33 pages long, and 10 of those pages are dedicated to building the tool chain in extreme detail. Both windows and linux :D
I'm thinking more among the lines of "I have no idea wtf I'm doing but when I double click this I have a standard development environment with reasonable defaults" for beginners.
We've had things like that in the past. The problem is nobody keeps them up-to-date.

Then we have people complaining about bugs that have long since been fixed or other stupid issues like that... :?
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 4:52 pm

BlueCrab wrote:
bogglez wrote:
ThePerfectK wrote:
bogglez wrote:Would anybody be so kind to make a batch script that does this? I've done this for Linux as you can see in the install guide in the wiki (link in my signature).
I put ph3n0m's guide there for Windows but I can't test it.
I've got a tutorial I'm working on that is currently 33 pages long, and 10 of those pages are dedicated to building the tool chain in extreme detail. Both windows and linux :D
I'm thinking more among the lines of "I have no idea wtf I'm doing but when I double click this I have a standard development environment with reasonable defaults" for beginners.
We've had things like that in the past. The problem is nobody keeps them up-to-date.

Then we have people complaining about bugs that have long since been fixed or other stupid issues like that... :?
I remember there used to be a windowsXP iso floating around that had a toolchain setup on it several years ago... very awful experience to actually use. That was my first try at getting into DC development and it was hair-pullingly annoying. A linux distro with the toolchain already setup would be nice, especially if it could configure the toolchain at install. I have no experience making distros though :-\
Still Thinking!~~
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 5:14 pm

I don't mean a binary installer but a script that executes the steps. Also easier to update in case anything changes.
This gets rid of many stupid mistakes like using the wrong cygwin, forgetting to change the install directory in one of multiple places etc.
The Dreamcast homebrew community is small enough that we should care about lowering the entry barrier for people who are inexperienced with this kind of stuff.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 5:54 pm

bogglez wrote:I don't mean a binary installer but a script that executes the steps. Also easier to update in case anything changes.
This gets rid of many stupid mistakes like using the wrong cygwin, forgetting to change the install directory in one of multiple places etc.
The Dreamcast homebrew community is small enough that we should care about lowering the entry barrier for people who are inexperienced with this kind of stuff.
Mm, I could try throwing together a script. I recently built the toolchain a few nights ago on a second system.
Still Thinking!~~
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 6:14 pm

You basically need to automate downloading and installing cygwin if it's not installed, install the necessary packages and then run the script I made from cygwin. I guess we could upload it somewhere so that your script can download it and always get a current version. Creating a desktop icon that sources the environment file would also be handy.
That gets people started without frustration and when they want to do something more advanced (which most probably won't) then they can still do that later
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 6:18 pm

Hmm, Do you know if there is a way to send Cygwin commands from a windows batch file? I can get an installation of cygwin started from a windows batch file, and I could create a bash script to automate downloading KOS and setting up the tool chain that you could run through cygwin, but I'm not sure how to combine the two. If I could send Cygwin a command to run a script to download and install KOS, then everything would be gravy. Any clue?

edit: thinking about it, you'll need to edit your environ.sh script to point to the correct KOS path. It shouldn't be hard to whip up a program that will search environ.sh and replace that path with a string of our choosing, but it sort of complicates the automation process. I'm guessing this should be a compiled executable program rather than a batch file instead.

Same question applies, though - is there a way to manipulate Cygwin from a command line?
Last edited by ThePerfectK on Thu Aug 18, 2016 6:21 pm, edited 1 time in total.
Still Thinking!~~
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 6:20 pm

C:\cygwin\bin\bash testit.sh seems to work?
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 6:21 pm

bogglez wrote:C:\cygwin\bin\bash testit.sh seems to work?
excellent, I'll try my hand at writing a script after finishing dinner
Still Thinking!~~
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by bogglez » Thu Aug 18, 2016 6:23 pm

I've also seen that there's a -P flag you can use upon initial installation to choose packages. Should be useful
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
DCEmu Freak
DCEmu Freak
Posts: 90
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 5 times
Been liked: 6 times

Re: Help building Kos 2.0/Dc-chain

Post by ThePerfectK » Thu Aug 18, 2016 6:26 pm

bogglez wrote:I've also seen that there's a -P flag you can use upon initial installation to choose packages. Should be useful
I was thinking I could automate the installation of apt-cyg and just look for the packages with a command after cygwin is set up. That has an additional benefit of also working in Linux without much modification (swapping apt-cyg with apt-get).
Still Thinking!~~
frozenbinarystudio
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 13
Joined: Wed Aug 17, 2016 2:01 pm
Has liked: 0
Been liked: 0

Re: Help building Kos 2.0/Dc-chain

Post by frozenbinarystudio » Thu Aug 18, 2016 6:38 pm

First. Wow. I didn't expect anyone to look into this so quickly. Thanks! I will try to answer all the responses most pertinent.
ThePerfectK wrote:(or if you're on windows, run cygwin as admin)
I wasn't sure I did this on the first failure I had so I did do this the second time with the same results.
Thanks I will try this when I get some time free. It is more in depth than the posts I could find on this.


BlueCrab wrote:Post the log from when it built Newlib (you probably only need like the last 20 lines or so).
Absolutely! I gave you a little more than you asked for though. I also attached the full log.

Code: Select all

mkdir -p -- /opt/toolchains/dc/sh-elf/sh-elf/include
mkdir -p -- /opt/toolchains/dc/sh-elf/sh-elf/include/machine
mkdir -p -- /opt/toolchains/dc/sh-elf/sh-elf/include/rpc
mkdir -p -- /opt/toolchains/dc/sh-elf/sh-elf/include/sys
mkdir -p -- /opt/toolchains/dc/sh-elf/sh-elf/include/bits
 /usr/bin/mkdir -p '/opt/toolchains/dc/sh-elf/sh-elf/lib'
 /usr/bin/install -c -m 644 crt0.o '/opt/toolchains/dc/sh-elf/sh-elf/lib'
make[5]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib'
make[4]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib'
make[3]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib'
make[3]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss'
make[4]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/doc'
make[4]: Nothing to be done for 'install'.
make[4]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/doc'
make[4]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/libnosys'
make[4]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/libnosys'
make[4]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss'
if [ -z "m4-nofpu m4" ]; then \
  true; \
else \
  rootpre=`${PWDCMD-pwd}`/; export rootpre; \
  srcrootpre=`cd ../../../newlib-2.0.0/libgloss; ${PWDCMD-pwd}`/; export srcrootpre; \
  lib=`echo "${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$,\1,'`; \
  compiler="/opt/toolchains/dc/sh-elf/bin/sh-elf-gcc -B/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib/ -isystem /home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib/targ-include -isystem /home/Maple/dc/kos/utils/dc-chain/newlib-2.0.0/newlib/libc/include -B/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/sh -L/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/libnosys -L/home/Maple/dc/kos/utils/dc-chain/newlib-2.0.0/libgloss/sh   "; \
  for i in `${compiler} --print-multi-lib 2>/dev/null`; do \
    dir=`echo $i | sed -e 's/;.*$//'`; \
    if [ "${dir}" = "." ]; then \
      true; \
    else \
      if [ -d ../${dir}/${lib} ]; then \
	flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
	if (cd ../${dir}/${lib}; make "CC=/opt/toolchains/dc/sh-elf/bin/sh-elf-gcc -B/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib/ -isystem /home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/newlib/targ-include -isystem /home/Maple/dc/kos/utils/dc-chain/newlib-2.0.0/newlib/libc/include -B/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/sh -L/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss/libnosys -L/home/Maple/dc/kos/utils/dc-chain/newlib-2.0.0/libgloss/sh   " "CFLAGS=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "CCASFLAGS=" "AR=/opt/toolchains/dc/sh-elf/bin/sh-elf-ar" "RANLIB=/opt/toolchains/dc/sh-elf/bin/sh-elf-ranlib" "AR_FLAGS=rc" "MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000" "AS=/opt/toolchains/dc/sh-elf/bin/sh-elf-as" "LD=/opt/toolchains/dc/sh-elf/bin/sh-elf-ld" "CROSS_CFLAGS=" "TARGET_CFLAGS=" "exec_prefix=/opt/toolchains/dc/sh-elf" "prefix=/opt/toolchains/dc/sh-elf" "tooldir=/opt/toolchains/dc/sh-elf/sh-elf" "infodir=/opt/toolchains/dc/sh-elf/share/info" "libdir=/opt/toolchains/dc/sh-elf/lib" "top_toollibdir=" "INSTALL=/usr/bin/install -c" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "DESTDIR=" \
			CFLAGS="-g -O2 ${flags}" \
			CCASFLAGS=" ${flags}" \
			FCFLAGS=" ${flags}" \
			FFLAGS=" ${flags}" \
			ADAFLAGS=" ${flags}" \
			prefix="/opt/toolchains/dc/sh-elf" \
			exec_prefix="/opt/toolchains/dc/sh-elf" \
			GCJFLAGS=" ${flags}" \
			GOCFLAGS="-O2 -g ${flags}" \
			CXXFLAGS="-g -O2 ${flags}" \
			LIBCFLAGS="-g -O2 ${flags}" \
			LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
			LDFLAGS=" ${flags}" \
			MULTIFLAGS="${flags}" \
			DESTDIR="" \
			INSTALL="/usr/bin/install -c" \
			INSTALL_DATA="/usr/bin/install -c -m 644" \
			INSTALL_PROGRAM="/usr/bin/install -c" \
			INSTALL_SCRIPT="/usr/bin/install -c" \
			install); then \
	  true; \
	else \
	  exit 1; \
	fi; \
      else true; \
      fi; \
    fi; \
  done; \
fi
make[5]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4-nofpu/libgloss'
make[6]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4-nofpu/libgloss/libnosys'
make[6]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4-nofpu/libgloss/libnosys'
make[5]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4-nofpu/libgloss'
make[5]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4/libgloss'
make[6]: Entering directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4/libgloss/libnosys'
make[6]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4/libgloss/libnosys'
make[5]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/m4/libgloss'
make[4]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss'
make[3]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/libgloss'
make[2]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0'
make[1]: Leaving directory '/home/Maple/dc/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0'
BlueCrab wrote:If I'm correct that you're on Cygwin, what version of Cygwin are you using? Also, are you using the 32-bit or 64-bit version? I know that the 64-bit version had a lot of bugs in the past, so if you're using it, I'd highly recommend trying with the 32-bit version instead.
Version 2.5.2. 32-bit version. Basically the latest one available from their site at time of writing. I had issues with the 64-bit installer as described in one of the posts I linked.
Chilly Willy wrote:And if it gets too hard to build in cygwin, you can always install linux in a virtual environment and build it that way.
This was my alternate plan in the event I had no response so it is good to see it may work out better that way. I use Linux at work because Windows is awful at setting up Docker containers.
bogglez wrote:The Dreamcast homebrew community is small enough that we should care about lowering the entry barrier for people who are inexperienced with this kind of stuff.
This would be pretty awesome as the level of programming I do is quite abstracted from some of these steps. I think I learned more in the last 2 weeks of trying this than I have doing web design!

Ok I have some things to go on now that is good. When I get some time I will try the steps in the guide posted and setting up a VM to do a Linux install. I got too far into this to give up now.
Attachments
build-newlib-sh-elf-2.0.0.log
(2.76 MiB) Downloaded 26 times
Post Reply