Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

solana-test-validator Library not loaded error #200

Closed
interdailytop19 opened this issue May 10, 2021 · 35 comments
Closed

solana-test-validator Library not loaded error #200

interdailytop19 opened this issue May 10, 2021 · 35 comments

Comments

@interdailytop19
Copy link

interdailytop19 commented May 10, 2021

m1 chip
macOS 11.3.1
node version v14.16.1

when start solana-test-validator

dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /Users/123/.local/share/solana/install/active_release/bin/solana-test-validator
  Reason: image not found
zsh: abort      solana-test-validator

google searched this thread:
https://stackoverflow.com/questions/59006602/dyld-library-not-loaded-usr-local-opt-openssl-lib-libssl-1-0-0-dylib

but can't switch openssl vserion

Error: Unknown command: switch

tried different node versions
tried reinstall xcode and brew with no luck

which openssl
/usr/bin/openssl
cd /usr/local/opt/openssl@1.1
cd: no such file or directory: /usr/local/opt/openssl@1.1
@MohitKumar1991
Copy link

I can confirm this error on Mac M1. Even after linking the right library the message I get is

Referenced from: /Users/mohitkumar/.local/share/solana/install/active_release/bin/solana-test-validator Reason: no suitable image found. Did find: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib: mach-o, but wrong architecture /opt/homebrew/Cellar/openssl@1.1/1.1.1k/lib/libssl.1.1.dylib: mach-o, but wrong architecture

It looks like M1 is not supported right now. can you guys put instructions on how to compile for M1 ?

@astronaute77
Copy link

Linking openssl can be achieved with:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

But then you’ll run into this one:
solana-labs/solana#17406

@MohitKumar1991
Copy link

Yes. Just wanted to post here for anyone trying.

I tried to install docker and then get the solanalabs/rust image and install the cli on it. But there is a problem with AVX support there as well. The message I get is this machine does not support AVX. Apparently there is no way to run solana without CUDA.

Anyway if someone finds a way to run solana locally on a Mac M1 please let me know. I am able to run it on older Mac without any problem.

@interdailytop19
Copy link
Author

solana-labs/solana#17222

@jstarry
Copy link
Member

jstarry commented Jun 2, 2021

@MohitKumar1991 can you try installing Rosetta on your M1 mac and see if that resolves your issue? If so, it would be helpful to have some instructions for other users with this issue written up in a new PR if you have time

@interdailytop19
Copy link
Author

installing Rosetta didn't resolves my issue, got illegal hardware instruction error

@fanatid
Copy link
Contributor

fanatid commented Jun 17, 2021

I was able to run solana-test-validator for helloword example, but with compiled binary from source code with small changes:

- Checkout to `v1.7.1`
- Comment line with `spl-token-cli` installation, because it's not compilable right now due to `ring` crate: https://github.com/solana-labs/solana/blob/v1.7.1/scripts/cargo-install-all.sh#L135
- Cherry-pick code from https://github.com/solana-labs/solana/pull/17632

but still not able to deploy program to validator:

Error: Deploying program failed: unable to confirm transaction. This can happen in situations such as transaction expiration and insufficient fee-payer funds

@pra-dan
Copy link

pra-dan commented Jun 19, 2021

@MohitKumar1991 what did you go with ? Any solution till now ?

@yenicelik
Copy link

same issue here, Mac M1. any ideas how to circumvene?

@nhamthanh
Copy link

nhamthanh commented Jul 9, 2021

@MohitKumar1991

Did find: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib: mach-o, but wrong architecture /opt/homebrew/Cellar/openssl@1.1/1.1.1k/lib/libssl.1.1.dylib: mach-o, but wrong architecture

-> Just install rosetta 2 and new ur terminal with rosetta. Then install Homebrew, openssl on rosetta terminal.
It will run ok

But you will get new error like this
Ledger location: test-ledger Log: test-ledger/validator.log ⠙ Initializing... zsh: illegal hardware instruction solana-test-validator

By the way, I think this issue and issue #236 and illegal hardware instruction is same root cause ( solana is not work on ARM structure although using rosetta)
I think Maintaining should make openSSL and solana support structure ARM on M1 instead using rosetta because it make too much compiles errors.

@t-nelson
Copy link

The macos release binaries are not suitable for M1 silicon in any configuration as they are built for x86_64 arch with AVX and AVX2 extensions available. Building them from scratch under Rosetta is the workaround for now. See https://github.com/solana-labs/solana/blob/master/README.md#building

@evilboyajay
Copy link

You can set your config URL to https://api.devnet.solana.com
solana config set --url https://api.devnet.solana.com

@Mihail-Madzharov
Copy link

Is someone working on fix for M1?

@acamill
Copy link

acamill commented Sep 11, 2021

Still the same issue here. Currently my workaround is to dev against devnet, not optimal but works...

@pierreneter
Copy link
Contributor

@Mihail-Madzharov

Is someone working on fix for M1?

