[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] test failure on Linux
From: |
Ramsay Jones |
Subject: |
[Tinycc-devel] test failure on Linux |
Date: |
Sat, 09 Feb 2013 16:01:44 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
Hi
Sorry for not testing earlier, but the current 'mob' branch does not
pass the tests for me, viz:
$ git --no-pager log --oneline -1
7a477d7 lib/Makefile: use CC, add bcheck to libtcc1.a
$ make clean >/dev/null
$ make >out 2>&1
$ make test
make -C tests test
make[1]: Entering directory `/home/ramsay/tinycc/tests'
------------ hello ------------
../tcc -B.. ../examples/ex1.c -o hello && ./hello
tcc: error: file 'crt1.o' not found
tcc: error: file 'crti.o' not found
tcc: error: file 'crtn.o' not found
tcc: error: undefined symbol 'printf'
make[1]: *** [hello] Error 1
make[1]: Leaving directory `/home/ramsay/tinycc/tests'
make: *** [test] Error 2
$
This is on (a somewhat dated) Linux (ubuntu):
$ uname -a
Linux ramsay-laptop 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007
i686 GNU/Linux
$
A quick trip to the debugger shows that CONFIG_MULTIARCHDIR has been
set such that it searches for the crt?.o files in /lib/i386-linux-gnu,
which does not work:
$ ls -l /lib/i386-linux-gnu
lrwxrwxrwx 1 root root 19 2007-06-24 19:44 /lib/i386-linux-gnu ->
/lib/i486-linux-gnu/
$ ls -l /lib/i486-linux-gnu/
total 0
$ ls -l /usr/lib/crt?.o
-rw-r--r-- 1 root root 2459 2007-04-04 11:31 /usr/lib/crt1.o
-rw-r--r-- 1 root root 2296 2007-04-04 11:31 /usr/lib/crti.o
-rw-r--r-- 1 root root 1824 2007-04-04 11:31 /usr/lib/crtn.o
$
As a quick fix, I applied the patch given at the end of this email.
This patch simply checks for the existence of the /usr/lib/crt?.o
files and supresses the assignment to CONFIG_MULTIARCHDIR if they
do. This fixes the problem for me (but may not be the *correct* fix,
of course):
$ make clean >/dev/null
$ git checkout fix
Switched to branch 'fix'
$ make >out 2>&1
$ make test
make -C tests test
make[1]: Entering directory `/home/ramsay/tinycc/tests'
------------ hello ------------
../tcc -B.. ../examples/ex1.c -o hello && ./hello
Hello World
../tcc -B.. -run ../examples/ex1.c
Hello World
gcc -o libtcc_test libtcc_test.c ../libtcc.a -I.. -Wall -g -O2
-fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -DTCC_TARGET_I386 -lm
-ldl
------------ libtest ------------
./libtcc_test lib_path=..
Hello World!
fib(32) = 2178309
add(32, 64) = 96
cp ../include/tcclib.h .
gcc -o tcctest.gcc tcctest.c -I. -I.. -w -Wall -g -O2 -fno-strict-aliasing
-Wno-pointer-sign -Wno-sign-compare -DTCC_TARGET_I386 -std=gnu99 -O0
-fno-omit-frame-pointer
./tcctest.gcc > test.ref
------------ test3 ------------
../tcc -B.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B..
-DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -DTCC_TARGET_I386
-DONE_SOURCE -run ../tcc.c -B.. -run tcctest.c > test.out3
Auto Test3 OK
------------ moretests ------------
make -C tests2
make[2]: Entering directory `/home/ramsay/tinycc/tests/tests2'
Test: 00_assignment...
Test: 01_comment...
Test: 02_printf...
Test: 03_struct...
Test: 04_for...
Test: 05_array...
Test: 06_case...
Test: 07_function...
Test: 08_while...
Test: 09_do_while...
Test: 10_pointer...
Test: 11_precedence...
Test: 12_hashdefine...
Test: 13_integer_literals...
Test: 14_if...
Test: 15_recursion...
Test: 16_nesting...
Test: 17_enum...
Test: 18_include...
Test: 19_pointer_arithmetic...
Test: 20_pointer_comparison...
Test: 21_char_array...
Test: 22_floating_point...
Test: 23_type_coercion...
Test: 24_math_library...
Test: 25_quicksort...
Test: 26_character_constants...
Test: 27_sizeof...
Test: 28_strings...
Test: 29_array_address...
Test: 31_args...
Test: 32_led...
Test: 33_ternary_op...
Test: 35_sizeof...
Test: 36_array_initialisers...
Test: 37_sprintf...
Test: 38_multiple_array_index...
Test: 39_typedef...
Test: 40_stdio...
Test: 41_hashif...
Test: 42_function_pointer...
Test: 43_void_param...
Test: 44_scoped_declarations...
Test: 45_empty_for...
Test: 47_switch_return...
Test: 48_nested_break...
Test: 49_bracket_evaluation...
Test: 50_logical_second_arg...
Test: 51_static...
Test: 52_unnamed_enum...
Test: 54_goto...
Test: 55_lshift_type...
make[2]: Leaving directory `/home/ramsay/tinycc/tests/tests2'
make[1]: Leaving directory `/home/ramsay/tinycc/tests'
$
HTH
ATB,
Ramsay Jones
-- >8 --
Subject: [PATCH] Makefile: Don't add multiarch directory for i386
Signed-off-by: Ramsay Jones <address@hidden>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index 23045eb..f3bc96d 100644
--- a/Makefile
+++ b/Makefile
@@ -35,10 +35,12 @@ endif
ifeq ($(ARCH),i386)
NATIVE_DEFINES=-DTCC_TARGET_I386
+ifeq (,$(wildcard /usr/lib/crt?.o))
NATIVE_DEFINES+=\
$(if $(wildcard
/lib/i386-linux-gnu),-DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\",\
$(if $(wildcard
/lib/i386-kfreebsd-gnu),-DCONFIG_MULTIARCHDIR=\"i386-kfreebsd-gnu\",\
$(if $(wildcard /lib/i386-gnu),-DCONFIG_MULTIARCHDIR=\"i386-gnu\")))
+endif
else ifeq ($(ARCH),x86-64)
NATIVE_DEFINES=-DTCC_TARGET_X86_64
NATIVE_DEFINES+=\
--
1.8.1
- [Tinycc-devel] test failure on Linux,
Ramsay Jones <=
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/09
- Re: [Tinycc-devel] test failure on Linux, Ramsay Jones, 2013/02/12
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, grischka, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, arnold, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, Domingo Alvarez Duarte, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/13
- Re: [Tinycc-devel] test failure on Linux, Thomas Preud'homme, 2013/02/13