0

I am trying to implement a simple build system for Verilog in Sublime Text, but I am getting the following error when I build:

[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]

My build system is supposed to be using the Icarus Verilog Compiler, the command for which is:

iverilog -o outputfile inputfile.v

When I run that command from shell I have no problems, and it works exactly how I intend it.

My Verilog.sublime-build build system uses the following JSON:

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

If someone could offer me any insight into what I may doing wrong here I would appreciate it enormously. If it makes any difference, I am running from OS X, and using Sublime Text 3.

rp.beltran
  • 2,764
  • 3
  • 21
  • 29

1 Answers1

1

I ended up figuring this one out after some more experimentation. It turns out what I needed was

{
    "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"
}

Well, that also runs it, and so a more minimal approach could leave off the final && /usr/local/bin/vvp $file_path/iverilog_compiled/$file_base_name, but that is besides the point.

The takeaway here, is that even with shell set to true, the cmd command is not run in a full shell environment with access to the user's path variables, and so a lot of builtins and especially installed programs that you can call directly from shell will not work in there without being sourced to directly.

If anyone gets a similar error in the future on their build, my recommendation would be to use:

which command_name

To find where your command is located, and then include your entire path.

rp.beltran
  • 2,764
  • 3
  • 21
  • 29