THMonster / Revda

Tools to play live stream with danmaku.
GNU General Public License v2.0
214 stars 12 forks source link

Failed to build on a Debian ARM distribution #45

Closed hsghost closed 2 years ago

hsghost commented 2 years ago

Hi there,

I'm trying to build and install Revada on a Debian distribution on Tinker Board, which employs a Rockchip RK3288 SoC, which is of armhf architecture, and 2 GB of RAM. All of the earlier procedures went smoothly, until make:

user@debian:~/src/Revda/build$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Cargo: /home/user/.cargo/bin/cargo (found version "1.61.0") 
-- Found Rust: /home/user/.cargo/bin/rustc (found version "1.61.0") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/src/Revda/build
user@debian:~/src/Revda/build$ make
[ 50%] Generating ../dmlive/target/release/dmlive
    Updating crates.io index
  Downloaded http-body v0.4.5
  Downloaded event-listener v2.5.2
  Downloaded bytes v0.4.12
  Downloaded tokio v1.19.0
  Downloaded bitflags v1.3.2
  Downloaded bincode v1.3.3
  Downloaded directories v4.0.1
  Downloaded async-compression v0.3.14
  Downloaded brotli-decompressor v2.3.2
  Downloaded anyhow v1.0.57
  Downloaded atty v0.2.14
  Downloaded futures-task v0.3.21
  Downloaded httparse v1.7.1
  Downloaded cc v1.0.73
  Downloaded adler v1.0.2
  Downloaded aho-corasick v0.7.18
  Downloaded bit-vec v0.6.3
  Downloaded foreign-types v0.3.2
  Downloaded futures-sink v0.3.21
  Downloaded dirs-sys v0.3.7
  Downloaded digest v0.9.0
  Downloaded hyper-tls v0.5.0
  Downloaded bytes v1.1.0
  Downloaded tower-service v0.3.1
  Downloaded fancy-regex v0.10.0
  Downloaded thiserror-impl v1.0.31
  Downloaded toml v0.5.9
  Downloaded urlencoding v2.1.0
  Downloaded unicode-width v0.1.9
  Downloaded http v0.2.7
  Downloaded vec_map v0.8.2
  Downloaded utf8-width v0.1.6
  Downloaded utf-8 v0.7.6
  Downloaded tracing-core v0.1.26
  Downloaded version_check v0.9.4
  Downloaded tracing v0.1.34
  Downloaded xmlparser v0.13.3
  Downloaded want v0.3.0
  Downloaded unicode-normalization v0.1.19
  Downloaded ansi_term v0.12.1
  Downloaded url v2.2.2
  Downloaded roxmltree v0.14.1
  Downloaded reqwest v0.11.10
  Downloaded serde_urlencoded v0.7.1
  Downloaded serde_derive v1.0.137
  Downloaded textwrap v0.11.0
  Downloaded tinyvec_macros v0.1.0
  Downloaded smallvec v1.8.0
  Downloaded futures v0.3.21
  Downloaded tokio-util v0.7.3
  Downloaded tokio-util v0.6.10
  Downloaded futures-io v0.3.21
  Downloaded httpdate v1.0.2
  Downloaded cfg-if v1.0.0
  Downloaded futures-channel v0.3.21
  Downloaded form_urlencoded v1.0.1
  Downloaded concurrent-queue v1.2.2
  Downloaded time v0.1.43
  Downloaded env_logger v0.9.0
  Downloaded fnv v1.0.7
  Downloaded getrandom v0.2.6
  Downloaded h2 v0.3.13
  Downloaded hyper v0.14.19
  Downloaded indexmap v1.8.2
  Downloaded matches v0.1.9
  Downloaded log v0.4.17
  Downloaded iovec v0.1.4
  Downloaded mime v0.3.16
  Downloaded ipnet v2.5.0
  Downloaded openssl-macros v0.1.0
  Downloaded once_cell v1.12.0
  Downloaded num_cpus v1.13.1
  Downloaded miniz_oxide v0.5.3
  Downloaded native-tls v0.2.10
  Downloaded pin-utils v0.1.0
  Downloaded openssl-probe v0.1.5
  Downloaded mio v0.8.3
  Downloaded openssl v0.10.40
  Downloaded percent-encoding v2.1.0
  Downloaded openssl-sys v0.9.74
  Downloaded parking_lot_core v0.9.3
  Downloaded rand_chacha v0.3.1
  Downloaded rand_core v0.6.3
  Downloaded regex v1.5.6
  Downloaded async-channel v1.6.1
  Downloaded num-traits v0.2.15
  Downloaded ppv-lite86 v0.2.16
  Downloaded memchr v2.5.0
  Downloaded num-integer v0.1.45
  Downloaded lazy_static v1.4.0
  Downloaded itoa v1.0.2
  Downloaded rand v0.8.5
  Downloaded alloc-no-stdlib v2.0.3
  Downloaded quick-error v1.2.3
  Downloaded futures-macro v0.3.21
  Downloaded lock_api v0.4.7
  Downloaded futures-core v0.3.21
  Downloaded cache-padded v1.2.0
  Downloaded block-buffer v0.9.0
  Downloaded opaque-debug v0.3.0
  Downloaded html-escape v0.2.11
  Downloaded alloc-stdlib v0.2.1
  Downloaded foreign-types-shared v0.1.1
  Downloaded encoding_rs v0.8.31
  Downloaded chrono v0.4.19
  Downloaded base64 v0.13.0
  Downloaded proc-macro2 v1.0.39
  Downloaded autocfg v1.1.0
  Downloaded quote v1.0.18
  Downloaded clap v2.34.0
  Downloaded libc v0.2.126
  Downloaded bit-set v0.5.2
  Downloaded regex-syntax v0.6.26
  Downloaded futures-util v0.3.21
  Downloaded brotli v3.3.4
  Downloaded slab v0.4.6
  Downloaded serde v1.0.137
  Downloaded ryu v1.0.10
  Downloaded thiserror v1.0.31
  Downloaded crc32fast v1.3.2
  Downloaded scopeguard v1.1.0
  Downloaded sha-1 v0.9.8
  Downloaded tinyvec v1.6.0
  Downloaded serde_json v1.0.81
  Downloaded futures-executor v0.3.21
  Downloaded syn v1.0.96
  Downloaded signal-hook-registry v1.4.0
  Downloaded tokio-tungstenite v0.16.1
  Downloaded strsim v0.8.0
  Downloaded openssl-src v111.20.0+1.1.1o
  Downloaded uuid v0.8.2
  Downloaded unicode-ident v1.0.0
  Downloaded termcolor v1.1.3
  Downloaded pkg-config v0.3.25
  Downloaded pin-project-lite v0.2.9
  Downloaded unicode-bidi v0.3.8
  Downloaded typenum v1.15.0
  Downloaded tokio-native-tls v0.3.0
  Downloaded socket2 v0.4.4
  Downloaded parking_lot v0.12.1
  Downloaded tungstenite v0.16.0
  Downloaded try-lock v0.2.3
  Downloaded tokio-macros v1.8.0
  Downloaded idna v0.2.3
  Downloaded humantime v2.1.0
  Downloaded hashbrown v0.11.2
  Downloaded generic-array v0.14.5
  Downloaded flate2 v1.0.24
  Downloaded byteorder v1.4.3
  Downloaded 149 crates (15.5 MB) in 7.36s (largest was `openssl-src` at 5.1 MB)
   Compiling libc v0.2.126
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.96
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling futures-core v0.3.21
   Compiling pin-project-lite v0.2.9
   Compiling parking_lot_core v0.9.3
   Compiling once_cell v1.12.0
   Compiling bytes v1.1.0
   Compiling cc v1.0.73
   Compiling pkg-config v0.3.25
   Compiling smallvec v1.8.0
   Compiling scopeguard v1.1.0
   Compiling futures-sink v0.3.21
   Compiling futures-task v0.3.21
   Compiling itoa v1.0.2
   Compiling futures-channel v0.3.21
   Compiling futures-util v0.3.21
   Compiling version_check v0.9.4
   Compiling typenum v1.15.0
   Compiling serde_derive v1.0.137
   Compiling bitflags v1.3.2
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.21
   Compiling slab v0.4.6
   Compiling openssl v0.10.40
   Compiling fnv v1.0.7
   Compiling foreign-types-shared v0.1.1
   Compiling serde v1.0.137
   Compiling matches v0.1.9
   Compiling httparse v1.7.1
   Compiling native-tls v0.2.10
   Compiling tinyvec_macros v0.1.0
   Compiling lazy_static v1.4.0
   Compiling percent-encoding v2.1.0
   Compiling openssl-probe v0.1.5
   Compiling unicode-bidi v0.3.8
   Compiling hashbrown v0.11.2
   Compiling crc32fast v1.3.2
   Compiling alloc-no-stdlib v2.0.3
   Compiling ppv-lite86 v0.2.16
   Compiling adler v1.0.2
   Compiling byteorder v1.4.3
   Compiling try-lock v0.2.3
   Compiling encoding_rs v0.8.31
   Compiling httpdate v1.0.2
   Compiling serde_json v1.0.81
   Compiling tower-service v0.3.1
   Compiling base64 v0.13.0
   Compiling opaque-debug v0.3.0
   Compiling regex-syntax v0.6.26
   Compiling ryu v1.0.10
   Compiling anyhow v1.0.57
   Compiling utf-8 v0.7.6
   Compiling bit-vec v0.6.3
   Compiling cache-padded v1.2.0
   Compiling unicode-width v0.1.9
   Compiling humantime v2.1.0
   Compiling strsim v0.8.0
   Compiling utf8-width v0.1.6
   Compiling xmlparser v0.13.3
   Compiling termcolor v1.1.3
   Compiling mime v0.3.16
   Compiling event-listener v2.5.2
   Compiling quick-error v1.2.3
   Compiling ipnet v2.5.0
   Compiling vec_map v0.8.2
   Compiling ansi_term v0.12.1
   Compiling urlencoding v2.1.0
   Compiling lock_api v0.4.7
   Compiling indexmap v1.8.2
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling openssl-src v111.20.0+1.1.1o
   Compiling generic-array v0.14.5
   Compiling foreign-types v0.3.2
   Compiling http v0.2.7
   Compiling tinyvec v1.6.0
   Compiling tracing-core v0.1.26
   Compiling form_urlencoded v1.0.1
   Compiling alloc-stdlib v0.2.1
   Compiling miniz_oxide v0.5.3
   Compiling concurrent-queue v1.2.2
   Compiling textwrap v0.11.0
   Compiling bit-set v0.5.2
   Compiling html-escape v0.2.11
   Compiling roxmltree v0.14.1
   Compiling openssl-sys v0.9.74
   Compiling tracing v0.1.34
   Compiling http-body v0.4.5
   Compiling unicode-normalization v0.1.19
   Compiling brotli-decompressor v2.3.2
   Compiling quote v1.0.18
   Compiling async-channel v1.6.1
   Compiling aho-corasick v0.7.18
   Compiling want v0.3.0
   Compiling num_cpus v1.13.1
   Compiling socket2 v0.4.4
   Compiling mio v0.8.3
   Compiling signal-hook-registry v1.4.0
   Compiling getrandom v0.2.6
   Compiling iovec v0.1.4
   Compiling atty v0.2.14
   Compiling time v0.1.43
   Compiling dirs-sys v0.3.7
   Compiling flate2 v1.0.24
   Compiling idna v0.2.3
   Compiling brotli v3.3.4
   Compiling parking_lot v0.12.1
   Compiling regex v1.5.6
   Compiling rand_core v0.6.3
   Compiling uuid v0.8.2
   Compiling bytes v0.4.12
   Compiling clap v2.34.0
   Compiling directories v4.0.1
   Compiling block-buffer v0.9.0
   Compiling digest v0.9.0
   Compiling url v2.2.2
   Compiling chrono v0.4.19
   Compiling env_logger v0.9.0
   Compiling fancy-regex v0.10.0
   Compiling rand_chacha v0.3.1
   Compiling tars-stream v0.1.0 (/home/user/src/Revda/dmlive/tars-stream)
