【问题标题】:Change path of compiled files in the asdf?更改 asdf 中已编译文件的路径?
【发布时间】:2020-04-29 02:14:42
【问题描述】:

如何更改 .fas 文件所在的路径?通过 lisp 代码而不是配置文件。

我是这样做的:

(asdf:disable-output-translations)
(push *default-pathname-defaults* asdf:*central-registry*)
(setq asdf:*central-registry*
      (append asdf:*central-registry*
             (directory (merge-pathnames
                         (make-pathname :directory '(:relative :wild))
                         *default-pathname-defaults*))))

使用 ECL,它会在正在编译的源代码目录中生成 .fas 和 .o 文件,但我不希望它位于我经过的路径上的项目目录中,以便更好地组织我自己在这里。

类似:

(asdf:set-path-compiled-files "/home/noloop/lisp-armv7a-libs/builds")

【问题讨论】:

    标签: common-lisp asdf


    【解决方案1】:

    asdf:*central-registry* 用于 SOURCE 的位置,编译结果没有一个位置,因为 asdf2 使用多个实现显式处理您,这些实现具有不兼容的 fasl 格式(这是 asdf2 与以前状态相比的改进点事务)。

    根据[1](asdf:initialize-output-translations list)可用于编程设置翻译,(asdf:ensure-output-translations)可用于查看当前值

    正如 DSL 中所述,您必须包含 一个且仅一个 :inherit-configuration :ignore-inherited-configuration

    不清楚您是否还需要设置:enable-user-cache:disable-cache 之一,但选择一个似乎是明智的。

    如 [2] 中所述,顺序很重要。

    在我的机器上,使用 sbcl:

    cl-user> (asdf::initialize-output-translations '(:output-translations (t #p"/tmp/asdf/") :disable-cache :ignore-inherited-configuration))
    

    给予:

    ((#P"/home/peter/Programming/unix-built/sbcl/lib/sbcl/**/*.*" T)
     (#P"/tmp/asdf/" T) (T #P"/tmp/asdf/") (T T)
     (#P"/home/peter/.cache/common-lisp/sbcl-2.0.0.104-b5a4454ca-linux-x64/**/*.*"
      T)
     (T
      #P"/home/peter/.cache/common-lisp/sbcl-2.0.0.104-b5a4454ca-linux-x64/**/*.*"))
    

    当我尝试加载系统时,我在 /tmp/asdf 中看到了 FASL。

    1:http://soc.if.usp.br/manual/cl-asdf/asdf/Controlling-where-ASDF-saves-compiled-files.html#Controlling-where-ASDF-saves-compiled-files

    2:https://gitlab.common-lisp.net/asdf/asdf/issues/22

    【讨论】:

    • 我已经读过这篇文章,但没有看到一个例子,我不知道如何使它起作用。
    • 我目前正在使用find $(SYSTEM_DIRS) -type f \( -name \*.fas -o -name \*.o \) -exec mv {} $(BUILD_DIR) ';',但我更喜欢在 lisp 中使用它。
    • 我试过 (asdf:initialize-output-translations '(:output-translations (#P"/home/noloop/lisp-armv7a-libs/builds")))` 并没有用。我得到:类型条件:INVALID-OUTPUT-TRANSLATION。我也试过很多方法写这个,也不行。
    • 我试过(asdf::initialize-output-translations '(:output-translations :disable-cache :ignore-inherited-configuration (t #p"/home/noloop/lisp-armv7a-libs/builds/"))) 并没有用。它保存在源目录中,例如是否称为(asdf:disable-output-translations)
    猜你喜欢
    • 2019-12-20
    • 1970-01-01
    • 1970-01-01
    • 2020-04-15
    • 2017-12-22
    • 1970-01-01
    • 1970-01-01
    • 2023-01-05
    • 1970-01-01
    相关资源
    最近更新 更多