在Mac OSX 下编译 SBCL 1.0.55 多线程版本出错记录+解决

在Mac OSX 下编译 SBCL 1.0.55 多线程版本出错记录+解决 html

首先从这里下载一个最新的 sbcl 1.0.55 的源代码(the source),解压,而后进去执行  shell

sudo sh make.sh --with-sb-thread

结果出现错误,出错信息以下: macos

Air:sbcl-1.0.55 admin$ sudo sh make.sh --with-sb-thread
Password:
rm -f *~ *.bak *.orig \#*\# .\#* texput.log *.fasl
rm -rf sbcl asdf "docstrings/"
rm -f  sbcl.html asdf.html
rm -f contrib-docs.texi-temp
rm -f package-locks.texi-temp
rm -f variables.texinfo
rm -f sbcl.ps asdf.ps sbcl.pdf asdf.pdf html-stamp tempfiles-stamp
rm -f asdf.aux asdf.cp asdf.cps asdf.fn asdf.fns asdf.ky asdf.log asdf.pg asdf.toc asdf.tp asdf.tps asdf.vr asdf.vrs sbcl.aux sbcl.cp sbcl.cps sbcl.fn sbcl.fns sbcl.ky sbcl.log sbcl.pg sbcl.toc sbcl.tp sbcl.tps sbcl.vr sbcl.vrs 
rm -f sbcl.info sbcl.info-* asdf.info
//entering make-config.sh
//ensuring the existence of output/ directory
//guessing default target CPU architecture from host architecture
//setting up CPU-architecture-dependent information
sbcl_arch="x86-64"
//initializing /Users/admin/Downloads/sbcl-1.0.55/local-target-features.lisp-expr
//setting up OS-dependent information
gcc -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.4 -arch x86_64 -fno-omit-frame-pointer -pagezero_size 0x100000 -I../src/runtime   determine-endianness.c  -lSystem -lc -ldl -o determine-endianness
cc1: error: unrecognized command line option "-arch"
make: *** [determine-endianness] Error 1
Air:sbcl-1.0.55 admin$

