diff --git a/ch32v003fun/ch32v003fun.mk b/ch32v003fun/ch32v003fun.mk
index d91040b76c1618a3fa520b210576fd4e256ddf99..664a861b6898157d381a8e6e8f251f307e23a1c6 100644
--- a/ch32v003fun/ch32v003fun.mk
+++ b/ch32v003fun/ch32v003fun.mk
@@ -1,13 +1,25 @@
+# Default prefix for Windows
 ifeq ($(OS),Windows_NT)
     PREFIX?=riscv64-unknown-elf
+# Check if riscv64-linux-gnu-gcc exists
+else ifneq ($(shell which riscv64-linux-gnu-gcc),)
+    PREFIX?=riscv64-linux-gnu
+# Check if riscv64-unknown-elf-gcc exists
+else ifneq ($(shell which riscv64-unknown-elf-gcc),)
+    PREFIX?=riscv64-unknown-elf
+# Default prefix
 else
-    ifeq (, $(shell which riscv64-unknown-elf-gcc))
-        PREFIX?=riscv64-elf
-    else
-        PREFIX?=riscv64-unknown-elf
-    endif
+    PREFIX?=riscv64-elf
 endif
 
+# Fedora places newlib in a different location
+ifneq ($(wildcard /etc/fedora-release),)
+	NEWLIB?=/usr/arm-none-eabi/include
+else
+	NEWLIB?=/usr/include/newlib
+endif
+
+
 TARGET_MCU?=CH32V003
 TARGET_EXT?=c
 
@@ -129,7 +141,7 @@ endif
 
 CFLAGS+= \
 	$(CFLAGS_ARCH) -static-libgcc \
-	-I/usr/include/newlib \
+	-I$(NEWLIB) \
 	-I$(CH32V003FUN)/../extralibs \
 	-I$(CH32V003FUN) \
 	-nostdlib \
diff --git a/examples/cpp_virtual_methods/Makefile b/examples/cpp_virtual_methods/Makefile
index 55e73ab19ce51a1c4a151dc110ad9cff773cd6d2..2af4d7bcac278f41593c19ff63ed5c2909f841bc 100644
--- a/examples/cpp_virtual_methods/Makefile
+++ b/examples/cpp_virtual_methods/Makefile
@@ -15,7 +15,7 @@ CFLAGS:= \
 	-static-libgcc \
 	-march=rv32ec \
 	-mabi=ilp32e \
-	-I/usr/include/newlib \
+	-I$(NEWLIB) \
 	-I$(CH32V003FUN) \
 	-nostdlib \
 	-DCH32V003 \