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

Fix for Apple Silicon #483

Closed
wants to merge 2 commits into from

Conversation

hayesgm
Copy link

@hayesgm hayesgm commented Nov 28, 2020

This patch updates rust-rocksdb to correctly build on Apple Silicon (using all native tools). We include patches to rustdb found here: facebook/rocksdb#7714. Additionally, we upgrade the build script and rocksdb libraries to fix compilation. See issue here for more details on the fixes: #482

Note: this is currently using a patched version of rustdb, we should wait until that PR is merged into rocksdb master until considering merging this patch.

@hayesgm hayesgm marked this pull request as draft November 28, 2020 03:12
.gitmodules Outdated Show resolved Hide resolved
This patch updates rust-rocksdb to correctly build on Apple Silicon (using all native tools). We include patches to rustdb found here: facebook/rocksdb#7714. Additionally, we upgrade the build script and rocksdb libraries to fix compilation. See issue here: rust-rocksdb#482
@jasl
Copy link

jasl commented Dec 7, 2020

BTW, my friend told me another fork works well on M1: hdevalence@33cd428

The major different is he just change build.rs, but this PR also change librocksdb-sys/rocksdb_lib_sources.txt

@nanne007
Copy link

facebook/rocksdb#7714 is already merged, so when will this happen? :)

@ordian
Copy link
Contributor

ordian commented Dec 16, 2020

if you're updating the rocksdb submodule, don't forget to update the build_version.cc:

diff --git a/librocksdb-sys/build_version.cc b/librocksdb-sys/build_version.cc
index 03e7541..f4328c8 100644
--- a/librocksdb-sys/build_version.cc
+++ b/librocksdb-sys/build_version.cc
@@ -1,4 +1,4 @@
 #include "build_version.h"
-const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:@48bfca38f6f175435052a59791922a1a453d9609@";
-const char* rocksdb_build_git_date = "rocksdb_build_git_date:@2020/07/15 17:54:15@";
+const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:@eee0af9af179063f189680e2bd79900de2f9fc6f@";
+const char* rocksdb_build_git_date = "rocksdb_build_git_date:@2020/12/05 14:17:11@";
 const char* rocksdb_build_compile_date = __DATE__;

I assume we're waiting for a rocksdb release containing this fix?

@niklaslong
Copy link

FYI there's a new rocksdb release containing the fix.

@Kixunil
Copy link
Contributor

Kixunil commented Jan 13, 2021

Did anyone happen to benchmark this? Nothing serious, I'm just curious. :)

@aleksuss
Copy link
Member

There is a rocksdb 6.15.4 in the master branch. @hayesgm try to update the branch.

@jasl
Copy link

jasl commented Jan 31, 2021

There is a rocksdb 6.15.4 in the master branch. @hayesgm try to update the branch.

I'm confusing about RocksDB releases,
according to https://github.com/facebook/rocksdb/blob/master/HISTORY.md ,
6.16.0 and 6.17.0 already versioned, but they didn't list to GitHub Releases page.

I confirmed Apple Silicon support are not included in 6.15.x, it should in 6.16.0

@ordian
Copy link
Contributor

ordian commented Mar 14, 2021

A new rocksdb release is available: https://github.com/facebook/rocksdb/releases

Can we please merge this soon?

@ordian
Copy link
Contributor

ordian commented Mar 14, 2021

sorry, couldn't help myself #503 😄

@hayesgm
Copy link
Author

hayesgm commented Mar 14, 2021

Awesome; thanks for following up @ordian. Closing in lieu of #503.

@hayesgm hayesgm closed this Mar 14, 2021
@jvsteiner
Copy link

jvsteiner commented Jan 14, 2023

I'm still getting this on a much newer version:

error: failed to run custom build command for `librocksdb-sys v0.8.0+7.4.4`

Caused by:
  process didn't exit successfully: `/Users/jamie/Code/substrate-node-template/target/release/build/librocksdb-sys-5135db74e4151ca7/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /opt/homebrew/Cellar/llvm/15.0.6/lib/libclang.dylib could not be opened: dlopen(/opt/homebrew/Cellar/llvm/15.0.6/lib/libclang.dylib, 0x0005): tried: '/usr/local/Cellar/mysql@5.6/5.6.35/lib/libclang.dylib' (no such file), '/libclang.dylib' (no such file), '/opt/homebrew/Cellar/llvm/15.0.6/lib/libclang.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))"', /Users/jamie/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/lib.rs:2172:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is a close issue, but still seems to be happening?

UPDATE: I solved it. Turns out cargo was not install using homebrew, and was a toolchain whose target had persisted from an older mac that my files and settings had been migrated from. Uninstall rust and reinstalling it fixed the problem.

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

Successfully merging this pull request may close these issues.

Failed to build on Apple Silicon
10 participants