Error: Library not loaded - Issue with 'librustc_driver' when building Solana project

74 Views Asked by At

I encountered an issue while trying to build my Solana project using the anchor build command. The error message I received is as follows:

error: process didn't exit successfully: `rustc -vV` (signal: 6, SIGABRT: process abort signal)
--- stderr
dyld: Library not loaded: @rpath/librustc_driver-c9ef59bea954d042.dylib
  Referenced from: /Users/zoro/.rustup/toolchains/solana/bin/rustc
  Reason: no suitable image found.  Did find:
    /Users/zoro/.cache/solana/v1.37/platform-tools/rust/bin/../lib/librustc_driver-c9ef59bea954d042.dylib: cannot load 'librustc_driver-c9ef59bea954d042.dylib' (load command 0x80000034 is unknown)
    /Users/zoro/.cache/solana/v1.37/platform-tools/rust/bin/../lib/librustc_driver-c9ef59bea954d042.dylib: stat() failed with errno=1
    /Users/zoro/.rustup/toolchains/solana/lib/librustc_driver-c9ef59bea954d042.dylib: cannot load 'librustc_driver-c9ef59bea954d042.dylib' (load command 0x80000034 is unknown)
    /Users/zoro/.rustup/toolchains/solana/lib/librustc_driver-c9ef59bea954d042.dylib: stat() failed with errno=1

I attempted to resolve the issue by following these steps:

  1. Cleared the Solana cache using rm -rf ~/.cache/solana/*.
  2. Ran the anchor build command to build my Solana project.

However, I encountered the following error:

error: process didn't exit successfully: `rustc -vV` (signal: 6, SIGABRT: process abort signal)
--- stderr
dyld: Library not loaded: @rpath/librustc_driver-c9ef59bea954d042.dylib
  Referenced from: /Users/zoro/.rustup/toolchains/solana/bin/rustc
  Reason: no suitable image found.  Did find:
    /Users/zoro/.cache/solana/v1.37/platform-tools/rust/bin/../lib/librustc_driver-c9ef59bea954d042.dylib: cannot load 'librustc_driver-c9ef59bea954d042.dylib' (load command 0x80000034 is unknown)
    /Users/zoro/.cache/solana/v1.37/platform-tools/rust/bin/../lib/librustc_driver-c9ef59bea954d042.dylib: stat() failed with errno=1
    /Users/zoro/.rustup/toolchains/solana/lib/librustc_driver-c9ef59bea954d042.dylib: cannot load 'librustc_driver-c9ef59bea954d042.dylib' (load command 0x80000034 is unknown)
    /Users/zoro/.rustup/toolchains/solana/lib/librustc_driver-c9ef59bea954d042.dylib: stat() failed with errno=1
0

There are 0 best solutions below