Level / rocksdb

Pure C++ Node.js RocksDB binding. An abstract-leveldown compliant store.
MIT License
229 stars 53 forks source link

node-gyp error on M1 (Apple Sillicon): errorthe clang compiler does not support '-march=native': #169

Closed jrop closed 3 years ago

jrop commented 3 years ago

I am getting the following build-error on my Apple M1:

Code/local/rocksdb-sandbox
❯ npm install rocksdb@5

> rocksdb@5.0.0 install /Users/me/Code/local/rocksdb-sandbox/node_modules/rocksdb
> node-gyp-build

  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/cache.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/clock_cache.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/lru_cache.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/sharded_cache.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_addition.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_builder.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_cache.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_garbage.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_meta.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_reader.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_log_format.o
  CXX(target) Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_log_sequential_reader.o
clangclang: clang: : clang: clang: error: error: errorthe clang compiler does not support '-march=native': the clang compiler does not support '-march=native'

errorthe clang compiler does not support '-march=native':
the clang compiler does not support '-march=native'error
: the clang compiler does not support '-march=native'
clangclang: : errorerror: : the clang compiler does not support '-march=native'the clang compiler does not support '-march=native'

clang: error: the clang compiler does not support '-march=native'
clangclang: : errorerror: : the clang compiler does not support '-march=native'the clang compiler does not support '-march=native'

clang: error: the clang compiler does not support '-march=native'
clang: clang: error: the clang compiler does not support '-march=native'error
: the clang compiler does not support '-march=native'
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_reader.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_garbage.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_cache.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_builder.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/cache.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/lru_cache.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/clock_cache.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_log_sequential_reader.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_addition.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_log_format.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/sharded_cache.o] Error 1
make: *** [Release/obj.target/rocksdb/deps/rocksdb/rocksdb/db/blob/blob_file_meta.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/Cellar/node@12/12.22.1_1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/opt/homebrew/Cellar/node@12/12.22.1_1/bin/node" "/opt/homebrew/Cellar/node@12/12.22.1_1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/Code/local/rocksdb-sandbox/node_modules/rocksdb
gyp ERR! node -v v12.22.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN rocksdb-sandbox@1.0.0 No description
npm WARN rocksdb-sandbox@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rocksdb@5.0.0 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rocksdb@5.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2021-05-29T16_13_55_051Z-debug.log
Code/local/rocksdb-sandbox
❯
Nazgolze commented 3 years ago

-march=native isn't strictly required for building. Would it make sense to just remove it?

vweevers commented 3 years ago

@Nazgolze Could you elaborate? The march=native flag is an optimization flag, correct? So removing it will harm performance (by how much?) but increase hardware compat.

Nazgolze commented 3 years ago

@Nazgolze Could you elaborate? The march=native flag is an optimization flag, correct? So removing it will harm performance (by how much?) but increase hardware compat.

exactly, yes :slightly_smiling_face:

vweevers commented 3 years ago

A PR is welcome to remove it:

https://github.com/Level/rocksdb/blob/5c8e0b9a4519ba8e9a25dc3b704f1bae395af214/deps/rocksdb/rocksdb.gyp#L167

We can keep that PR open for a week or so for anyone (that cares about the potential performance impact) to object.

Nazgolze commented 3 years ago

Cool. I will have that ready shortly :)