KallistiOS / kos-ports

Ported library collection for KallistiOS
Other
55 stars 35 forks source link

Building error #26

Closed thesleort closed 1 year ago

thesleort commented 1 year ago

I have trouble building the kos-ports. I have previously been able to build them all without error (likely half a year ago when I played around with it last time), but now I get the following error:

$ make kos-ports_all
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/utils/build-all.sh
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/SDL is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/SDL is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/expat is installed and up-to-date...
Building /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/expat...
make[1]: Entering directory '/home/troels/Documents/workspace/Dreamcast/toolchains/kos-ports/expat'
expat is not currently installed.
Finished processing dependencies for expat.
File "expat-2.5.0.tar.gz" is ok.
Unpacking expat-2.5.0.tar.gz ...
Copying KOS files...
checking build system type... x86_64-pc-linux-gnu
checking host system type... sh-unknown-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for sh-elf-strip... sh-elf-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for sh-elf-gcc... kos-cc
checking whether the C compiler works... no
configure: error: in `/home/troels/Documents/workspace/Dreamcast/toolchains/kos-ports/expat/build/expat-2.5.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: Entering directory '/home/troels/Documents/workspace/Dreamcast/toolchains/kos-ports/expat/build/expat-2.5.0'
make[2]: *** No rule to make target 'all'.  Stop.
make[2]: Leaving directory '/home/troels/Documents/workspace/Dreamcast/toolchains/kos-ports/expat/build/expat-2.5.0'
make[1]: *** [/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/scripts/build.mk:19: build-stamp] Error 2
make[1]: Leaving directory '/home/troels/Documents/workspace/Dreamcast/toolchains/kos-ports/expat'
2
Error building /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/expat. Bailing out.
make: *** [Makefile:37: kos-ports_all] Error 1

Looking up the config.log does not help me much. config.log

I have tried to build the entire kos from the ground up again following https://dreamcast.wiki/Getting_Started_with_Dreamcast_development to no avail. In config.log it seems that it expects both some files but also something about a missing "-qversion" flag. This makes me wonder if I am configuring something incorrectly?

I am on Linux and usually disable objc and obj-c++ in config.mk in KOS.

gyrovorbis commented 1 year ago

Hey, sorry for the late response. Been a little puzzled on this one. Your config.log shows the following:

/home/troels/Documents/workspace/Dreamcast/toolchains/sh-elf/lib/gcc/sh-elf/13.2.0/../../../../sh-elf/bin/ld: /home/troels/Documents/workspace/Dreamcast/toolchains/kos/lib/dreamcast/libkallisti.a(thread.o): in function `thd_init':
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/kernel/thread/thread.c:338:(.text.thd_init+0x158): undefined reference to `___builtin_set_thread_pointer'

Which has always been seen with an out-of-date toolchain which was built before we added support for TLS... But you say you just rebuilt the toolchains with the latest version of KOS checked out? No chance the toolchains were built like... 1 or 2 commits back but now you're on the latest? (TLS was just added).

Can I see your environ.sh as well?

By the way, if you need faster feedback or responses, feel free to drop by the #kos channel of the Simulant discord server, the official hangout of the DC homebrew scene and of KOS itself: https://discord.gg/ayMaWJP6w7

thesleort commented 1 year ago

No worries at all! I have the biggest respect for all the work you and the others do on KallistiOS.

Yes, I just retried building it all again now (removed /home/troels/Documents/workspace/Dreamcast/toolchains/sh-elf) and I get the same error.

This is my config.mk which should be a modified copy of config.mk.stable.sample (removed objc, obj-c++, and changed the toolchains_base):

# Sega Dreamcast Toolchains Maker (dc-chain)
# This file is part of KallistiOS.
#
# Created by Jim Ursetto (2004)
# Initially adapted from Stalin's build script version 0.3.
#

# Toolchain versions for SH
sh_binutils_ver=2.41
sh_gcc_ver=13.2.0
newlib_ver=4.3.0.20230120
gdb_ver=13.2

# Tarball extensions to download for SH
sh_binutils_download_type=xz
sh_gcc_download_type=xz
newlib_download_type=gz
gdb_download_type=xz

# Toolchain for ARM
# The ARM version of gcc/binutils is separated as support for the ARM7DI core
# used in the Dreamcast's AICA is not available in versions of GCC beyond 8.5.0.
arm_binutils_ver=2.41
arm_gcc_ver=8.5.0

# Tarball extensions to download for ARM
arm_binutils_download_type=xz
arm_gcc_download_type=xz

# GCC custom dependencies
# Specify here if you want to use custom GMP, MPFR and MPC libraries when
# building GCC. It is recommended that you leave this variable commented, in
# which case these dependencies will be automatically downloaded by using the
# '/contrib/download_prerequisites' shell script provided within the GCC packages.
# The ISL dependency isn't mandatory; if desired, you may comment the version
# numbers (i.e. 'sh_isl_ver' and 'arm_isl_ver') to disable the ISL library.
#use_custom_dependencies=1

# GCC dependencies for SH
sh_gmp_ver=6.2.1
sh_mpfr_ver=4.1.0
sh_mpc_ver=1.2.1
sh_isl_ver=0.24

# Tarball extensions to download for GCC dependencies for SH
sh_gmp_download_type=bz2
sh_mpfr_download_type=bz2
sh_mpc_download_type=gz
sh_isl_download_type=bz2

# GCC dependencies for ARM
arm_gmp_ver=6.1.0
arm_mpfr_ver=3.1.4
arm_mpc_ver=1.0.3
arm_isl_ver=0.18

# Tarball extensions to download for GCC dependencies for ARM
arm_gmp_download_type=bz2
arm_mpfr_download_type=bz2
arm_mpc_download_type=gz
arm_isl_download_type=bz2

# Download protocol (http|https|ftp)
# Specify here the protocol you want to use for downloading the packages.
download_protocol=https

# Force downloader (curl|wget)
# You may specify here 'wget' or 'curl'. If this variable is empty or commented,
# web downloader tool will be auto-detected in the following order: cURL, Wget.
# You must have either Wget or cURL installed to use dc-chain.
#force_downloader=wget

# Specify GNU Mirror override
# The default mirror for GNU sources is `ftpmirror.gnu.org`
# Setting this will allow overriding the default mirror which
# may be desirable if you have a prefered mirror.
#gnu_mirror=mirrors.kernel.org

# Toolchains base
# Indicate the root directory where toolchains will be installed
# This should match your 'environ.sh' configuration
toolchains_base=/home/troels/Documents/workspace/Dreamcast/toolchains

# Verbose (1|0)
# Display output to screen as well as log files
verbose=1

# Erase (1|0)
# Erase build directories on the fly to save space
erase=1

# Install mode (install-strip|install)
# Use 'install-strip' mode for removing debugging symbols of the toolchains.
# Use 'install' only if you want to enable debug symbols for the toolchains.
# This may be useful only if you plan to debug the toolchain itself.
install_mode=install-strip

# Make jobs (-jn|<empty>)
# 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.
# Please note, this value may be overriden in some cases; as issues were
# detected on some OS.
makejobs=-j20

# Languages (c|c++|objc|obj-c++)
# 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++

# GCC threading model (single|kos|posix*)
# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you 
# should use it. If you really don't want threading support for C++ (or 
# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you 
# probably want 'posix' here; but this mode is deprecated as the GCC 3.x branch
# is not anymore supported.
thread_model=kos

# Automatic patching for KOS (1|0)
# Uncomment this if you want to disable applying KOS patches to the toolchain 
# source files before building. This will disable usage of the 'kos' thread model. 
#use_kos_patches=0

# Automatic fixup SH-4 Newlib (1|0)
# Uncomment this if you want to disable the automatic fixup sh4 newlib needed by
# KallistiOS. This will keep the generated toolchain completely raw. This will
# also disable the 'kos' thread model. Don't mess with that flag unless you know
# exactly what you are doing.
#auto_fixup_sh4_newlib=0

# C99 Format Specifier Support (1|0)
# Define this to build SH4 Newlib with additional support for the C99 format
# specifiers, used by printf and friends. These include support for size_t,
# ptrdiff_t, intmax_t, and sized integral types.
#newlib_c99_formats=1

# Optimize Newlib for Space (1|0)
# Define this to enable optimizing for space when building Newlib. This will
# build Newlib with compiler flags which favor smaller code sizes over faster
# performance.
#newlib_opt_space=1

# MinGW/MSYS
# Standalone binaries (1|0)
# Define this if you want a standalone, no dependency binaries (i.e. static)
# When the binaries are standalone, it can be run outside MinGW/MSYS
# environment. This is NOT recommended. Use it if you know what you are doing.
#standalone_binary=1

# Force installation of BFD for SH (1|0)
# Uncomment this if you want to force the installation of 'libbfd' for the SH
# toolchain. This is required for MinGW/MSYS and can't be disabled in this
# scenario. This option is here mainly if you want to force the installation of
# 'libbfd' under other environments; but this won't be necessary in most cases,
# as 'libelf' is used almost everywhere. Please note, 'libbfd' couldn't be
# portable if you built it on another environment. Don't mess with that flag
# unless you know exactly what you are doing.
#sh_force_libbfd_installation=1

and this is my environ.sh:

# KallistiOS environment variable settings
#
# This is a sample script. Configure to suit your setup. Some possible
# alternatives for the values below are included as an example.
#
# This script should be sourced in your current shell environment (probably
# by bashrc or something similar).
#

# Build architecture. Set the major architecture you'll be building for.
# The only option here is "dreamcast" as of KOS 2.0.0.
export KOS_ARCH="dreamcast"

# Build sub-architecture. If you need a particular sub-architecture, then set
# that here; otherwise use "pristine".
# Possible subarch options include:
#  "pristine" - a normal Dreamcast console or HKT-0120 devkit
#  "naomi" - a NAOMI or NAOMI 2 arcade board
# You can also pre-define it in eg the build config of your IDE
if [ -z "${KOS_SUBARCH}" ] ; then
    export KOS_SUBARCH="pristine"
else
    export KOS_SUBARCH
fi

# KOS main base path
export KOS_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/kos"
export KOS_PORTS="${KOS_BASE}/../kos-ports"

# Make utility
export KOS_MAKE="make"
#export KOS_MAKE="gmake"

# Load utility
export KOS_LOADER="dc-tool -x"              # dcload, preconfigured
# export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x"  # dcload-serial

# Genromfs utility
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"
#export KOS_GENROMFS="genromfs"

# Compiler prefixes
#export KOS_CC_BASE="/usr/local/dc/dc-elf"
#export KOS_CC_PREFIX="dc"
export KOS_CC_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/sh-elf"       # DC
export KOS_CC_PREFIX="sh-elf"

# If you are compiling for DC and have an ARM compiler, use these too.
# If you're using a newer compiler (GCC 4.7.0 and newer), you should probably be
# using arm-eabi as the target, rather than arm-elf. dc-chain now defaults to
# arm-eabi, so that's the default here.
#export DC_ARM_BASE="/usr/local/dc/arm-elf"
#export DC_ARM_PREFIX="arm-elf"
export DC_ARM_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/arm-eabi"
export DC_ARM_PREFIX="arm-eabi"

# Expand PATH (comment out if you don't want this done here)
export PATH="${PATH}:${KOS_CC_BASE}/bin:/home/troels/Documents/workspace/Dreamcast/toolchains/bin"

# reset some options because there's no reason for them to persist across
# multiple sourcing of this
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""

# Setup some default CFLAGS for compilation. The things that will go here
# are user specifyable, like optimization level and whether you want stack
# traces enabled. Some platforms may have optimization restrictions,
# please check README.
# GCC seems to have made -fomit-frame-pointer the default on many targets, so
# hence you may need -fno-omit-frame-pointer to actually have GCC spit out frame
# pointers. It won't hurt to have it in there either way.
export KOS_CFLAGS="-O2 -fomit-frame-pointer"
# export KOS_CFLAGS="-O2 -DFRAME_POINTERS -fno-omit-frame-pointer"

# Everything else is pretty much shared. If you want to configure compiler
# options or other such things, look at this file.
. ${KOS_BASE}/environ_base.sh

git sha: 3e3b43cf757098c84cf4e67681a02ef3901c6cc8

Thank you for the discord heads up.

gyrovorbis commented 1 year ago

So your environ.sh file is definitely old... It just got recently redone and should be based on this https://github.com/KallistiOS/KallistiOS/blob/master/doc/environ.sh.sample revised sample. That being said, I'm not sure that I'd really expect it to just not work or to be the root cause of the error, but I would definitely update to eliminate that as a variable...

The new environ base has preset flag combinations for things like fast math and certain optimization levels that we wanted to make developers more widely aware of, so they might be of interest to you.

No worries at all! I have the biggest respect for all the work you and the others do on KallistiOS.

We really appreciate it. Always excited to see anyone wanting to get into DC development, and we work really hard to make sure stuff like this just works for everyone on all platforms, but ... obviously failing on that one atm, haha.

After work today, I'll give your configurations a try and see if maybe I can reproduce this locally? Also going to ping some of the other guys.

thesleort commented 1 year ago

I tried the new environ.sh with my paths instead of the /opt directory. It still doesn't work.

I am following the guide in https://dreamcast.wiki/Getting_Started_with_Dreamcast_development and I have always been using this. Has something been changed or added to the way things should be built?

This is the updated environ.sh:

# KallistiOS Environment Settings
#
# This is a sample script for configuring and customizing your
# KOS build environment. Modify it to suit your setup. Several
# settings may be enabled optionally or are provided with 
# alternative values.
#
# This script is typically sourced in your current shell environment 
# (probably by .bashrc, .bash_profile, or something similar), so that
# the KOS environment is set up automatically for each shell session.
#

# Build Architecture 
#
# Set the major architecture you'll be building for.
# The only option here is "dreamcast" as of KOS 2.0.0.
#
export KOS_ARCH="dreamcast"

# Build Sub-Architecture 
#
# Defines the sub architecture your configuration
# is targeting or uses an existing value that
# can be set externally via your IDE.
#
# Valid values:
#   "pristine" - Dreamcast console or HKT-0120 devkit (default)
#   "naomi"    - NAOMI or NAOMI 2 arcade board
#
if [ -z "${KOS_SUBARCH}" ] ; then
    export KOS_SUBARCH="pristine"
else
    export KOS_SUBARCH
fi

# KOS Root Path
#
# Specifies the path to the KOS root directory
#
export KOS_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/kos"

# KOS-Ports Path
#
# Specifies the path to the KOS-ports directory
#
export KOS_PORTS="${KOS_BASE}/../kos-ports"

# SH Compiler Prefixes
#
# Specifies the path to and prefix for the main SH 
# GCC toolchain used to target the Dreamcast's SH4 CPU.
#
export KOS_CC_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/sh-elf"  
export KOS_CC_PREFIX="sh-elf"

# ARM Compiler Prefixes
#
# Specifies the path to and prefix for the additional ARM 
# GCC toolchain used to target the Dreamcast's AICA SPU.
#
export DC_ARM_BASE="/home/troels/Documents/workspace/Dreamcast/toolchains/arm-eabi"
export DC_ARM_PREFIX="arm-eabi"

# CMake Toolchain Path
#
# Specifies the path to the toolchain file used to target
# KOS with the "cmake" build utility.
#
export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/dreamcast.toolchain.cmake"

# Genromfs Utility Path
#
# Specifies the path to the utility which is used by KOS
# to create romdisk filesystem images.
#
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"

# Make Utility
#
# Configures the tool to be used as the main "make" utility
# for building GNU Makefiles. On a platform such as BSD, 
# the default can be changed to "gmake," for the GNU 
# implementation.
#
export KOS_MAKE="make"
#export KOS_MAKE="gmake"

# Loader Utility
#
# Specifies the loader to be used with the "make run" targets
# in the KOS examples. Defaults to using a preconfigured version
# of dc-tool. Use one of the other options for a manual dc-tool-ip
# or dc-tool-serial configuration, remembering to change the values
# for the Dreamcast's IP address or the serial port interface.
#
export KOS_LOADER="dc-tool -x"                     
#export KOS_LOADER="dc-tool-ip -t 192.168.1.100 -x"
#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x" 

# Default Compiler Flags
#
# Resets build flags. You can also initialize them to some preset
# default values here if you wish.
#
export KOS_INC_PATHS=""
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""
export DC_ARM_LDFLAGS=""

# Optimization Level 
#
# Controls the baseline optimization level to use when building. 
# Typically this is -Og (debugging), -O0, -01, -02, or -03.
# NOTE: For our target, -O4 is a valid optimization level that has 
# been seen to have some performance impact as well.
#
export KOS_CFLAGS="${KOS_CFLAGS} -O2"

# Additional Optimizations
#
# Uncomment this to enable what has been found emperically to be 
# the optimal set of additional flags for release build performance 
# on the current stable toolchain. NOTE: Certain KOS-ports and examples
# do not work properly with "-flto=auto"!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto"

# Frame Pointers
#
# Controls whether frame pointers are emitted or not. Disabled by
# default. Enable them if you plan to use GDB for debugging. 
#
export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer"
#export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS"

# GCC Builtin Functions
#
# Comment out this line to enable GCC to use its own builtin implementations of 
# certain standard library functions. Under certain conditions, this can allow
# compiler-optimized implementations to replace standard function invocations.
# The downside of this is that it COULD interfere with Newlib or KOS implementations
# of these functions, and it has not been tested thoroughly to ensure compatibility. 
#
export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin"

# Fast Math Instructions
#
# Uncomment this line to enable the optimized fast-math instructions (FSSRA,
# FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots.
# These can result in substantial performance gains for these kinds of operations;
# however, they do so at the price of accuracy and are not IEEE compliant.
# NOTE: This also requires -fno-builtin be removed from KOS_CFLAGS to take effect!
#
# export KOS_CFLAGS="${KOS_CFLAGS} -ffast-math -ffp-contract=fast -mfsrra -mfsca"

# Additional Tools Path
#
# If not already set, add "bin" directory to PATH variable, which is where
# additional tools such as dc-tool-ip and dc-tool-serial are typically
# installed. Comment this out if you don't want this included within your PATH.
#
if [[ ":$PATH:" != *":${KOS_CC_BASE}/bin:/home/troels/Documents/workspace/Dreamcast/toolchains/bin"* ]]; then
  export PATH="${PATH}:${KOS_CC_BASE}/bin:/home/troels/Documents/workspace/Dreamcast/toolchains/bin"
fi

# Shared Compiler Configuration
#
# Include sub architecture-independent configuration file for shared 
# environment settings. If you want to configure additional compiler 
# options or see where other build flags are set, look at this file.
#
. ${KOS_BASE}/environ_base.sh
thesleort commented 1 year ago

A little more digging with kos-ports I have found that it is able to build most of the kos-ports packages. If I removed the following from the kos-ports directory:

With all of these I get the same error as the OP in their respective config.log.

Without these I am, as said, able to compile the rest (the output after building them):

troels@troels-mothership:~/Documents/workspace/Dreamcast/toolchains/kos$ make kos-ports_all 
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/utils/build-all.sh
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/SDL is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/SDL is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libAL is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libAL is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libGL is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libGL is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libbz2 is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libbz2 is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libconio is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libconio is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libdcplib is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libdcplib is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libfastmem is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libfastmem is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libimageload is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libimageload is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libjpeg is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libjpeg is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libkmg is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libkmg is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libkosh is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libkosh is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libmodplug is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libmodplug is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libmp3 is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libmp3 is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libogg is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libogg is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/liboggvorbisplay is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/liboggvorbisplay is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libparallax is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libparallax is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libpcx is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libpcx is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libpng is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libpng is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtga is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtga is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtremor is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtremor is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtsunami is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libtsunami is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libvorbis is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/libvorbis is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/lua is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/lua is already installed and up-to-date. Skipping.
Checking if /home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/zlib is installed and up-to-date...
/home/troels/Documents/workspace/Dreamcast/toolchains/kos/../kos-ports/zlib is already installed and up-to-date. Skipping.
darcagn commented 1 year ago

interesting, i think those kos-ports that are not building are the same (or similar) to the list of kos-ports that won't build with LTO enabled. But you don't seem to have it enabled in your environ.sh.

the guide at https://dreamcast.wiki/Getting_Started_with_Dreamcast_development is the guide I wrote and i keep it up to date with changes in KOS. just now i built the 13.2.0 toolchain + kos + kos-ports + all examples so I don't think this is a regression anywhere. hmm

thesleort commented 1 year ago

If I remove the sh-elf directory, it says No such file or directory, so I am fairly certain that it uses the one that kos builds.

This is the spec dump of the sh-elf-gcc:

troels@troels-mothership:~/Documents/workspace/Dreamcast$ sh-elf-gcc -dumpspecs | grep lto
*lto_wrapper:
*lto_gcc:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %{!fno-use-linker-plugin:%{!fno-lto:     -plugin %(linker_plugin_file)     -plugin-opt=%(lto_wrapper)     -plugin-opt=-fresolution=%u.res         %{flinker-output=*:-plugin-opt=-linker-output-known}     %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}}     }}%{flto|flto=*:%<fcompare-debug*}     %{flto} %{fno-lto} %{flto=*} %l %{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*}  %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zstd:--compress-debug-sections=zstd} %{gz=zlib-gnu:}%X %{o*} %{e*} %{N} %{n} %{r}    %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}}     %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std:   %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit:   %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):}     %{%:sanitize(hwaddress):}     %{%:sanitize(thread):}     %{%:sanitize(leak):}}}} %o      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):     %:include(libgomp.spec)%(link_gomp)}    %{fgnu-tm:%:include(libitm.spec)%(link_itm)}    %(mflib)  %{fsplit-stack: --wrap=pthread_create}    %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{static-libasan:-Bstatic} -lasan %{static-libasan:-Bdynamic} %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}    %{static:%ecannot specify -static with -fsanitize=address}}    %{%:sanitize(hwaddress):%{static-libhwasan:-Bstatic} -lhwasan %{static-libhwasan:-Bdynamic} %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)} %{static:%ecannot specify -static with -fsanitize=hwaddress}}    %{%:sanitize(thread):%{static-libtsan:-Bstatic} -ltsan %{static-libtsan:-Bdynamic} %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}    %{static:%ecannot specify -static with -fsanitize=thread}}    %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}}    %{%:sanitize(leak):%{static-liblsan:-Bstatic} -llsan %{static-liblsan:-Bdynamic} %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}}     %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}    %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*}  

I am not sure what to look for, but to me it looks like the LTO that you mentioned has not been enabled as expected.

When I look at the config.log files, besides the error that @gyrovorbis mentions, I see the lines:

configure:4467: $? = 0
configure:4456: kos-cc -V >&5
sh-elf-gcc: error: unrecognized command-line option '-V'
sh-elf-gcc: fatal error: no input files
compilation terminated.
configure:4467: $? = 1
configure:4456: kos-cc -qversion >&5
sh-elf-gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
sh-elf-gcc: fatal error: no input files

I am not sure if this is supposed to resolve itself, but to me it looks like the build script expects a different version of sh-elf-gcc thatn the one provided?

thesleort commented 1 year ago

I think we can close this as being a local issue on my computer. I am able to compile everything using the exact same build setup on my laptop. I will return with more info if I find out why. Maybe it somehow uses some system libraries not present on my desktop.

gyrovorbis commented 1 year ago

I think we can close this as being a local issue on my computer. I am able to compile everything using the exact same build setup on my laptop. I will return with more info if I find out why. Maybe it somehow uses some system libraries not present on my desktop.

OMG THANK THE LORD!!! I've been guilt-stricken by not being able to help you. I've set this stuff up on every platform for all kinds of people, helped troubleshoot all kinds of problems, and this was just... spooky. It does sound like a local issue, but if you ever find out what the specific cause was please let us know.

But more importantly CONGRATULATIONS! Make sure to check out the examples directory in KOS and let us know if you have any other questions!

thesleort commented 9 months ago

I have been off for a while, since this is mostly hobby for me. However, recently pulled the latest kos which has the following in the config.mk.stable.sample:

# Floating point precision support (m4|m4-single|m4-single-only)
# Build support for various SH4 floating-point operation ABIs. KallistiOS only
# officially supports single-precision-only mode. Add m4 (double precision) or
# m4-single (single precision) to build experimental support for those ABIs.
precision_modes=m4-single-only
#precision_modes=m4,m4-single,m4-single-only

# Default floating point mode (m4|m4-single|m4-single-only)
# Choose the default floating point precision ABI used when GCC is invoked. This
# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC.
# KallistiOS currently only supports m4-single-only, so that is the default.
default_precision=m4-single-only

I think this finally made it work and compile correctly on my desktop computer again. Of course it could be something else as well, but this at least somehow fixed it for me.

gyrovorbis commented 9 months ago

I have been off for a while, since this is mostly hobby for me. However, recently pulled the latest kos which has the following in the config.mk.stable.sample:

# Floating point precision support (m4|m4-single|m4-single-only)
# Build support for various SH4 floating-point operation ABIs. KallistiOS only
# officially supports single-precision-only mode. Add m4 (double precision) or
# m4-single (single precision) to build experimental support for those ABIs.
precision_modes=m4-single-only
#precision_modes=m4,m4-single,m4-single-only

# Default floating point mode (m4|m4-single|m4-single-only)
# Choose the default floating point precision ABI used when GCC is invoked. This
# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC.
# KallistiOS currently only supports m4-single-only, so that is the default.
default_precision=m4-single-only

I think this finally made it work and compile correctly on my desktop computer again. Of course it could be something else as well, but this at least somehow fixed it for me.

Awesome!!! Glad to hear that!