Skip to content

Bevy Mac build regression: failure to link against pre-built static libs #91781

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
JohnHeitmann opened this issue Dec 11, 2021 · 3 comments
Closed
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-macos Operating system: macOS regression-untriaged Untriaged performance or correctness regression.

Comments

@JohnHeitmann
Copy link
Contributor

Code

Bevy fails to build on the Mac (MacOS 12.0.1 and 11.6) on beta and nightly.

git clone https://github.com/bevyengine/bevy.git
cd bevy
cargo +beta build --example spawner

I expected to see a successful build. Instead I see linker errors. There are a pile of warnings that look like:

          ld: warning: object file (/Users/johnheitmann/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/bevy-glsl-to-spirv-0.2.1/build/osx/libSPIRV-Tools-opt.glsltospirv.a(dominator_analysis.cpp.o)) was built for newer macOS version (10.13) than being linked (10.7)

Finally there is an error at the end:

          Undefined symbols for architecture x86_64:
            "_CGDisplayCreateUUIDFromDisplayID", referenced from:
                _$LT$winit..platform_impl..platform..monitor..MonitorHandle$u20$as$u20$core..cmp..PartialEq$GT$::eq::h5aa3c59440e6ac8d in libwinit-1320fdde5e8478c6.rlib(winit-1320fdde5e8478c6.winit.fc366755-cgu.7.rcgu.o)
                winit::platform_impl::platform::monitor::MonitorHandle::ns_screen::h88299b515fdff036 in libwinit-1320fdde5e8478c6.rlib(winit-1320fdde5e8478c6.winit.fc366755-cgu.7.rcgu.o)
            "_AudioUnitUninitialize", referenced from:
                _$LT$coreaudio..audio_unit..AudioUnit$u20$as$u20$core..ops..drop..Drop$GT$::drop::hd5a8c17b3c33bbb1 in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.rcgu.o)
            "_AudioComponentInstanceDispose", referenced from:
                _$LT$coreaudio..audio_unit..AudioUnit$u20$as$u20$core..ops..drop..Drop$GT$::drop::hd5a8c17b3c33bbb1 in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.rcgu.o)
            "_AudioComponentInstanceNew", referenced from:
                coreaudio::audio_unit::AudioUnit::new_with_flags::h8cc8bd2814fa9ce6 in libcpal-043d48cf28e3cb1d.rlib(cpal-043d48cf28e3cb1d.cpal.cee60390-cgu.6.rcgu.o)
            "_AudioComponentFindNext", referenced from:
                coreaudio::audio_unit::AudioUnit::new_with_flags::h8cc8bd2814fa9ce6 in libcpal-043d48cf28e3cb1d.rlib(cpal-043d48cf28e3cb1d.cpal.cee60390-cgu.6.rcgu.o)
            "_AudioOutputUnitStart", referenced from:
                coreaudio::audio_unit::AudioUnit::start::hc3bb1f7baec933ad in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.rcgu.o)
            "_AudioUnitInitialize", referenced from:
                coreaudio::audio_unit::AudioUnit::new_with_flags::h8cc8bd2814fa9ce6 in libcpal-043d48cf28e3cb1d.rlib(cpal-043d48cf28e3cb1d.cpal.cee60390-cgu.6.rcgu.o)
            "_AudioUnitGetProperty", referenced from:
                coreaudio::audio_unit::get_property::h20aa1f6d9ac31b47 in libcpal-043d48cf28e3cb1d.rlib(cpal-043d48cf28e3cb1d.cpal.cee60390-cgu.6.rcgu.o)
                coreaudio::audio_unit::get_property::haea935e1495e3091 in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.rcgu.o)
            "_AudioOutputUnitStop", referenced from:
                coreaudio::audio_unit::AudioUnit::stop::ha6cc95e68a9adfc3 in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.rcgu.o)
            "_AudioUnitSetProperty", referenced from:
                coreaudio::audio_unit::set_property::h307e018cffcd7c7e in librodio-f717c21d0a436003.rlib(rodio-f717c21d0a436003.rodio.6a656f76-cgu.0.rcgu.o)
                coreaudio::audio_unit::set_property::hebb6517845223892 in libcpal-043d48cf28e3cb1d.rlib(cpal-043d48cf28e3cb1d.cpal.cee60390-cgu.6.rcgu.o)
                coreaudio::audio_unit::set_property::hc9a95a04395225d8 in libcoreaudio-57ec5b105fae43e5.rlib(coreaudio-57ec5b105fae43e5.coreaudio.a94677e0-cgu.3.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)

Larger log attached.
bevy linker bug.txt

bevy depends on the glsl-to-spirv crate. The glsl-to-spirv crate has pre-built libraries on the Mac. When I inspected them, they are in fact pre-built for 10.13, but this is an invariant between the stable and beta builds.

Version it worked on

  • rustc 1.57.0
  • nightly-2021-11-25

Version with regression

Beta:

rustc 1.58.0-beta.2 (0e07bcb68 2021-12-04)
binary: rustc
commit-hash: 0e07bcb68b82b54c0c4ec6fe076e9d75b02109cf
commit-date: 2021-12-04
host: x86_64-apple-darwin
release: 1.58.0-beta.2
LLVM version: 13.0.0

First nightly w/ regression:

rustc 1.58.0-nightly (dd549dcab 2021-11-25)
binary: rustc
commit-hash: dd549dcab404ec4c7d07b5a83aca5bdd7171138f
commit-date: 2021-11-25
host: x86_64-apple-darwin
release: 1.58.0-nightly
LLVM version: 13.0.0

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@JohnHeitmann JohnHeitmann added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Dec 11, 2021
@rustbot rustbot added regression-from-stable-to-beta Performance or correctness regression from stable to beta. I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-untriaged Untriaged performance or correctness regression. and removed regression-untriaged Untriaged performance or correctness regression. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Dec 11, 2021
@rustbot rustbot added regression-from-stable-to-beta Performance or correctness regression from stable to beta. regression-untriaged Untriaged performance or correctness regression. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. regression-untriaged Untriaged performance or correctness regression. labels Dec 11, 2021
@JohnHeitmann
Copy link
Contributor Author

Next step for me: try to eliminate the bevy crate from the repro, since it's huge.

@hkratz
Copy link
Contributor

hkratz commented Dec 11, 2021

This is likely a duplicate of #91372. Can you try with setting the environment variable MACOSX_DEPLOYMENT_TARGET to 10.8 or higher for the build?

@rustbot label O-macos A-linkage

@rustbot rustbot added O-macos Operating system: macOS A-linkage Area: linking into static, shared libraries and binaries labels Dec 11, 2021
@JohnHeitmann
Copy link
Contributor Author

Yup, that's definitely it. Thanks!

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 6, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-macos Operating system: macOS regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

No branches or pull requests

4 participants