OfekShilon / optview2

User-oriented fork of LLVM's opt-viewer
128 stars 13 forks source link

Unable to run the included example on WSL #11

Closed OfekShilon closed 1 year ago

OfekShilon commented 2 years ago

You'd get something similar to -

$~/src/optview2/cpp_optimization_example$ ./run_optview2.sh
Running make...
make: Nothing to be done for 'all'.
Running optview2...
2022-02-05 18:59:46,300 INFO Processing subfolder
2022-02-05 18:59:46,300 INFO Reading YAML files...
2022-02-05 18:59:46,335 INFO Rendering index page...
2022-02-05 18:59:46,335 INFO   5 raw remarks
2022-02-05 18:59:46,335 INFO   4 unique source locations
2022-02-05 18:59:46,335 INFO   4 after suppressing irrelevant
2022-02-05 18:59:46,337 INFO Copying assets
2022-02-05 18:59:46,337 INFO Rendering HTML files...
        1 of 1
2022-02-05 18:59:46,372 INFO Done - check the index page at file:///home/ofek/src/optview2/cpp_optimization_example/html_output/index.html
2022-02-05 18:59:47,668 INFO Ran for 0:00:01.368718
$~/src/optview2/cpp_optimization_example$ tcgetpgrp failed: Not a tty
Start : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
+ Start "/home/ofek/src/optview2/cpp_optimization_example/html_output/i ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
OfekShilon commented 2 years ago

The sample script run_optview2.sh does succeed in building and analyzing the sample source. However, it passes the --open-browser switch, which internally causes webbrowser.open to be called - and as of Feb 2022 this doesn't work on WSL. As seen in the output above, the script does output the path of the generated HTML to the console, you can open it manually from any browser.

OfekShilon commented 1 year ago

There's sort-of a solution here: https://github.com/python/cpython/issues/89752#issuecomment-1254943311

OfekShilon commented 1 year ago

--open-browser works now on WSL too, provided you have an up-to-date wslu installation.