9fans/plan9port

can not build under gcc-less linux

z-erica opened this issue · 4 comments

plan9port/bin/9c

Lines 115 to 122 in be7c68f

*Linux*) usegcc
case "${CC9:-gcc}" in
tcc)
cc=tcc
cflags="-c -g"
;;
esac
;;

some linux distributions (e.g. chimera linux) use clang as a default toolchain. this means 9c can't be used as is

What happens when clang is used to compile plan 9 instead?

i believe it works fine; the main issue is that i had to patch this file for anything to run in the first place

Great. I see the problem now. The Linux branch only checks CC9 against tcc. There's plenty of code there to support clang on other platforms already. As you know it already works, are you allowed to share, or even contribute your patch?

Otherwise, if something else is already setting CC9 to clang, and if useclang works on Linux just as well as on BSDs, would something like the new code below suffice, to treat Linux clang the same as Dragon clang and BSD clang?

case "$tag" in
*DragonFly*gcc*|*BSD*gcc*)	usegcc ;;
*DragonFly*clang|*BSD*clang*|*Linux*clang*)	useclang ;;
*Darwin*)
		useclang
		cflags="$cflags -g3 -m64"
		;;
*HP-UX*)	cc=${CC9:-cc}; cflags="-g -O -c -Ae" ;;
*Linux*)	usegcc
		case "${CC9:-gcc}" in
		tcc)
			cc=tcc
			cflags="-c -g"
			;;
		esac
		;;

it should suffice, yes!