djg / verilated-rs

Verilator Porcelain
Apache License 2.0
36 stars 14 forks source link

Fix windows build #3

Closed xobs closed 4 years ago

xobs commented 4 years ago

This adds some patches to get verilated-rs running on Windows:

[11:10:21 PM] D:/Code/verilated-rs> cargo run
   Compiling verilated v0.1.1 (D:\Code\verilated-rs\verilated)
   Compiling example v0.0.0 (D:\Code\verilated-rs\example)
    Finished dev [unoptimized + debuginfo] target(s) in 12.01s
     Running `target\debug\example.exe`
0: count_o = 0
1: count_o = 0
2: count_o = 1
3: count_o = 2
4: count_o = 3
5: count_o = 4
6: count_o = 5
7: count_o = 6
8: count_o = 7
9: count_o = 8
10: count_o = 9
11: count_o = 10
[11:10:34 PM] D:/Code/verilated-rs>
xobs commented 4 years ago

Also, I see there was a question about why I removed verilated_command_args_add(), but I can't see it now. I removed it because it wasn't present in my version of verilator. It looks like things got moved around in https://github.com/verilator/verilator/commit/84335b958015c2b15266cfbcc1b0a87b2d035c30 and as a result it doesn't actually get linked in.

xobs commented 4 years ago

Specifically, with that function call still in place, I get the following error:

[11:09:06 AM] D:/Code/verilated-rs> cargo run
   Compiling verilated v0.1.1 (D:\Code\verilated-rs\verilated)
   Compiling example v0.0.0 (D:\Code\verilated-rs\example)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\ [...] "msvcrt.lib"
  = note: libverilated-5150819e2e36f022.rlib(verilated_shim.o) : error LNK2019: unresolved external symbol "public: stat
ic void __cdecl Verilated::commandArgsAdd(int,char const * *)" (?commandArgsAdd@Verilated@@SAXHPEAPEBD@Z) referenced in
function verilated_command_args_add
          D:\Code\verilated-rs\target\debug\deps\example.exe : fatal error LNK1120: 1 unresolved externals

error: aborting due to previous error

error: could not compile `example`.

To learn more, run the command again with --verbose.
[11:09:19 AM] D:/Code/verilated-rs>