【发布时间】:2013-11-21 13:58:40
【问题描述】:
我正在尝试使用quicklisp 加载cl-mpi 系统。这是系统定义:
(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 中寻找)。
很抱歉给您带来了困惑。我可以将$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"
有什么办法可以解决吗?
应用大量的骇客和诡计我可以让它工作。看来库的路径是在代码本身中设置的,所以我不得不
(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 编译器及其选项的方法是什么?
【问题讨论】:
-
标签
compiler应用于有关编译器编程的问题或有关编译器详细内部工作的问题。不要使用compiler询问有关特定编译器的选项和设置的问题,请改用您感兴趣的编译器的名称。
标签: common-lisp cc cffi