You can try with this guide of jaso from discord (https://discord.com/channels/428295358100013066/517163444747894795/884262811260289054):

I ran into trouble trying to build solana binaries with Apple M1 chip so I will post what made it work for me here (and anyone can always DM me if you run into trouble):

  1. Make sure you install rosetta and then install homebrew with a shell that is using rosetta: https://5balloons.info/correct-way-to-install-and-use-homebrew-on-m1-macs/
  2. Make sure you also install rust/cargo/rustup inside that rosetta shell as well bc it will target x86_64 instead of aarch64
  3. then install solana by following the "Build From Source" at the bottom of: https://docs.solana.com/cli/install-solana-cli-tools
    you may run into an issue with openssl, if you do, then brew install openssl (once again inside the rosetta shell)

@acamill
Copy link

acamill commented Sep 12, 2021

Thanks will try tonight. Other option is to build validatir from source, but I've issue making it work with the anchor test calls. Else I can run the 1.7.11 test validator built from source on my m1

@acamill
Copy link

acamill commented Sep 13, 2021

I am so thanksful for you taking the time to point me to these resources, merci @pierreneter

@acamill
Copy link

acamill commented Sep 13, 2021

And now IDK why but my rosetta terminal refuse to use the correct prefix, so installations still fail :/

ld: warning: ignoring file /opt/homebrew/opt/openssl@1.1/lib/libssl.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

I saw that prefix cannot be forced, but so solana is picking the wrong openssl build and arch is invalid.
Too much time, back to linux for now

@acamill
Copy link

acamill commented Sep 15, 2021

Got these additional informations about a full reinstall for Discord, if it can help anyone
image

@astronaute77
Copy link

Someone needs to start working on full M1 compatibility, Apple is only making those from now on. It makes no sense to rely on Roseta today unless it is a temporary workaround (no one confirmed it is the case).

@acamill
Copy link

acamill commented Sep 15, 2021

I agree, but I need to build, so I do what it takes
Seems it's up for grab, if you have the spirit for it 😏

@yangli-io
Copy link

Yeah didn't really work for me, I hope this gets fixed soon

@acamill
Copy link

acamill commented Sep 23, 2021

It does work, you need to nuke any brew or other things installed for the M1, and to reinstall the whole stack with a rosetta term. Including solana built from source
it's not straight forward, but it works

@ch3njust1n
Copy link

I'm using a rosetta terminal and still getting this issue. :/

@acamill
Copy link

acamill commented Oct 4, 2021

It does work, I have done it on several computers, a few times. You really need to wipe everything from brew upward

@nicoestrada
Copy link

Nuking the brew already configured on the m1 and reinstalling the stack with a rosetta term not ideal for me, wondering if anyone knows there will be a proposed alternate solution in the works?

@nicoestrada
Copy link

Got it to work by just cloning terminal with rosetta and starting from scratch that route...

@mrwatts88
Copy link

Good article on Rosetta workaround: https://dev.to/nickgarfield/how-to-install-solana-dev-tools-on-an-m1-mac-kfn

@jstarry jstarry closed this as completed Nov 18, 2021
@aronchick
Copy link

aronchick commented Nov 19, 2021

I get that this is an M1 problem, but literally anyone doing default install is going to be presented with this issue. I'm not sure why this is being closed.

Further, Rosetta was always designed to be a work around/temporary. Rosetta isn't even supported in all regions - https://9to5mac.com/2021/03/02/apple-may-disable-rosetta-2-on-m1-macs-in-some-regions-macos-11-3-code-suggests/

I get that this is not the top priority, but it makes it quite difficult to support the Solana ecosystem.

@gh-osama
Copy link

The solana-cli works on M1 now except the validator needs a recompile for M1. The edit/compile explained here worked.

@Ian-Bright
Copy link

Ian-Bright commented Apr 24, 2022

@jstarry Not sure why you closed this issue. A valid solution was not provided and it seems this will become evermore problematic as Apple will only be producing laptops with M1 chips.

@mb-mb
Copy link

mb-mb commented May 16, 2022

same problem here

@CryptoWizardsNet
Copy link

Ive tried everything multiple times. My computer is just throttling now due to the number of attempts. A full clean/reformat of the system might do it, but honestly that's ridiculous.

@mariesco
Copy link

For me work this:

  1. First install Solana from brew or with curl.
  2. Clone the repository of solana.
  3. git checkout v1.9.4.
  4. cargo build --release --bin solana-test-validator
  5. cd validator
  6. ./solana-test-validator

@amirvenus
Copy link

For me work this:

  1. First install Solana from brew or with curl.
  2. Clone the repository of solana.
  3. git checkout v1.9.4.
  4. cargo build --release --bin solana-test-validator
  5. cd validator
  6. ./solana-test-validator

It fails for me with the following output:

   Compiling unreachable v1.0.0
   Compiling bstr v0.2.17
   Compiling foreign-types v0.3.2
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
   --> sdk/program/src/account_info.rs:153:13
    |
153 | /             std::ptr::write_volatile(
154 | |                 self.owner as *const Pubkey as *mut [u8; 32],
155 | |                 new_owner.to_bytes(),
156 | |             );
    | |_____________^
    |
    = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
    = note: `#[deny(invalid_reference_casting)]` on by default

error: could not compile `solana-program` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

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

No branches or pull requests