Hello,
 I've tried to install tcc on centos 5 (probably old 64 bit version) and
uses some funny paths such as usr/lib64 causing tcc not to actually find
the required files. The attached patch fixes the issue for me.

best regards,
Nikos
diff -ur tcc-0.9.25/libtcc.c tcc-0.9.25-centos/libtcc.c
--- tcc-0.9.25/libtcc.c 2009-05-18 16:27:06.000000000 +0200
+++ tcc-0.9.25-centos/libtcc.c  2010-01-27 11:01:56.000000000 +0100
@@ -1823,9 +1823,14 @@
     
 #ifndef TCC_TARGET_PE
     /* default library paths */
-    tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib");
+# if defined(TCC_TARGET_X86_64_CENTOS)
+    tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib64");
+    tcc_add_library_path(s, CONFIG_SYSROOT "/lib64");
+# else
     tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib");
     tcc_add_library_path(s, CONFIG_SYSROOT "/lib");
+# endif
+    tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib");
 #endif
 
     /* no section zero */
diff -ur tcc-0.9.25/Makefile tcc-0.9.25-centos/Makefile
--- tcc-0.9.25/Makefile 2009-05-18 16:27:06.000000000 +0200
+++ tcc-0.9.25-centos/Makefile  2010-01-27 11:05:21.000000000 +0100
@@ -52,6 +52,7 @@
 else
 ifeq ($(ARCH),x86-64)
 NATIVE_TARGET=-DTCC_TARGET_X86_64
+NATIVE_TARGET+=$(if $(wildcard 
/lib64/ld-linux-x86-64.so.2),-DTCC_TARGET_X86_64_CENTOS)
 LIBTCC1=libtcc1.a
 endif
 endif
Only in tcc-0.9.25-centos/: tcc
Only in tcc-0.9.25-centos/: tcc.1
diff -ur tcc-0.9.25/tccelf.c tcc-0.9.25-centos/tccelf.c
--- tcc-0.9.25/tccelf.c 2009-05-18 16:27:06.000000000 +0200
+++ tcc-0.9.25-centos/tccelf.c  2010-01-27 11:04:57.000000000 +0100
@@ -1277,7 +1277,11 @@
 #elif defined TCC_ARM_EABI
 static char elf_interp[] = "/lib/ld-linux.so.3";
 #elif defined(TCC_TARGET_X86_64)
+# if defined(TCC_TARGET_X86_64_CENTOS)
+static char elf_interp[] = "/lib64/ld-linux-x86-64.so.2";
+# else
 static char elf_interp[] = "/lib/ld-linux-x86-64.so.2";
+# endif
 #elif defined(TCC_UCLIBC)
 static char elf_interp[] = "/lib/ld-uClibc.so.0";
 #else
diff -ur tcc-0.9.25/tcc.h tcc-0.9.25-centos/tcc.h
--- tcc-0.9.25/tcc.h    2009-05-18 16:27:06.000000000 +0200
+++ tcc-0.9.25-centos/tcc.h     2010-01-27 10:46:17.000000000 +0100
@@ -126,7 +126,11 @@
 
 /* path to find crt1.o, crti.o and crtn.o. Only needed when generating
    executables or dlls */
-#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib"
+#if defined(TCC_TARGET_X86_64_CENTOS)
+# define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib64"
+#else
+# define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib"
+#endif
 
 #define INCLUDE_STACK_SIZE  32
 #define IFDEF_STACK_SIZE    64
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to