gpt4 book ai didi

rust - 编译bevy_dylib v0.5.0错误: linking with `cc` failed: exit status: 1

转载 作者:行者123 更新时间:2023-12-05 04:40:24 32 4
gpt4 key购买 nike

在刚刚升级到 Monterey 的 Mac 上,我在尝试 cargo run 一个普通的 Bevy 程序时得到以下信息。我已经像推荐的那样重新安装了 XCode CLT here和其他地方。我试过弄乱一些 cargo.yml 但没有成功。

   Compiling bevy_dylib v0.5.0
error: linking with `cc` failed: exit status: 1
note: "cc" "-Wl,-exported_symbols_list,/var/folders/rp/lky8r76j5v5dk0rqg_yzk35w0000gn/T/rustcDYBmaq/list"
"-m64" "-arch" "x86_64" <......... many pages of warnings>
ld: warning: object file (/Users/BWStearns/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy-glsl-to-spirv-0.2.1/build/osx/libSPIRV-Tools-opt.glsltospirv.a(const_folding_rules.cpp.o)) was built for newer macOS version (10.13) than being linked (10.7)
<many more pages of warnings>
"_CGDisplayCreateUUIDFromDisplayID", referenced from:
_$LT$winit..platform_impl..platform..monitor..MonitorHandle$u20$as$u20$core..cmp..PartialEq$GT$::eq::h541b069daf520ec9 in libwinit-4f8b93ad49cc21f8.rlib(winit-4f8b93ad49cc21f8.winit.355ded65-cgu.6.rcgu.o)
_$LT$winit..platform_impl..platform..monitor..MonitorHandle$u20$as$u20$core..cmp..Ord$GT$::cmp::h951d61f6bd1d7a5f in libwinit-4f8b93ad49cc21f8.rlib(winit-4f8b93ad49cc21f8.winit.355ded65-cgu.6.rcgu.o)
winit::platform_impl::platform::monitor::MonitorHandle::ns_screen::h3207f8aed4eae22f in libwinit-4f8b93ad49cc21f8.rlib(winit-4f8b93ad49cc21f8.winit.355ded65-cgu.6.rcgu.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `bevy_dylib` due to previous error

cargo.yml 是这样的:

[package]
name = "my_bevy_game"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.5.0", features = ["dynamic"] }

我这周刚开始遇到这个问题。我很确定这个确切的代码几周前编译得很好。任何帮助将不胜感激。

main.rs 看起来像

use bevy::prelude::*;

struct Person;

struct Name(String);

fn add_people(mut commands: Commands) {
commands.spawn().insert(Person).insert(Name("Elaina Proctor".to_string()));
commands.spawn().insert(Person).insert(Name("Renzo Hume".to_string()));
commands.spawn().insert(Person).insert(Name("Zayna Nieves".to_string()));
}

fn greet_people(query: Query<&Name, With<Person>>) {
for name in query.iter() {
println!("hello {}!", name.0);
}
}

pub struct HelloPlugin;

impl Plugin for HelloPlugin {
fn build(&self, app: &mut AppBuilder) {
app.add_startup_system(add_people.system())
.add_system(greet_people.system());
}
}

fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_plugin(HelloPlugin)
.run();
}

更新:

肯定与我机器上的环境有关,因为在不同的 macbook 上它运行良好。

最佳答案

所以我找到了解决方案,如果你发现这个问题并且代码在其他机器上工作。使用 rustup self uninstall 卸载 rust,然后使用标准脚本 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | 重新安装sh 然后你应该很好。

关于rust - 编译bevy_dylib v0.5.0错误: linking with `cc` failed: exit status: 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70283054/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com