我正在尝试使用cl-mpi
加载quicklisp
系统。这是系统定义:
(asdf:defsystem cl-mpi
:description "Common Lisp bindings for the Message Passing Interface (MPI)"
:author "Alex Fukunaga"
:version "0.1.0"
:license "MIT"
:depends-on (:cffi :cffi-grovel)
:components
((:file "packages")
(:file "cl-mpi-configure" :depends-on ("packages"))
(cffi-grovel:grovel-file "mpi-grovel" :depends-on ("packages" "cl-mpi-configure"))
(:file "mpi" :depends-on ("packages"))))
这无法编译,因为它“不知道”$CC
设置的内容。我需要将其设置为mpicc
。我找到了代码,我认为它设置了它:
(defun cc-compile-and-link (input-file output-file &key library)
(let ((arglist
`(,(or (getenv "CC") *cc*)
,@*cpu-word-size-flags*
,@*cc-flags*
;; add the cffi directory to the include path to make common.h visible
,(format nil "-I~A"
(directory-namestring
(truename
(asdf:system-definition-pathname :cffi-grovel))))
,@(when library *platform-library-flags*)
"-o" ,(native-namestring output-file)
,(native-namestring input-file))))
(when library
;; if it's a library that may be used, remove it
;; so we won't possibly be overwriting the code of any existing process
(ignore-some-conditions (file-error)
(delete-file output-file)))
(apply #'invoke arglist)))
以上内容位于asdf
包内。但是,我无法理解如何将defsystem
更改为编译器的帐户。
PS:这就是错误:
External process exited with code 1.
Command was: "cc" "-m64" "-I/home/wvxvw/quicklisp/dists/quicklisp/software/cffi_0.11.1/"
"-o" "/home/wvxvw/.cache/common-lisp/sbcl-1.1.2-1.fc18-linux-x64/home/wvxvw/quicklisp/local-projects/cl-mpi/mpi-grovel"
"/home/wvxvw/.cache/common-lisp/sbcl-1.1.2-1.fc18-linux-x64/home/wvxvw/quicklisp/local-projects/cl-mpi/mpi-grovel.c"
Output was:
/home/wvxvw/.cache/common-lisp/sbcl-1.1.2-1.fc18-linux-x64/home/wvxvw/quicklisp/local-projects/cl-mpi/mpi-grovel.c:6:34:
fatal error: /usr/include/mpi/mpi.h: No such file or directory
compilation terminated.
格式化以便于阅读。编译器找不到头,因为它不是正确的编译器(mpicc
“知道”在哪里查找mpi.h
头,它不会在/usr/include
中查找。 / p>
很抱歉这个混乱。我可以将$CC
设置为mpicc
,但它仍然找不到/usr/include/mpich-x86_64/mpi.h
标头 - 所以我可能需要设置包含路径而不是编译器?如果是这样,怎么样?
这就是我设法将其设置为mpicc
的方式:
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:oos 'asdf:load-op :cffi-grovel)
(setf cffi-grovel::*cc* "mpicc"))
之前defsystem
编辑:哎呀,它是cffi
产生的错误包括:(看起来像这样:
#include </usr/include/mpi/mpi.h>
而不是:
#include "mpi.h"
有什么办法可以解决这个问题吗?
应用大量的hackery和技巧我可以让它工作。看来,库的路径是在代码本身中设置的,所以我不得不
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:oos 'asdf:load-op :cffi-grovel)
(setf cffi-grovel::*cc* "mpicc"
mpi::*mpi-header-file* "/usr/include/mpich-x86_64/mpi.h"))
我还必须对我的系统进行一些特殊的更改来编译整个事情。
但是,如果可能的话,我希望能回答这个问题!即,以通用和可接受的方式设置C编译器及其选项的方法是什么?
答案 0 :(得分:1)
cl-mpi包含一个名为“cl-mpi-configure.lisp”的文件。此文件看起来更改为配置cl-mpi以使用正确的系统路径。
特别是这一行:
(defvar *mpi-header-file* "/usr/include/mpi/mpi.h") ; this is where ubuntu apt-get install puts mpi.h.
定义mpi头文件的路径。您需要更改此行以使用系统上的mpi.h路径。这有点烦人,因为你不需要使用本地版本,而不是直接从quicklisp下载。
或者,您可以制作补丁以更智能地确定路径(例如使用pkg-config
),并将其提交到上游。