warning: field is never read: `len`
  --> tars-stream/src/tars_decoder.rs:19:5
   |
19 |     len: u8,
   |     ^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
note: `Head` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> tars-stream/src/tars_decoder.rs:15:10
   |
15 | #[derive(Debug)]
   |          ^^^^^
   = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `tars-stream` (lib) generated 1 warning
   Compiling tokio-macros v1.8.0
   Compiling futures-macro v0.3.21
   Compiling openssl-macros v0.1.0
   Compiling thiserror-impl v1.0.31
   Compiling sha-1 v0.9.8
   Compiling rand v0.8.5
   Compiling tokio v1.19.0
   Compiling thiserror v1.0.31
   Compiling futures-executor v0.3.21
   Compiling tokio-util v0.7.3
   Compiling tokio-util v0.6.10
   Compiling async-compression v0.3.14
   Compiling futures v0.3.21
   Compiling h2 v0.3.13
   Compiling serde_urlencoded v0.7.1
   Compiling toml v0.5.9
   Compiling bincode v1.3.3
   Compiling hyper v0.14.19
   Compiling tokio-native-tls v0.3.0
   Compiling tungstenite v0.16.0
   Compiling hyper-tls v0.5.0
   Compiling reqwest v0.11.10
   Compiling tokio-tungstenite v0.16.1
   Compiling dmlive v5.0.2 (/home/user/src/Revda/dmlive)
