From 49fb7ca501ffe111324187b90b0e52c62fc74938 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 14 Feb 2025 08:13:39 +0200 Subject: [PATCH] make: show instructions about installing a C compiler, when the bootstrap compilation with cc fails (#23718) --- GNUmakefile | 4 ++-- Makefile | 2 +- cmd/tools/cc_compilation_failed_non_windows.sh | 7 +++++++ cmd/tools/cc_compilation_failed_windows.sh | 7 +++++++ cmd/tools/vgret.defaults.toml | 4 +++- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100755 cmd/tools/cc_compilation_failed_non_windows.sh create mode 100755 cmd/tools/cc_compilation_failed_windows.sh diff --git a/GNUmakefile b/GNUmakefile index 957bffbee6..b4651fbc88 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -98,7 +98,7 @@ endif all: latest_vc latest_tcc latest_legacy ifdef WIN32 - $(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS) -lws2_32 + $(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS) -lws2_32 || cmd/tools/cc_compilation_failed_windows.sh ./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v ./v2.exe -o $(VEXE) $(VFLAGS) cmd/v $(RM) v1.exe @@ -110,7 +110,7 @@ ifdef LEGACY rm -rf $(TMPLEGACY) $(eval override LDFLAGS+=-L$(realpath $(LEGACYLIBS))/lib -lMacportsLegacySupport) endif - $(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) + $(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) || cmd/tools/cc_compilation_failed_non_windows.sh ./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v ./v2.exe -nocache -o $(VEXE) $(VFLAGS) cmd/v rm -rf v1.exe v2.exe diff --git a/Makefile b/Makefile index 78ff435881..ac71beebe5 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ download_vc: if [ -f vc/v.c ] ; then git -C vc/ pull; else git clone --filter=blob:none https://github.com/vlang/vc vc/; fi v: - $(CC) $(CFLAGS) -std=gnu11 -w -o v1 vc/v.c -lm -lexecinfo -lpthread $(LDFLAGS) + $(CC) $(CFLAGS) -std=gnu11 -w -o v1 vc/v.c -lm -lexecinfo -lpthread $(LDFLAGS) || cmd/tools/cc_compilation_failed_non_windows.sh ./v1 -no-parallel -o v2 $(VFLAGS) cmd/v ./v2 -o v $(VFLAGS) cmd/v rm -rf v1 v2 diff --git a/cmd/tools/cc_compilation_failed_non_windows.sh b/cmd/tools/cc_compilation_failed_non_windows.sh new file mode 100755 index 0000000000..33ae725718 --- /dev/null +++ b/cmd/tools/cc_compilation_failed_non_windows.sh @@ -0,0 +1,7 @@ +#!/bin/sh +## this script is used by the makefiles in the top level folder +echo +echo 'Compilation of v.c failed.' +echo 'See https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Linux-and-macOS .' +echo +false diff --git a/cmd/tools/cc_compilation_failed_windows.sh b/cmd/tools/cc_compilation_failed_windows.sh new file mode 100755 index 0000000000..8f90385873 --- /dev/null +++ b/cmd/tools/cc_compilation_failed_windows.sh @@ -0,0 +1,7 @@ +#!/bin/sh +## this script is used by the makefiles in the top level folder +echo +echo 'Compilation of v.c failed.' +echo 'See https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows .' +echo +false diff --git a/cmd/tools/vgret.defaults.toml b/cmd/tools/vgret.defaults.toml index 5ba541957b..1651f4bebe 100644 --- a/cmd/tools/vgret.defaults.toml +++ b/cmd/tools/vgret.defaults.toml @@ -39,6 +39,8 @@ [[apps]] path = 'examples/ttf_font/example_ttf.v' + compare.flags = ['-p','-fail 0.008','-failpercent 1.5'] + # Reasons for ex- or inclusion: # @@ -62,7 +64,7 @@ # 'examples/flappylearning/game.v' // Random movement # 'examples/hot_reload/bounce.v' // Inaccurate captures # 'examples/hot_reload/graph.v' // Inaccurate captures -# 'examples/ttf_font/example_ttf.v', // OK +# 'examples/ttf_font/example_ttf.v' // OK-ish ... the font rendering seems to be shifted with a few pixels on Ubuntu 24.04, compared to Ubuntu 20.04 . TODO: update it with the newer visuals. # 'examples/sokol/01_cubes/cube.v', // Can pass with a warning and diff at around 1.2% # 'examples/sokol/02_cubes_glsl/cube_glsl.v', // Inaccurate captures # 'examples/sokol/03_march_tracing_glsl/rt_glsl.v', // Inaccurate captures