Closed lyssieth closed 3 years ago
I tested it out myself, not much needs to be changed, just finding the path where the saves are will be harder.
The newest version doesn't work in Linux at all. Building with cargo build --release
, running results in:
thread 'main' panicked at 'cannot call wasm-bindgen imported functions on non-wasm targets', /home/rkfg/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.55/src/lib.rs:5412:9
stack backtrace:
0: 0x55c3e98ca8d2 - std::backtrace_rs::backtrace::libunwind::trace::hc6c3491277866fea
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x55c3e98ca8d2 - std::backtrace_rs::backtrace::trace_unsynchronized::h4524f073368a5b13
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55c3e98ca8d2 - std::sys_common::backtrace::_print_fmt::h0d0cace6159902af
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys_common/backtrace.rs:67:5
3: 0x55c3e98ca8d2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3e6af6f05919a7fc
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys_common/backtrace.rs:46:22
4: 0x55c3e98bb57c - core::fmt::write::h72801a82c94e6ff1
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/core/src/fmt/mod.rs:1163:17
5: 0x55c3e98ca044 - std::io::Write::write_fmt::ha4f5d34aaccbac84
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/io/mod.rs:1696:15
6: 0x55c3e98c9e7d - std::sys_common::backtrace::_print::heed69f5ce9a8e189
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys_common/backtrace.rs:49:5
7: 0x55c3e98c9e7d - std::sys_common::backtrace::print::h5f3918bd80c09252
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys_common/backtrace.rs:36:9
8: 0x55c3e98c9e7d - std::panicking::default_hook::{{closure}}::h5af30648530eb3d0
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/panicking.rs:210:50
9: 0x55c3e98c9e7d - std::panicking::default_hook::he88d5fb1ba1b4c19
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/panicking.rs:227:9
10: 0x55c3e98c9e7d - std::panicking::rust_panic_with_hook::h01febc308b2b313b
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/panicking.rs:624:17
11: 0x55c3e98be7e4 - std::panicking::begin_panic::{{closure}}::h87691649b21e80eb
12: 0x55c3e98be7b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h0ab8b79393471d8a
13: 0x55c3e98b8a76 - std::panicking::begin_panic::h38be7af48290afa0
14: 0x55c3e98be799 - js_sys::global::get_global_object::h448da0085bf9188c
15: 0x55c3e98be8ff - std::thread::local::fast::Key<T>::try_initialize::h1187296d7d39e704
16: 0x55c3e98be801 - std::thread::local::LocalKey<T>::with::h3f097bd0e22ab9e2
17: 0x55c3e98be776 - js_sys::global::h5d8e48d270fce6b8
18: 0x55c3e98ea056 - trilogy_save_editor::main::h41480e2e4154978f
19: 0x55c3e98e9383 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf1cbd0c01137d6c9
20: 0x55c3e98e9892 - main
21: 0x7fc0126b2e4a - __libc_start_main
at ./csu/../csu/libc-start.c:314:16
22: 0x55c3e98ba20a - _start
23: 0x0 - <unknown>
Compiling with cargo build --release --target wasm32-unknown-unknown
results in trilogy-save-editor.wasm
that can't be launched by itself. Any suggestions?
As mentioned in readme:
npm update
cargo install make
cargo make release
I didn't test linux version myself but CI doesn't complain.
Tried this first, it says this:
> cargo install make
Updating crates.io index
error: there is nothing to install in `make v0.0.0`, because it has no binaries
`cargo install` is only for installing programs, and can't be used with libraries.
To use a library crate, add it as a dependency in a Cargo project instead.
> cargo make release
error: no such subcommand: `make`
Did you mean `miri`?
> rustup toolchain list
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default) (override)
There's also wasm32-unknown-unknown (installed)
in rustup target list
. I'm not familiar with Rust ecosystem so not sure what this all means.
Ah yeah, my bad, it's cargo install cargo-make
.
It also needs cargo install trunk
. After that I get:
error[E0308]: mismatched types
--> app/src/main.rs:41:20
|
40 | #[tokio::main]
| - help: consider removing this semicolon
41 | async fn main() -> Result<()> {
| ---- ^^^^^^^^^^ expected enum `Result`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected enum `Result<(), anyhow::Error>`
found unit type `()`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `app` due to previous error
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.
Not sure but it might be caused by the nightly toolchain. I switched to stable and it worked past this, however it still failed but with a different error:
Oct 18 03:33:37.407 ERROR ❌ error [7/2346]
error from HTML pipeline
Caused by:
0: error from asset pipeline
1: wasm-opt call returned a bad status
Stack backtrace:
0: anyhow::private::new_adhoc
1: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
4: tokio::runtime::task::harness::poll_future
5: tokio::runtime::task::raw::poll
6: tokio::runtime::thread_pool::worker::Context::run_task
7: tokio::runtime::task::raw::poll
8: std::sys_common::backtrace::__rust_begin_short_backtrace
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
10: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/alloc/src/boxed.rs:1691:9
11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/alloc/src/boxed.rs:1691:9
12: std::sys::unix::thread::Thread::new::thread_start
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys/unix/thread.rs:106:17
13: start_thread
at ./nptl/./nptl/pthread_create.c:463:8
14: clone
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Error: error from HTML pipeline
Caused by:
0: error from asset pipeline
1: wasm-opt call returned a bad status
Stack backtrace:
0: anyhow::private::new_adhoc
1: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
4: tokio::runtime::task::harness::poll_future
5: tokio::runtime::task::raw::poll
6: tokio::runtime::thread_pool::worker::Context::run_task
7: tokio::runtime::task::raw::poll
8: std::sys_common::backtrace::__rust_begin_short_backtrace
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
10: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/alloc/src/boxed.rs:1691:9
11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/alloc/src/boxed.rs:1691:9
12: std::sys::unix::thread::Thread::new::thread_start
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/sys/unix/thread.rs:106:17
13: start_thread
at ./nptl/./nptl/pthread_create.c:463:8
14: clone
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.
Wasm-opt seems to fail with your system. Try to change the optimization level (0 to 4): https://github.com/KarlitosVII/trilogy-save-editor/blob/4ffb4033a63483d62c537c04e75d5cd012a1ccd8/index.html#L11 Or remove the line completely.
I'm not sure what I'm doing wrong but I decided to clean the repo using git clean -fxd
to make sure there's no trash left from previous builds. Now I'm stuck at this:
error[E0599]: no method named `decode` found for reference `&'static Encoding` in the current scope
--> src/unreal/deserializer.rs:146:42
|
146 | if self.is_le { UTF_16LE.decode(&bytes) } else { UTF_16BE.decode(&bytes) };
| ^^^^^^ method not found in `&'static Encoding`
error[E0599]: no method named `decode` found for reference `&'static Encoding` in the current scope
--> src/unreal/deserializer.rs:146:75
|
146 | if self.is_le { UTF_16LE.decode(&bytes) } else { UTF_16BE.decode(&bytes) };
| ^^^^^^ method not found in `&'static Encoding`
error[E0599]: no method named `decode` found for reference `&'static Encoding` in the current scope
--> src/unreal/deserializer.rs:157:57
|
157 | let (decoded, _, had_errors) = WINDOWS_1252.decode(&bytes);
| ^^^^^^ method not found in `&'static Encoding`
error[E0599]: no method named `encode` found for reference `&'static Encoding` in the current scope
--> src/unreal/serializer.rs:110:57
|
110 | let (encoded, _, had_errors) = WINDOWS_1252.encode(string);
| ^^^^^^ method not found in `&'static Encoding`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `trilogy-save-editor` due to 4 previous errors
Same with cargo build --release
.
When I compile with cargo build -p app
(the command from CI) there's the same error from above, "expected enum Result
, found ()
". It doesn't go away anymore if I change the toolchains. I nuked ~/.rustup
and ~/.cargo
to make sure, reinstalled Rust with rustup
and then ran
rustup target add wasm32-unknown-unknown
npm update
cargo install cargo-make trunk
cargo make release
Still the same error "method not found in &'static Encoding
".
So it seems encoding_rs
was updated 14 hours ago after being mostly idle for a year. After I cleaned the repo Cargo.lock
was recreated with the latest versions that broke the build. I don't know Rust but shouldn't you also publish your Cargo.lock
so the build is stable? Otherwise the latest versions of all dependencies seem to be chosen and that's not always what you want.
I downgraded the encoding_rs
version in Cargo.lock
, set it to 0.8.28
and removed the checksum line, after that the error was gone. I also removed the optimization line as you suggested, it helped with the HTML error. The build still doesn't succeed with the same error as in https://github.com/KarlitosVII/trilogy-save-editor/issues/7#issuecomment-945228319 I suspect it might also be the result of unexpected dependency upgrade. Please publish your Cargo.lock
so we're on the same page!
Indeed, some dependencies updates were causing problems. Sorry about that. Latest commit should works now.
Thank you for your time and efforts 🙏 Now after removing <link data-trunk rel="rust" data-wasm-opt="3" />
(it still doesn't work with wasm-opt with it) I can build and launch the program. However, this is all I see:
It doesn't seem possible to actually load the save, there are no buttons or context menus...
Ok, some progress. Instead of removal that wasm-opt line should be changed to <link data-trunk rel="rust" data-wasm-opt="1" />
(2 doesn't work), then I get the UI. I can load the save file passing it as an argument but both Open
and Save
buttons result in crash: thread 'main' panicked at 'not yet implemented', /home/rkfg/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.5.2/src/platform_impl/linux/window.rs:608:5
Okay, I tested TSE in a virtual box and it should be fine with the latest commit. I still don't know why you have issues with wasm-opt because it should optimize the same way regardless of the system that execute it. I did not have any issue on Ubuntu 20.04.
I think it has something to do with trunk
. It's a 3rd-party program I presume, I had to install it manually using cargo install trunk
. Maybe I need a specific version? How do you install it? It's not described in README.
Oh, and btw with data-wasm-opt="1"
and your latest commit it finally works as expected! :tada: Many thanks! Would be great to find what's wrong with wasm-opt though so it works out of the box.
How feasible is supporting Linux in this?
Since ME:LE (and other ME games) runs over Proton (currently with a lot of patches required) and some people may prefer Linux over Windows for their gaming, a save editor might be wanted for them (and me) as well.