0

我正在尝试在 Sublime Text 中为 Verilog 实现一个简单的构建系统,但是在构建时出现以下错误:

[Errno 2] No such file or directory: 'iverilog'
[cmd: ['iverilog', '-o', 'iverilog/compiled', '/Users/ryanbeltran/Documents/Programming/Verilog/testing/test.v']]
[dir: /Users/ryanbeltran/Documents/Programming/Verilog/testing]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

我的构建系统应该使用 Icarus Verilog 编译器,其命令是:

iverilog -o outputfile inputfile.v

当我从 shell 运行该命令时,我没有任何问题,它完全按照我的意图工作。

我的Verilog.sublime-build构建系统使用以下 JSON:

{
    "cmd": ["iverilog", "-o", "iverilog/compiled", "$file"],
    "selector": "source.v"
} 

如果有人可以让我了解我在这里可能做错了什么,我将不胜感激。如果有什么不同,我是从 OS X 运行的,并使用 Sublime Text 3。

4

1 回答 1

1

经过更多的实验,我最终弄清楚了这一点。原来我需要的是

{
    "shell":true,

    "cmd": [ "mkdir -pv $file_path/iverilog_compiled && touch $file_path/iverilog_compiled/$file_base_name && /usr/local/bin/iverilog -o $file_path/iverilog_compiled/$file_base_name $file && /usr/local/bin/vvp $file_path/iverilog_compiled/$file_base_name"],

    "selector": "source.v"
}

好吧,这也运行它,因此更简单的方法可以省略 final && /usr/local/bin/vvp $file_path/iverilog_compiled/$file_base_name,但这不是重点。

这里的要点是,即使shell设置为 true,该cmd命令也不会在可以访问用户路径变量的完整 shell 环境中运行,因此许多内置程序,尤其是可以直接从 shell 调用的已安装程序将不起作用在那里没有直接采购。

如果将来有人在他们的构建中遇到类似的错误,我的建议是使用:

which command_name

查找您的命令所在的位置,然后包含您的整个路径。

于 2016-03-12T22:11:45.647 回答