diff --git a/Makefile b/Makefile
index 43d7cfd..bdbb578 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ NATIVE_DEFINES=-DTCC_TARGET_I386
 else
 ifeq ($(ARCH),x86-64)
 NATIVE_DEFINES=-DTCC_TARGET_X86_64
-NATIVE_DEFINES+=$(if $(wildcard /lib64/ld-linux-x86-64.so.2),-DTCC_TARGET_X86_64_CENTOS)
+NATIVE_DEFINES+=$(if $(wildcard /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2),-DTCC_TARGET_X86_64_UBUNTU,$(if $(wildcard /lib64/ld-linux-x86-64.so.2),-DTCC_TARGET_X86_64_CENTOS))
 endif
 endif
 
diff --git a/tcc.h b/tcc.h
index d158829..5378049 100644
--- a/tcc.h
+++ b/tcc.h
@@ -144,11 +144,18 @@
 #ifndef CONFIG_TCC_LDDIR
 # if defined(TCC_TARGET_X86_64_CENTOS)
 #  define CONFIG_TCC_LDDIR "/lib64"
+# elif defined(TCC_TARGET_X86_64_UBUNTU)
+#  define CONFIG_TCC_LDDIR "/lib/x86_64-linux-gnu"
+#  define ADD_INCLUDE(x) x ":" x "/x86_64-linux-gnu"
 # else
 #  define CONFIG_TCC_LDDIR "/lib"
 # endif
 #endif
 
+#ifndef ADD_INCLUDE
+# define ADD_INCLUDE(x) x
+#endif
+
 /* path to find crt1.o, crti.o and crtn.o */
 #ifndef CONFIG_TCC_CRTPREFIX
 # define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
@@ -162,8 +169,8 @@
 #  define CONFIG_TCC_SYSINCLUDEPATHS "{B}/include;{B}/include/winapi"
 # else
 #  define CONFIG_TCC_SYSINCLUDEPATHS \
-        CONFIG_SYSROOT "/usr/local/include" \
-    ":" CONFIG_SYSROOT "/usr/include" \
+        ADD_INCLUDE(CONFIG_SYSROOT "/usr/local/include") \
+    ":" ADD_INCLUDE(CONFIG_SYSROOT "/usr/include") \
     ":" "{B}/include"
 # endif
 #endif
