ubunturustrust-cargobevy

Rust Bevy cannot run the release executable file; missing libbevy_dylib


I built Bevy on Ubuntu, but when I try to run the executable file in the target/release folder, it logs the following error:

./BevyPractice: error while loading shared libraries: libbevy_dylib-f672a45218b83a74.so: cannot open shared object file: No such file or directory

My command to build release: cargo build --release

I searched, and someone said that I need to remove dynamic linking in the release build. But I can't find a clear way to do it.

Here is my config.toml


[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [

    "-Clink-arg=-fuse-ld=lld",

]

[target.x86_64-apple-darwin]
rustflags = [

]

[target.aarch64-apple-darwin]
rustflags = [

]

[target.x86_64-pc-windows-msvc]

linker = "rust-lld.exe"
rustflags = [
]


[alias]
ci = "run --package ci --"

And here is cargo.toml of project

[package]
name = "BevyPractice"
version = "0.1.1"
edition = "2021"

[dependencies]
bevy = { version = "0.14" }
mo_editor = { path = "crates/mo_editor" }
mo_std = { path = "crates/mo_std" }

[workspace]
members = ["crates/*"]

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

I just want to test the workflow from creation to coding and finally building and sending the executable file to someone else.


Solution

  • The issue was due to my mo_editor having a dynamic_link.