ales-tsurko / kotoist

A VST plugin for live coding and algorithmic composition
https://kotoist.alestsurko.by
GNU General Public License v3.0
44 stars 5 forks source link

Windows 10 64x build crashes Reaper #1

Open blazpavlica opened 2 years ago

blazpavlica commented 2 years ago

Hi, I followed the instructions to build kotoist, first the gui then the VST, I then copied the generated kotoist.dll file into my VST folder. After adding kotoist to a track Reaper crashed giving a C++ runtime error. error

Do you maybe know what could be the problem? Is there a log I could paste here, with details of the build?

ales-tsurko commented 2 years ago

Hi! Thanks for the report. You can enable the log by uncommenting this https://github.com/ales-tsurko/kotoist/blob/9bd3fd0407fb2b9f0fdd3833fa3ef973e13dd8cd/src/lib.rs#L76 But I don't think it will help as there's no tracing...

blazpavlica commented 2 years ago

Which file does it log to?

I found a file called .rustc_info.json in target folder, this is its content: { "rustc_fingerprint":661663429307087652, "outputs":{ "2797684049618456168":{ "success":false, "status":"exit code: 1", "code":1, "stdout":"", "stderr":"error:-Csplit-debuginfois unstable on this platform\n\n" }, "15537503139010883884":{ "success":true, "status":"", "code":0, "stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\n", "stderr":"" }, "931469667778813386":{ "success":true, "status":"", "code":0, "stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\Blazen\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n", "stderr":"" }, "17598535894874457435":{ "success":true, "status":"", "code":0, "stdout":"rustc 1.56.0 (09c42c458 2021-10-18)\nbinary: rustc\ncommit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa\ncommit-date: 2021-10-18\nhost: x86_64-pc-windows-msvc\nrelease: 1.56.0\nLLVM version: 13.0.0\n", "stderr":"" } }, "successes":{} }

ales-tsurko commented 2 years ago

It should create a file on your desktop. You need to uncomment all lines in that method.

ales-tsurko commented 2 years ago

Hi. I made some progress on Windows. The problem is in GUI library, which I use. It still doesn't work, but now it's because the webview fails running the JS script. I also fixed logger on Windows. If you're interested, you can investigate further.

blazpavlica commented 2 years ago

Hey, sorry I was busy yesterday. I don't see a log file generated on my desktop, I ran both builds again, but it is not there.

Yes please, I would like to try and get it working. Will you push a commit so I can pull it?

P.S. I tried it on my work mac book, just a simple melody. Need to take a better look at koto, to try more. I'm used to JS so it's a bit confusing for me how to chain functions.

ales-tsurko commented 2 years ago

Make sure you pulled the changes. It should work, I tried it on Windows.

blazpavlica commented 2 years ago

Hey, I checked out the last commit and built again. Now it doesn't crash the whole Reaper, there is a system error shown for half a second, so I can't read what it says. After a few seconds the plugin is added but does not work, there is no GUI. Tried it with Ableton on Windows 10, it also crashes.

The log file contains just this: '[00:00:00.000] (88c) INFO init log'

Thanks for the quick reply, is there anything else I can try? I am good with JS, but have no idea about Rust.

ales-tsurko commented 2 years ago

The error you saw says there's an error processing the script. I think, this is from the webview. You can try to debug the GUI (which is written in JS) to find out why it crashes. But it may be related not only JS, but JS + webview on Windows.

blazpavlica commented 2 years ago

I ran a python server from the gui\build folder and I get these errors: 'TypeError: window.external.invoke is not a function'

This SO question sugests that this doesn't work anymore, but I am not sure if this is called in webview or your code.

I'll look further.

blazpavlica commented 2 years ago

The solution from the link isn't working. window.webkit is undefined.

ales-tsurko commented 2 years ago

To run it in the browser, you need to define REACT_APP_IN_BROWSER:

REACT_APP_IN_BROWSER=1 yarn start

Some things won't work in the browser. The webview uses a special API for communication between Rust and JS.

blazpavlica commented 2 years ago

I see that there is a yarn script also, but REACT_APP_IN_BROWSER=1 doesn't seem to work on windows. What is this variable for? Maybe I can define it another way.

I presumed it would work in a browser because it's React. Do you use any tooling to develop quicker? Building and opening in a DAW is very time consuming and there is no way to log.

I'm a frontend developer, never tried building a VST. I was really surprised when I saw that the GUI is JS.

ales-tsurko commented 2 years ago

The plugin uses this library for GUI. It's based on a system's webview. It has a special API for communication between Rust and the webview. This API isn't available in the browser. REACT_APP_IN_BROWSER tells the program to not use this API. But debugging in the browser doesn't have much sense, you can only edit styling, for example, but it's absolutely not functional in the browser.

As I said earlier, I don't think the problem is in JS code. It's somewhere between the webview and how it handles JS. So it's more about debugging the webview on Windows.

ales-tsurko commented 2 years ago

and there is no way to log

There is log. The log crate is used for it. And if you need to view log of the browser in the plugin (i.e. inside a DAW), you need to enable right button menu in the JS and then you'll have "Open console" in it.

ales-tsurko commented 2 years ago

I've spent some more time on this and figured out that this is because of IE, which winapi uses as the webview. I tried react polyfills with no luck. I think, the only solution will be switching to edge somehow or to another GUI library.

ales-tsurko commented 2 years ago

This could be an option: https://docs.rs/webview2/0.1.4/webview2/

jesusies commented 1 year ago

any updates/progress on windows ? Thanks

ales-tsurko commented 1 year ago

Unfortunately, I haven't been contributing to this project for a long time. And I won't have time to look into it in the near future. But a PR is welcome. In a nutshell, the issue is caused by the webview. It's just not supported on Windows. Maybe new options appeared since 2021, but back then the only solution was using webview2 on Windows.