在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) *