我想創建一個prolog獨立可執行文件,按照http://www.swi-prolog.org/FAQ/UnixExe.html所示的簡約示例。swi prolog獨立可執行文件爲mac不按預期方式工作
一切似乎都做工精細,但如果我嘗試在不同的MAC不具有SWI-Prolog的安裝我收到以下錯誤執行:
dyld: Library not loaded: /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/lib/x86_64-darwin15.6.0/libswipl.dylib
我運行的命令及其輸出:
pl_test|⇒ swipl --goal=hello --stand_alone=true -o hello -c hello.pl
% autoloading prolog_codewalk:must_be/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/error
% autoloading qsave:current_foreign_library/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/shlib
% autoloading error:assertion/1 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/debug
% autoloading prolog_codewalk:portray_clause/1 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/listing
% autoloading prolog_codewalk:clause_info/4 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/prolog_clause
% autoloading prolog_codewalk:initialization_layout/4 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/prolog_clause
% autoloading prolog_source:directory_file_path/3 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/filesex
% autoloading files_ex:use_foreign_library/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/shlib
% autoloading record:member/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/lists
% autoloading files_ex:maplist/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/apply
% autoloading files_ex:permission_error/3 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/error
% autoloading oset:reverse/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/lists
% autoloading prolog_debug:backtrace/1 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/prolog_stack
% autoloading prolog_codewalk:clause_name/2 from /usr/local/Cellar/swi-prolog/7.2.3_2/libexec/lib/swipl-7.2.3/library/prolog_clause
% Autoloader: iteration 1 resolved 11 predicates and loaded 14 files in 0.101 seconds. Restarting ...
% Autoloader: loaded 11 files in 2 iterations in 0.143 seconds
hello.pl是與設置在網站上的例子相同的(見上面的鏈接)
所以問題是我錯過了什麼?
不知道這是否適用於MacOS,但是在試圖讓「獨立」的Linux上花費太多麻煩值得付出努力。我希望有人給你一個有用的答案。 –
我切換到GNU prolog ...編譯工作就像一個開箱即用的魅力。不過,我不介意爲這個問題得到答案:) – skamsie
SWI-Prolog的優勢在於其廣泛的標準庫。如果你想要「編譯」的二進制文件,GNU-Prolog絕對是一個更好的選擇。 –