warning: unused import: `log::warn`
 --> src/danmaku/fudujikiller.rs:7:5
  |
7 | use log::warn;
  |     ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: variant is never constructed: `RequestRestart`
  --> src/dmlive.rs:25:5
   |
25 |     RequestRestart,
   |     ^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: variant is never constructed: `RequestExit`
  --> src/dmlive.rs:26:5
   |
26 |     RequestExit,
   |     ^^^^^^^^^^^

warning: field is never read: `ipc_manager`
  --> src/streamfinder/mod.rs:18:5
   |
18 |     ipc_manager: Arc<crate::ipcmanager::IPCManager>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `mtx`
  --> src/streamfinder/mod.rs:20:5
   |
20 |     mtx: async_channel::Sender<DMLMessage>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `header_len`
  --> src/danmaku/bilibili.rs:25:5
   |
25 |     header_len: u16,
   |     ^^^^^^^^^^^^^^^

warning: field is never read: `seq`
  --> src/danmaku/bilibili.rs:28:5
   |
28 |     seq: u32,
   |     ^^^^^^^^

warning: field is never read: `mtx`
  --> src/streamer/flv.rs:23:5
   |
23 |     mtx: async_channel::Sender<DMLMessage>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `cm`
  --> src/streamer/hls.rs:15:5
   |
