Discord presence - Clean up code and migrate to Lachee's Discord RPC C# library
Can you write a one-sentence description of your request? The current Discord code is messy and depends on unmanaged code, so clean it up and migrate it to Lachee's Discord RPC C# library: https://github.com/Lachee/discord-rpc-csharp
What is the current behavior? Discord presence code is poorly encapsulated and wraps and calls the deprecated unmanaged Discord RPC library.
What is the expected behavior? It should be well encapsulated and call a supported library, preferably one which is purely managed code.
What is the motivation / use case for changing the behavior?
- Original motivation is Sentry report TJAPLAYER3-K, which describes a crash when starting to play a song. The crash location is at the point of updating Discord presence, and its suspected provocation is an empty note chart.
- Reviewing calls to update Discord presence revealed poor encapsulation of the Discord-related code together with manual management of memory utilized by unmanaged code.
- It also reminded me that we currently carry the discord-rpc.dll unmanaged library alongside the exe when packaging for release, and it is always nice to eliminate unmanaged code where possible.
Same problem, It's also happened on x64.
i encountered same issue (on ALARM, Asahi Linux), and solved this ways (notice it seems building successfully, but i haven't consider to work correctly yet)
if [[ $CARCH != x86_64 ]]; then
export CARGO_PROFILE_RELEASE_LTO=off
fi
+ if [[ $CARCH = aarch64 ]]; then
+ _features+="generate,"
+ fi
+
cargo build --frozen --features "${_features:-}" --release --target-dir target
i feel like this is a problem with AUR's PKGBUILD, not paru? and same issues occurred in other arch?
I have also found that paru needs clang to be built successfully. So based on current PKGBUILD on AUR, we need to add generate feature when $CARCH is aarch64, and we need to add clang in makedepends
Error message when no clang is found
error: failed to run custom build command for `alpm-sys v3.0.0 (https://github.com/archlinux/alpm.rs?rev=306342#306342ef)`
Caused by:
process didn't exit successfully: `/build/paru/src/paru-2.0.3/target/release/build/alpm-sys-be4c6ce6af3606c2/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ALPM_LIB_DIR
cargo:rerun-if-env-changed=LIBALPM_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=SYSROOT
cargo:rustc-link-search=native=/usr/lib
cargo:rustc-link-lib=alpm
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=ALPM_INCLUDE_DIR
--- stderr
thread 'main' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/lib.rs:604:31:
Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
But I still have no idea about why the PKGBUILD works without issue on my x86_64 device. Maybe it is generate feature that requires clang?
here's feature dependencies:
-
paru/generate-
alpm/generate-
alpm-sys/generate
-
-
so generate actually affects alpm-sys, and it have feature of generation glue codes with rust-bindgen. rust-bindgen requires libclang (ref.) for parsing headers file (so here it's alpm.h).
generation process is here (./build.rs). but same process found here (./bindgen) written by sh (it depends bindgen-cli) but i guess it is for dev.
therefore libclang requires on building paru, so seems necessary append clang>=5 (libclang provides by extra/clang, and rust-bindgen requires Clang 5.0 or above, but Arch doesn't have more older it, maybe this specifier isn't needed) to makedepends of PKGBUILD.
Same problem, It's also happened on x64.
@HeyLoon I think you need to create a separate issue because I tested building in a clean x86_64 chroot environment and it works well.
this fixed building on aarch64 for me. can we get the AUR git updated?