2016-12-19 39 views
1

我想創建一個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是與設置在網站上的例子相同的(見上面的鏈接)

所以問題是我錯過了什麼?

+0

不知道這是否適用於MacOS,但是在試圖讓「獨立」的Linux上花費太多麻煩值得付出努力。我希望有人給你一個有用的答案。 –

+0

我切換到GNU prolog ...編譯工作就像一個開箱即用的魅力。不過,我不介意爲這個問題得到答案:) – skamsie

+0

SWI-Prolog的優勢在於其廣泛的標準庫。如果你想要「編譯」的二進制文件,GNU-Prolog絕對是一個更好的選擇。 –

回答

1

我想答案是在你給出的頁面上。

If the SWI-Prolog kernel is statically linked (default on Linux/i386) and the state does not use external packages that provide shared objects, you are done. Otherwise, you must make the shared objects available and findable to make the program usable on another computer.

它看起來像你原來的SWI-Prolog的安裝利用共享庫,這將有手動與你的可執行文件捆綁在一起,在頁面上提到:

If the SWI-Prolog kernel is statically linked (default on Linux/i386) and the state does not use external packages that provide shared objects, you are done. Otherwise, you must make the shared objects available and findable to make the program usable on another computer.

+0

hehe ...沒有冒犯,但從我剛剛發送的鏈接複製粘貼並不是一個很好的答案。問題是我不知道如何手動捆綁它們。你能提供一個例子嗎? – skamsie