15 |     cm: Arc<ConfigManager>,
   |     ^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `mtx`
  --> src/streamer/hls.rs:16:5
   |
16 |     mtx: async_channel::Sender<DMLMessage>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `cm`
  --> src/streamer/youtube.rs:19:5
   |
19 |     cm: Arc<ConfigManager>,
   |     ^^^^^^^^^^^^^^^^^^^^^^

warning: field is never read: `mtx`
  --> src/streamer/youtube.rs:20:5
   |
20 |     mtx: async_channel::Sender<DMLMessage>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `dmlive` (bin "dmlive") generated 12 warnings
    Finished release [optimized] target(s) in 22m 09s
[ 50%] Built target dmlive-bin
[100%] Generating src-tauri/target/release/revda
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 76.27s.
yarn run v1.22.19
$ vue-tsc --noEmit && vite build

<--- Last few GCs --->

[24675:0x22c45f8]   150849 ms: Mark-sweep 491.1 (513.8) -> 487.9 (514.8) MB, 1654.0 / 0.0 ms  (average mu = 0.755, current mu = 0.205) allocation failure scavenge might not succeed
[24675:0x22c45f8]   153961 ms: Mark-sweep 492.1 (514.8) -> 489.0 (515.8) MB, 2658.2 / 0.0 ms  (average mu = 0.536, current mu = 0.146) allocation failure scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Aborted
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make[2]: *** [CMakeFiles/revda-bin.dir/build.make:74: src-tauri/target/release/revda] Error 134
make[1]: *** [CMakeFiles/Makefile2:138: CMakeFiles/revda-bin.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I've tried both setting up a swap, and NODE_OPTIONS=--max_old_space_size=4096, yet nothing seemed to help. Still failed with the same error messages.

Any ideas on this? I understand that the app is designed to run under x86/x64, is this the cause? Could there be a possibility for porting?

Thanks,

THMonster commented 2 years ago

I have no idea about this. Theoretically, it should be fine on aarch64. Tauri will consume a large amount of both RAM and disk space on building, 2GB is definitely not enough.

hsghost commented 2 years ago

Worked around the above problem by setting NODE_OPTIONS=--max_old_space_size=1536, which is 2 GB - 512 MB, as suggest in vitejs/vite#2433.

Yet, some other hidden dependencies were discovered - libwebkit2gtk-4.0-dev, libjavascriptcoregtk-4.0-dev, libgtk-3-dev, librust-openssl-dev, libdbus-1-dev and pkg-config, and may be even more on a barebone Debian distor - which should be covered in the README or Wiki, I suggest. It took me several hours to resolve these all.

hsghost commented 2 years ago

Well, it finished the build process, yet stuck the same problem of JavaScript heap overflow during make install. What an unfortunate outcome...

I can see that the build has made a .deb file under some path, is it possible to install it directly through dpkg? Any side effect installing it like this?

THMonster commented 2 years ago

Worked around the above problem by setting NODE_OPTIONS=--max_old_space_size=1536, which is 2 GB - 512 MB, as suggest in vitejs/vite#2433.

Yet, some other hidden dependencies were discovered - libwebkit2gtk-4.0-dev, libjavascriptcoregtk-4.0-dev, libgtk-3-dev, librust-openssl-dev, libdbus-1-dev and pkg-config, and may be even more on a barebone Debian distor - which should be covered in the README or Wiki, I suggest. It took me several hours to resolve these all.

This is the difference between distros, I cannot list all the trivia from every distros. For example, webkit2gtk means you should install some about webkit2gtk on your distro, it may not be called "webkit2gkt" exactly on your distro.

THMonster commented 2 years ago

Well, it finished the build process, yet stuck the same problem of JavaScript heap overflow during make install. What an unfortunate outcome...

I can see that the build has made a .deb file under some path, is it possible to install it directly through dpkg? Any side effect installing it like this?

That deb file is auto packing by tauri build system, I don't recommend to using that.

hsghost commented 2 years ago

Hmm... I've tried it. Seems it only installs the GUI part. The dmlive daemon is not installed, so nothing functioning, I guess.

Will try to tweak the JavaScript heap later, see if I could get it to work.

hsghost commented 2 years ago

Manually copying the dmlive executable into /usr/bin does the trick, although I may have to change my distro again as I discovered there's no mpp support for hwdec on the current one, so mpv is constantly dropping frames.

Anyway, it's fairly possible to get Revda to work on a resource limited ARM SBC, I conclude. Actually, I managed to get the older version qliveplayer to work on a Ubuntu on Surface 3, which also had merely 2 GB of RAM, without any frills. Just reporting these to the community, so that anyone interested can make reference.

Thanks for your work, @THMonster .