Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Library not loaded: @rpath/libLTO.dylib - Reason: image not found #107

Closed
DerekCrosson opened this issue Apr 18, 2022 · 3 comments
Closed

Comments

@DerekCrosson
Copy link

I don't have enough disk space to download and install Xcode.app so I downloaded the latest zld binary and moved it to my user directory, then added it to the path. This is the output when I run cargo watch -x check -x test -x run:

[Running 'cargo check && cargo test && cargo run']
    Checking email-newsletter v0.1.0 (/Volumes/DataStorage/CodeRepos/email-newsletter)
    Finished dev [unoptimized + debuginfo] target(s) in 0.87s
   Compiling email-newsletter v0.1.0 (/Volumes/DataStorage/CodeRepos/email-newsletter)
error: linking with `cc` failed: exit status: 254
  |
  = note: "cc" "-m64" "-arch" "x86_64" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.119utbgb6sklrmny.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.238ezk0u3lhsox0c.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.2dcdtu3ls8tkzldn.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.41ufewda175mbemm.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.42zln2t70lwha9sx.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.4jp3cfhagr9urn2v.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.qw45qoou779hoex.rcgu.o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a.47bz974wqy9tttab.rcgu.o" "-L" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps" "-L" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-77ee8c29c330e4a3.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-0bbae02160b24516.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunicode_width-ce5857cb149a5e3e.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_std-60dd2b72a4b069df.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-04b20da5d2b4e02d.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-00f5b50d82ace1e3.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-45c041bae4e30a62.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-1bc22f5f5be77a23.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-caa784d0cecbd501.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-0ad46247e89234f6.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-68dabd8f37218f7c.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-4c67204728564461.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-eca93a0d11ef9a39.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-6ddabe46ef182f8b.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-7dc1037a76f2c18c.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-100dc4191a6287d7.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-c596c47fc21af016.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-c7163fef4a8cdd33.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-3463abc69f183e66.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-12a50039d8929e4e.rlib" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-a4134bbc9f4f0dab.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/derek/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Volumes/DataStorage/CodeRepos/email-newsletter/target/debug/deps/email_newsletter-8d05e5d3049ed29a" "-Wl,-dead_strip" "-nodefaultlibs" "-fuse-ld=/Users/derek/zld"
  = note: dyld: Library not loaded: @rpath/libLTO.dylib
            Referenced from: /Users/derek/zld
            Reason: image not found
          clang: error: unable to execute command: Abort trap: 6
          clang: error: linker command failed due to signal (use -v to see invocation)


error: could not compile `email-newsletter` due to previous error
[Finished running. Exit status: 101]

And this is my .cargo/config.toml:

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/Users/derek/zld"]

Any ideas how to solve this?

@bjorn3
Copy link

bjorn3 commented Apr 18, 2022

Duplicate of #69. You need XCode to get libLTO.dylib. Based on #100 it seems that running install_name_tool -add_rpath /Library/Developer/CommandLineTools/usr/lib /Users/derek/zld may work after you have installed the xcode command line tools. If that doesn't work you will unfortunately have to install the entirety of XCode.

@DerekCrosson
Copy link
Author

install_name_tool -add_rpath /Library/Developer/CommandLineTools/usr/lib /Users/derek/zld

This worked, thanks @bjorn3! Really appreciate it 🙂

@michaeleisel
Copy link
Owner

1.3.4 has this change

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants