yewstack / yew

Rust / Wasm framework for creating reliable and efficient web applications

Home Page:https://yew.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jemalloc does not allow me to use the Yew repo on pure Windows

kirillsemyonkin opened this issue · comments

Problem
Jemalloc (used in a ssr_router_server example and a benchmark-ssr benchmark) is built using some sh script and, even if pure Windows had sh, it would still probably not compile. This prevents my VSCode/rust-analyzer from loading on the project (even though cargo test -p yew --all-features works). Please hide the related code/cargo setup behind non-windows/only-linux target, or remove Jemalloc from the entire Yew codebase altogether, so that I can contribute to Yew even without Linux/WSL.

Related errors

[ERROR rust_analyzer::main_loop] FetchBuildDataError:
error: failed to run custom build command for `jemalloc-sys v0.5.3+5.3.0-patched`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `D:\RustProjects\yew\target\debug\build\jemalloc-sys-e3d4755a63841779\build-script-build` (exit code: 101)
  --- stdout
  TARGET=x86_64-pc-windows-gnu
  HOST=x86_64-pc-windows-gnu
  NUM_JOBS=16
  OUT_DIR="D:\\RustProjects\\yew\\target\\debug\\build\\jemalloc-sys-31b9fca2a3ef0cad\\out"
  BUILD_DIR="D:\\RustProjects\\yew\\target\\debug\\build\\jemalloc-sys-31b9fca2a3ef0cad\\out\\build"
  SRC_DIR="D:\\RustDownloads\\cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\jemalloc-sys-0.5.3+5.3.0-patched"
  cargo:rustc-cfg=prefixed
  cargo:rerun-if-env-changed=JEMALLOC_OVERRIDE
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-pc-windows-gnu")
  HOST = Some("x86_64-pc-windows-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
  CC_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
  CC_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
  CFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
  CFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  CC="gcc.exe"
  CFLAGS="-O0 -ffunction-sections -fdata-sections -gdwarf-2 -fno-omit-frame-pointer -m64 -Wall"
  JEMALLOC_REPO_DIR="jemalloc"
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_MALLOC_CONF
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_PAGE
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_HUGEPAGE
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_QUANTUM
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_VADDR
  --with-jemalloc-prefix=_rjem_
  running: "sh" "D:/RustProjects/yew/target/debug/build/jemalloc-sys-31b9fca2a3ef0cad/out/build/configure" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=x86_64-w64-mingw32" "--build=x86_64-w64-mingw32" "--prefix=D:\\RustProjects\\yew\\target\\debug\\build\\jemalloc-sys-31b9fca2a3ef0cad\\out"

  --- stderr
  thread 'main' panicked at 'failed to execute command: program not found', D:\RustDownloads\cargo\registry\src\index.crates.io-6f17d22bba15001f\jemalloc-sys-0.5.3+5.3.0-patched\build.rs:342:19
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\std\src/panicking.rs:593:5
     1: core::panicking::panic_fmt
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\core\src/panicking.rs:67:14
     2: build_script_build::execute
     3: build_script_build::run_and_log
     4: build_script_build::main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Environment:

  • Yew version: master
  • IDE: VSCode/rust-analyzer
  • OS: Windows, not using WSL

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

@futursolo bug label may stay because my rust-analyzer stops working because of it, and I can't work on the entire Yew repo because of it, but you decide I guess

We should use jemalloc on targets where it is available. It improves the performance for about 100%~200% (as of the last time I tested it) and I recommend this configuration for production servers as well.

Maybe we can make jemalloc cfg(unix) so Windows would work?

I do not have Visual Studio installed on my Windows setup and don't want to do that.
Would it be possible for you to create a pull requests for this?

@futursolo

Maybe we can make jemalloc cfg(unix) so Windows would work?

Not only #[cfg(unix)], also cargo needs to depend on jemalloc only on non-windows targets. I believe its possible using [target.'cfg(unix)'.dependencies]

I do not have Visual Studio installed

Its VSCode, not Visual Studio. VSCode does not install MSVC, etc, its a minimal editor that runs LSPs like neovim (very rough approximation, but will do for this discussion)

Would it be possible for you to create a pull requests for this?

I might try, but if anyone is willing to do so before me, they are free to do so lol