[feat] jemalloc编译问题
描述问题 / Describe the problem
cargo build --no-default-features --features=jemalloc
除了会启用jemalloc外仍然会尝试编译mimalloc,这在不支持mimalloc-rust的cpu架构上(例如loongarch)会编译失败。
分步执行:
cargo build --no-default-features --features=wireguard,jemalloc,websocket,smoltcp,tun,socks5 -p easytier
编译easytier-core easytier-cli正常
cargo build -p easytier-web
仍然会编译mimalloc-rust
cargo build --no-default-features --features=wireguard,jemalloc,websocket,smoltcp,tun,socks5 -p easytier-web
报错:the package 'easytier-web' does not contain these features: jemalloc, smoltcp, socks5, tun, websocket, wireguard
描述您想要的解决方案 / Describe the solution you'd like
目前的workaround是删除easytier/Cargo.toml
default = ["wireguard", "mimalloc", "websocket", "smoltcp", "tun", "socks5"]
里的mimalloc
不支持的架构使用
cargo build --features=jemalloc
这会影响正常架构的编译命令,是否有更优雅的解决方案
替代方案 / Alternatives considered
No response
额外上下文 / Additional context
No response
经查是easytier-web的Cargo.toml中easytier = { path = "../easytier" }引入了default features的esaytier,所以根目录下 cargo build --no-default-features不能关闭easytier的所有features
我感觉要不 workspace 的 default members 里把 easytier-web 去掉。两个 crate feature 不一样,一起编译就有可能遇到现在这个 feature 打架的情况
我感觉要不 workspace 的 default members 里把 easytier-web 去掉。两个 crate feature 不一样,一起编译就有可能遇到现在这个 feature 打架的情况
因为easytier-web里没指定easytier的feature,那编译easytier-web时easytier的feature就是default,workspace去不去掉easytier-web都不影响
cargo tree -p easytier-web --no-default-features -f "{p} {f}" | grep easytier
会显示easytier 是default,启用了mimalloc,在mimalloc-rust不支持的平台仍然无法编译
easytier-web v2.2.4 (/home/sena/git/EasyTier/easytier-web)
├── easytier v2.2.4 (/home/sena/git/EasyTier/easytier) default,mimalloc,smoltcp,socks5,tun,websocket,wireguard