I've run into this before, but many folks working on devkits make bash scripts. The problem is that Debian and any distro derived from Debian have been using dash for quite a few years. While dash strives for speed and POSIX compliance, bash keeps adding more and more non-standard features to tempt people to the Dark Side.
KOS uses bash scripts for gnu wrappers. For example, most makefiles for KOS projects use kos-cc for the compiler. That's not a program, it's a bash script.. one that is decidedly not POSIX compliant. So what's a Debian-derived distro user to do? In the end, I wound up switching back to bash. There's just too much work to make these devkits compatible with dash. In Ubuntu, you do this with
That will pop up a box asking if you wish to use dash as the shell; select NO and it will instead make bash the default shell.
A further note - in the environ.sh script, you find this line:
Code: Select all
export KOS_CFLAGS="-O2 -fomit-frame-pointer"
When the gnu wrappers work, that line is added to your flags, which means that your project will always be built with those two flags. The O level will override any O level you select in your makefile. What I did was make a few extra environ.sh scripts: the first was environ_kos.sh for building kos and kos-ports; it changes -O2 to -O1, which is appropriate for any code that directly accesses hardware. The second was environ_fast.sh, which changes -O2 to -Ofast for projects where you want the general fast optimization. Finally, I made an environ_noflags.sh which makes the whole string "" so that your makefile isn't overridden for those two options. If you tend to use more flags regularly, you might make another environ shell script with them in the line. Just remember to source the script before building your project!