【问题标题】:sml: unable to determine operating system in emacs but works fine in terminalsml:无法确定 emacs 中的操作系统,但在终端中可以正常工作
【发布时间】:2019-01-29 21:30:27
【问题描述】:

我成功地在我的 MAC OS 10.14 Mojave 上安装了 smlnj。它在终端中运行良好。然后,我在 emacs 中安装 sml 包时遇到了麻烦。当我在 .sml 文件中输入内容时,颜色和缩进都是正确的。但是,当我执行 C-c C-s 并回车时,它显示“sml:无法确定架构/操作系统”,因此我无法在此缓冲区中执行任何操作,例如类型 1+1;或其他任何东西。有没有关于如何解决这个问题的提示?我整天都被困在这里。提前致谢!

【问题讨论】:

    标签: sml smlnj sml-mode


    【解决方案1】:

    这似乎是 SML/NJ 的运行时系统中的一个问题:

    我只有 110.77 的源代码,我不知道你运行的是什么版本的 SML/NJ,但这是我如何完成调试过程以及之后你可以做什么:

    $ ack "unable to determine arch" smlnj
    config/_heap2exec
    24: die "unable to determine architecture/operating system"
    
    config/_link-sml
    47:  echo "$CMD: unable to determine architecture/operating system"
    
    config/_run-sml
    62:  echo "$CMD: unable to determine architecture/operating system"
    

    也许 Emacs 没有为 SML/NJ 的二进制文件导出正确的环境变量以正确检测操作系统。深入config/_run-sml,这看起来像是导致错误消息的代码:

    ARCH_N_OPSYS=`"$BIN_DIR/.arch-n-opsys"`
    if [ "$?" != "0" ]; then
      echo "$CMD: unable to determine architecture/operating system"
      exit 1
    fi
    eval $ARCH_N_OPSYS
    

    config/_arch-n-opsys 内部有一个适用于 MacOS 的 switch 语句:

    Darwin)
      case `uname -p` in
        powerpc)
      ARCH=ppc
      case `uname -r` in
        9*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.5 Leopard
        *) exit 1;;
      esac;;
        i386) ARCH=x86;
      case `uname -r` in
        9*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.5 Leopard
        10*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.6 Snow Leopard
        11*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.7 Lion
        12*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.8 Mountain Lion
        13*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.9 Mavericks
        14*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.10 Yosemite
        *) exit 1;;
      esac;;
    

    shell 脚本.arch-n-opsys 是确定您正在使用的操作系统的脚本。因此,SML/NJ 110.77 的运行时系统似乎没有检测到 MacOS 超过 10.10。为什么这不是 Emacs 之外的问题我不确定。

    您可以尝试在 Emacs 中通过 M-x shell RET 运行程序并输入:

    cd /usr/lib/smlnj/bin
    ls -a
    ./.arch-n-opsys
    

    我怀疑如果您将这个 .arch-n-opsys 二进制文件替换为一个对您的首选选项进行硬编码的小型 shell 脚本,您可以在本地解决此问题,这可能是:

    #!/bin/sh
    echo "ARCH=darwin; OPSYS=darwin; HEAP_SUFFIX=darwin-darwin"
    

    如果这不起作用,那么原始.arch-n-opsys shell 脚本列出的其他一些选项可能会起作用。


    仅当您有兴趣为他人解决问题时:

    1. 了解最新版本 110.85 是否支持 MacOS > 10.10。

    2. 如果没有,请写信给 the email at the bottom of smlnj.org 并链接到此 StackOverflow 帖子,并说明 uname -r 在您的系统上做了什么,或提供特别适用于您的系统的 a diff

      李>

    【讨论】:

      猜你喜欢
      • 2021-05-07
      • 1970-01-01
      • 2013-01-02
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-17
      • 1970-01-01
      相关资源
      最近更新 更多