我正在尝试在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.
答案 0 :(得分: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"
}
嗯,那也运行它,所以一个更小的方法可以留下最后的&& /usr/local/bin/vvp $file_path/iverilog_compiled/$file_base_name
,但这是重点。
这里要说的是,即使将shell
设置为true,cmd
命令也不会在具有访问用户路径变量的完整shell环境中运行,因此很多内置和你可以直接从shell调用的特别安装的程序在没有直接来源的情况下无法在那里工作。
如果有人在未来的构建中遇到类似的错误,我建议使用:
which command_name
查找命令所在的位置,然后包含整个路径。