Skip to content

Fix for Apple Silicon#483

Closed
hayesgm wants to merge 2 commits intorust-rocksdb:masterfrom
hayesgm:hayesgm/apple-silicon
Closed

Fix for Apple Silicon#483
hayesgm wants to merge 2 commits intorust-rocksdb:masterfrom
hayesgm:hayesgm/apple-silicon

Conversation

@hayesgm
Copy link
Copy Markdown

@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
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
@hayesgm hayesgm force-pushed the hayesgm/apple-silicon branch from dbcfe0f to e0eac77 Compare December 5, 2020 23:00
@jasl
Copy link
Copy Markdown

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
Copy Markdown

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

@ordian
Copy link
Copy Markdown

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
Copy Markdown

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

@Kixunil
Copy link
Copy Markdown
Contributor

Kixunil commented Jan 13, 2021

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

@aleksuss
Copy link
Copy Markdown
Member

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

@jasl
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

ordian commented Mar 14, 2021

sorry, couldn't help myself #503 😄

@hayesgm
Copy link
Copy Markdown
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
Copy Markdown

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