看起来是 gcc 不识别 -arch 选项,看到这个错误第一直觉就是个人默认 gcc 可能须要检查一下,而后顺手搜了把,果真有人也遇到相似问题,竟然当作 bug 报上去了 (https://trac.macports.org/ticket/31834),检查一下个人 gcc 设置: 多线程

Air:sbcl-1.0.55 admin$ sudo port select gcc
Password:
Available versions for gcc:
	apple-gcc42
	gcc42
	gcc46
	llvm-gcc42
	mp-gcc45 (active)
	none
Air:sbcl-1.0.55 admin$ sudo port select --set gcc gcc42
Password:
Selecting 'gcc42' for 'gcc' failed: could not create new link "/opt/local/bin/gcc": target "/usr/bin/gcc-4.2" doesn't exist
Air:sbcl-1.0.55 admin$
果真不出所料,默认激活的是 mp-gcc45,换成 gcc42 再试试。

ok,开始编译刷屏了,等待.... app

终于编译完成,没有任何错误: dom

real	0m45.687s
user	0m41.029s
sys	0m9.832s

The build seems to have finished successfully, including       17 (out of       17)
contributed modules. If you would like to run more extensive tests on
the new SBCL, you can try:

  cd tests && sh ./run-tests.sh

  (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On
  other platforms some failures are currently expected; patches welcome
  as always.)

To build documentation:

  cd doc/manual && make

To install SBCL (more information in INSTALL):

  sh install.sh

//build started:  Fri Jan 18 06:16:44 CST 2013
//build finished: Fri Jan 18 06:22:04 CST 2013
Air:sbcl-1.0.55 admin$

看来任什么时候候都会有意想不到的问题,全部的环境均可能存在独一无二的不一样之处。。。 socket

最后把编译好的新的 sbcl 加载到 LispBox 时发现又出现了问题,竟然是32位和64位的问题,以下: ide

; /Users/admin/.slime/fasl/2012-11-12/sbcl-1.0.55-darwin-x86-64/swank-source-file-cache.fasl written
; compilation finished in 0:00:00.049
; loading #P"/Users/admin/.slime/fasl/2012-11-12/sbcl-1.0.55-darwin-x86-64/swank-source-file-cache.fasl"
; compiling file "/Users/admin/LispBox-0.92/slime-2012-11-13/swank-sbcl.lisp" (written 18 JAN 2013 02:23:54 AM):
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
; compilation aborted after 0:00:00.005
;; 
;; Error while compiling /Users/admin/LispBox-0.92/slime-2012-11-13/swank-sbcl.lisp:
;;   #<SB-SYS:FD-STREAM
;;     for "file /Users/admin/LispBox-0.92/sbcl-1.0.55-x86-darwin/contrib/sb-bsd-sockets/sb-bsd-sockets.fasl"
;;     {1003901E43}> was compiled for implementation X86, but this is a X86-64.
;; Aborting.
;; *
再次思考,哦,极可能是由于原来拷贝到 LispBox 目录下的 sbcl 是别人编译好的 32 位的版本,那就把此次编译新下载回来的源代码目录整个拷贝到 LispBox 下,再试,ok 了,新的多线程的64位的 sbcl 终于在LispBox 里成功运行了!
最初是看到这位的帖子,还须要打一个补丁,可是我编译的时候没有打补丁

from: http://blog.sina.com.cn/s/blog_538d55be0100xjj7.html 测试

[2013-01-30 更新] 增长特性 :SB-CORE-COMPRESSION 从新编译 ui

今天把那个映像文件压缩功能编进去了,命令以下:

sudo sh make.sh --with-sb-core-compression

编译成功以后安装:

sudo sh install.sh

SBCL has been installed:
 binary /usr/local/bin/sbcl
 core and contribs in /usr/local/lib/sbcl/

而后查看特性列表,已经成功把 :SB-CORE-COMPRESSION 编进去了

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* *features*


(:ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS
 :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT
 :OS-PROVIDES-SUSECONDS-T :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-PUTWC
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :LITTLE-ENDIAN :MULTIPLY-HIGH-VOPS
 :MEMORY-BARRIER-VOPS :INLINE-CONSTANTS :FLOAT-EQL-VOPS :COMPLEX-FLOAT-VOPS
 :CYCLE-COUNTER :ALIEN-CALLBACKS :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-CLOSURES :RAW-INSTANCE-INIT-VOPS
 :UNWIND-TO-FRAME-AND-CALL-VOP :COMPARE-AND-SWAP-VOPS :LINKAGE-TABLE
 :C-STACK-IS-CONTROL-STACK :STACK-GROWS-DOWNWARD-NOT-UPWARD :GENCGC
 :UD2-BREAKPOINTS :MACH-EXCEPTION-HANDLER :DARWIN :BSD :MACH-O :UNIX
 :DARWIN9-OR-BETTER :INODE64 :X86-64 :SB-CORE-COMPRESSION)

编译完成以后悲剧地发现,多线程支持忘加了,看来要这么编:

sudo sh make.sh --with-sb-thread --with-sb-core-compression


新版本编译完成,增长 sb-core-compression 和 sb-thread

; SYS:CONTRIB;SB-SPROF;SB-SPROF.FASL.NEWEST written
; compilation finished in 0:00:01.024
* true

real 0m46.367s
user 0m39.027s
sys 0m8.867s

The build seems to have finished successfully, including       17 (out of       17)
contributed modules. If you would like to run more extensive tests on
the new SBCL, you can try:

  cd tests && sh ./run-tests.sh

  (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On
  other platforms some failures are currently expected; patches welcome
  as always.)

To build documentation:

  cd doc/manual && make

To install SBCL (more information in INSTALL):

  sh install.sh

//build started:  Wed Jan 30 06:02:14 CST 2013
//build finished: Wed Jan 30 06:08:48 CST 2013
Air:sbcl-1.0.55 admin$ 


先去跑跑测试用例,看看有没有失败的,用这个命令
cd tests && sh ./run-tests.sh

测试结果以下:

Finished running tests.
Status:
 Expected failure:    float.pure.lisp / RANGE-REDUCTION
 Expected failure:    debug.impure.lisp / BACKTRACE-INTERRUPTED-CONDITION-WAIT
 Skipped (broken):    debug.impure.lisp / (TRACE ENCAPSULATE NIL)
 Skipped (broken):    debug.impure.lisp / (TRACE-RECURSIVE ENCAPSULATE NIL)
 Expected failure:    packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
 Expected failure:    packages.impure.lisp / IMPORT-SINGLE-CONFLICT
 (2 tests skipped for this combination of platform and features)
ok
//apparent success (reached end of run-tests.sh normally)
Wed Jan 30 06:23:38 CST 2013

线程和映像压缩所有编译进去了:

* *features* (:ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS  :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT  :OS-PROVIDES-SUSECONDS-T :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-PUTWC  :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :LITTLE-ENDIAN :MULTIPLY-HIGH-VOPS  :MEMORY-BARRIER-VOPS :INLINE-CONSTANTS :FLOAT-EQL-VOPS :COMPLEX-FLOAT-VOPS  :CYCLE-COUNTER :ALIEN-CALLBACKS :STACK-ALLOCATABLE-FIXED-OBJECTS  :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS  :STACK-ALLOCATABLE-CLOSURES :RAW-INSTANCE-INIT-VOPS  :UNWIND-TO-FRAME-AND-CALL-VOP :COMPARE-AND-SWAP-VOPS :LINKAGE-TABLE  :C-STACK-IS-CONTROL-STACK :STACK-GROWS-DOWNWARD-NOT-UPWARD :GENCGC  :UD2-BREAKPOINTS :MACH-EXCEPTION-HANDLER :DARWIN :BSD :MACH-O :UNIX  :DARWIN9-OR-BETTER :INODE64 :X86-64 :SB-CORE-COMPRESSION :SB-THREAD) * 

相关文章
相关标签/搜索