dfinity / sdk

IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.
https://internetcomputer.org/developers
Apache License 2.0
174 stars 83 forks source link

ic-nns-init: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory #2848

Open levifeldman opened 1 year ago

levifeldman commented 1 year ago

I tried the following:

  1. dfx nns install

I expected to see this happen: install the nns canisters on the local replica.

Instead, this happened: The first error that came up was: ic-nns-init: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory. Looks like the error is because the ic-nns-init binary is looking for the specific libssl.so.1.1 file, instead of the standard libssl.so file that lets the operating system take care of the symlink to the latest version. Same thing happened with libcrypto: ic-nns-init: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory. To try to fix the above, in my terminal: sudo ln -s libssl.so libssl.so.1.1 && sudo ln -s libcrypto.so libcrypto.so.1.1 This got past those specific errors but 'dfx nns install' still errored out with a related error: .cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init: /lib64/libssl.so.1.1: version `OPENSSL_1_1_0' not found

Meta

dfx --version:

cargo build at e093d6b434f8d5cbbc5a0246ca19fb044928e3a3 on a fedora linux
0.12.2-beta.0+rev29.e093d6b4
Further log output

``` ic-nns-init --url http://127.0.0.1:39197/ --wasm-dir /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/wasms --initialize-ledger-with-test-accounts 5b315d2f6702cb3a27d826161797d7b2c2e131cd312aece51d4d5574d1247087 --initialize-ledger-with-test-accounts 2b8fbde99de881f695f279d2a892b1137bfe81a42d7694e064b1be58701e1138 --sns-subnet mvlfs-a5ji7-bt26q-ixlh4-g43ai-pog7g-6zg57-p24iv-nww7a-ognxh-wqe /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory Error: Failed to install NNS components. Caused by: Failed to install NNS components. Failed to install NNS components. ic-nns-init call failed ic-nns-init --url http://127.0.0.1:39197/ --wasm-dir /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/wasms --initialize-ledger-with-test-accounts 5b315d2f6702cb3a27d826161797d7b2c2e131cd312aece51d4d5574d1247087 --initialize-ledger-with-test-accounts 2b8fbde99de881f695f279d2a892b1137bfe81a42d7694e064b1be58701e1138 --sns-subnet mvlfs-a5ji7-bt26q-ixlh4-g43ai-pog7g-6zg57-p24iv-nww7a-ognxh-wqe /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory Error: Failed to install NNS components. Caused by: Failed to install NNS components. Failed to install NNS components. ic-nns-init call failed ic-nns-init --url http://127.0.0.1:39197/ --wasm-dir /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/wasms --initialize-ledger-with-test-accounts 5b315d2f6702cb3a27d826161797d7b2c2e131cd312aece51d4d5574d1247087 --initialize-ledger-with-test-accounts 2b8fbde99de881f695f279d2a892b1137bfe81a42d7694e064b1be58701e1138 --sns-subnet mvlfs-a5ji7-bt26q-ixlh4-g43ai-pog7g-6zg57-p24iv-nww7a-ognxh-wqe /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init: /lib64/libssl.so.1.1: version `OPENSSL_1_1_0' not found (required by /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init) /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init: /lib64/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /home/levi/.cache/dfinity/versions/0.12.2-beta.0+rev29.e093d6b4/ic-nns-init) Error: Failed to install NNS components. Caused by: Failed to install NNS components. Failed to install NNS components. ic-nns-init call failed ```

ninegua commented 1 year ago

With dfx 0.14.0 installed on a Mac M1 laptop, I got a similar error with dfx nns install:

$ ~/.cache/dfinity/versions/0.14.0/ic-nns-init 
dyld[78731]: Library not loaded: '/usr/local/opt/openssl@3/lib/libssl.3.dylib'
  Referenced from: '/Users/paul/.cache/dfinity/versions/0.14.0/ic-nns-init'
  Reason: tried: '/usr/local/opt/openssl@3/lib/libssl.3.dylib' (no such file), '/usr/local/lib/libssl.3.dylib' (no such file), '/usr/lib/libssl.3.dylib' (no such file)
Abort trap: 6

I think the only viable solution is to force people install brew, and then use brew to install libssl. Also since ic-nns-init is compiled as a x86_64 binary, it will require x86_64 version of libssl too, even though I'm on M1.

The other solution is to ask the released binary of ic-nns-init to statically link to libssl, so that users don't need to do all the above.

levifeldman commented 1 year ago

I found a workaround here: https://stackoverflow.com/a/73604364/11364713 and using this comment here. Perhaps dfx can do similar.