2016-09-17 143 views
5

系統我在:jonesforth分段故障

/tmp/jonesforth $ cat /etc/issue 
Ubuntu 16.04.1 LTS \n \l 

這是一個32位系統。從annexia庫

克隆:

git clone git://git.annexia.org/git/jonesforth.git 

構建雲OK:

cd jonesforth 

/tmp/jonesforth $ make 
gcc -m32 -nostdlib -static -Wl,-Ttext,0 -o jonesforth jonesforth.S 

測試但沒有通過:

/tmp/jonesforth $ make test 
test_stack_trace.f ... --- .test_stack_trace.test 2016-09-17 17:44:59.488492834 -0500 
+++ test_stack_trace.f.out 2016-09-17 17:33:11.171189490 -0500 
@@ -0,0 +1,6 @@ 
+TEST4+0 TEST3+0 TEST2+0 TEST+0 
+3 
+TEST4+0 TEST3+32 TEST2+0 TEST+0 
+TEST4+0 TEST3+0 TEST2+4 TEST+0 
+3 
+TEST4+0 TEST3+32 TEST2+4 TEST+0 
Makefile:34: recipe for target 'test_stack_trace.test' failed 
make: *** [test_stack_trace.test] Error 1 

正在啓動jonesforth導致分割故障:

/tmp/jonesforth $ cat jonesforth.f - | ./jonesforth 
Segmentation fault 

回答

6

從Makefile中刪除的條目爲-Wl,-Ttext,0jonesforth

jonesforth: jonesforth.S 
    gcc -m32 -nostdlib -static $(BUILD_ID_NONE) -o [email protected] $< 

似乎幫助。構建成功:

/tmp/jonesforth $ touch jonesforth.S 
/tmp/jonesforth $ make 
gcc -m32 -nostdlib -static -o jonesforth jonesforth.S 

測試通過了:

/tmp/jonesforth $ make test 
test_stack_trace.f ... ok 
test_stack.f ... ok 
test_comparison.f ... ok 
test_assembler.f ... ok 
test_exception.f ... ok 
test_read_file.f ... ok 
test_number.f ... ok 

並開始了:

/tmp/jonesforth $ cat jonesforth.f - | ./jonesforth 
JONESFORTH VERSION 47 
14499 CELLS REMAINING 
OK 
+0

非常感謝張貼此。我的頭撞在桌子上幾個小時。 –