Example fails on PPC architecture
jpillora opened this issue · 2 comments
jpillora commented
I'm using this PPC fork of node. I can install level
with no warnings and I can run this example:
var level = require('level')
// 1) Create our database, supply location and options.
// This will create or open the underlying LevelDB store.
var db = level('./mydb')
// 2) put a key & value
db.put('name', 'Level', function (err) {
if (err) return console.log('Ooops!', err) // some kind of I/O error
// 3) fetch by key
db.get('name', function (err, value) {
if (err) return console.log('Ooops!', err) // likely the key was not found
// ta da!
console.log('name=' + value)
})
})
$ node example.js
name=Level
However, when I install level-hyper
and require level-hyper
, I get:
$ npm i level-hyper
npm http GET https://registry.npmjs.org/level-hyper
npm http 200 https://registry.npmjs.org/level-hyper
npm http GET https://registry.npmjs.org/level-hyper/-/level-hyper-0.18.0.tgz
npm http 200 https://registry.npmjs.org/level-hyper/-/level-hyper-0.18.0.tgz
npm http GET https://registry.npmjs.org/level-packager
npm http GET https://registry.npmjs.org/leveldown-hyper
npm http 200 https://registry.npmjs.org/level-packager
npm http GET https://registry.npmjs.org/level-packager/-/level-packager-0.18.0.tgz
npm http 200 https://registry.npmjs.org/leveldown-hyper
npm http 200 https://registry.npmjs.org/level-packager/-/level-packager-0.18.0.tgz
npm http GET https://registry.npmjs.org/leveldown-hyper/-/leveldown-hyper-0.10.0.tgz
npm http 200 https://registry.npmjs.org/leveldown-hyper/-/leveldown-hyper-0.10.0.tgz
npm http GET https://registry.npmjs.org/levelup
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/bindings
npm http 200 https://registry.npmjs.org/levelup
npm http GET https://registry.npmjs.org/levelup/-/levelup-0.18.1.tgz
npm http 200 https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/nan/-/nan-0.5.2.tgz
npm http 200 https://registry.npmjs.org/levelup/-/levelup-0.18.1.tgz
npm http 200 https://registry.npmjs.org/nan/-/nan-0.5.2.tgz
> leveldown-hyper@0.10.0 install /root/hyper/node_modules/level-hyper/node_modules/leveldown-hyper
> node-gyp rebuild
npm http GET https://registry.npmjs.org/errno
npm http GET https://registry.npmjs.org/prr
npm http GET https://registry.npmjs.org/readable-stream
npm http GET https://registry.npmjs.org/deferred-leveldown
npm http GET https://registry.npmjs.org/bops
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/concat-stream
npm http GET https://registry.npmjs.org/xtend
npm http 200 https://registry.npmjs.org/errno
npm http GET https://registry.npmjs.org/errno/-/errno-0.1.0.tgz
npm http 200 https://registry.npmjs.org/prr
npm http GET https://registry.npmjs.org/prr/-/prr-0.0.0.tgz
npm http 200 https://registry.npmjs.org/deferred-leveldown
npm http GET https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-0.1.0.tgz
npm http 304 https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/semver/-/semver-2.2.1.tgz
npm http 304 https://registry.npmjs.org/concat-stream
npm http GET https://registry.npmjs.org/concat-stream/-/concat-stream-0.1.1.tgz
npm http 304 https://registry.npmjs.org/xtend
npm http GET https://registry.npmjs.org/xtend/-/xtend-2.1.1.tgz
make: Entering directory `/root/hyper/node_modules/level-hyper/node_modules/leveldown-hyper/build'
npm http 200 https://registry.npmjs.org/bops
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/bloom.o
npm http GET https://registry.npmjs.org/bops/-/bops-0.1.0.tgz
npm http 200 https://registry.npmjs.org/errno/-/errno-0.1.0.tgz
npm http 200 https://registry.npmjs.org/prr/-/prr-0.0.0.tgz
npm http 200 https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-0.1.0.tgz
npm http 200 https://registry.npmjs.org/semver/-/semver-2.2.1.tgz
npm http 200 https://registry.npmjs.org/concat-stream/-/concat-stream-0.1.1.tgz
npm http 200 https://registry.npmjs.org/readable-stream
npm http 200 https://registry.npmjs.org/xtend/-/xtend-2.1.1.tgz
npm http 200 https://registry.npmjs.org/bops/-/bops-0.1.0.tgz
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/env_posix.o
npm http GET https://registry.npmjs.org/abstract-leveldown
npm http GET https://registry.npmjs.org/object-keys
npm http GET https://registry.npmjs.org/bops/-/bops-0.0.7.tgz
npm http GET https://registry.npmjs.org/base64-js/0.0.2
npm http GET https://registry.npmjs.org/to-utf8/0.0.1
npm http GET https://registry.npmjs.org/core-util-is
npm http GET https://registry.npmjs.org/debuglog/0.0.2
../deps/leveldb/leveldb-hyper/util/env_posix.cc: In member function ‘virtual leveldb::Status leveldb::{anonymous}::PosixEnv::CopyFile(const string&, const string&)’:
../deps/leveldb/leveldb-hyper/util/env_posix.cc:570:30: warning: ‘fd2’ may be used uninitialized in this function [-Wuninitialized]
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-maybe-uninitialized" [enabled by default]
npm http 200 https://registry.npmjs.org/bops/-/bops-0.0.7.tgz
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/env.o
npm http 304 https://registry.npmjs.org/to-utf8/0.0.1
npm http 304 https://registry.npmjs.org/base64-js/0.0.2
npm http 200 https://registry.npmjs.org/object-keys
npm http GET https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz
npm http 304 https://registry.npmjs.org/debuglog/0.0.2
npm http 304 https://registry.npmjs.org/core-util-is
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/histogram.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/coding.o
npm http 200 https://registry.npmjs.org/abstract-leveldown
npm http GET https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-0.10.2.tgz
npm http 200 https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/hash.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/logging.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/filter_policy.o
npm http 200 https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-0.10.2.tgz
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/arena.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/cache.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/comparator.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/status.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/options.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/util/crc32c.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/c.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/log_reader.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/repair.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/table_cache.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/log_writer.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/dbformat.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/write_batch.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/db_impl.o
../deps/leveldb/leveldb-hyper/db/db_impl.cc: In member function ‘leveldb::Status leveldb::DBImpl::OptimisticCompaction()’:
../deps/leveldb/leveldb-hyper/db/db_impl.cc:933:83: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat]
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-maybe-uninitialized" [enabled by default]
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/memtable.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/leveldb_main.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/version_edit.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/version_set.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/builder.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/filename.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/db_iter.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/db/replay_iterator.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/port/port_posix.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/merger.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/filter_block.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/block_builder.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/iterator.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/table_builder.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/format.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/table.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/block.o
CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-hyper/table/two_level_iterator.o
AR(target) Release/obj.target/deps/leveldb/leveldb.a
COPY Release/leveldb.a
CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-sinksource.o
CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-stubs-internal.o
CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy.o
AR(target) Release/obj.target/deps/snappy/snappy.a
COPY Release/snappy.a
CXX(target) Release/obj.target/leveldown/src/batch.o
CXX(target) Release/obj.target/leveldown/src/batch_async.o
CXX(target) Release/obj.target/leveldown/src/database.o
CXX(target) Release/obj.target/leveldown/src/database_async.o
CXX(target) Release/obj.target/leveldown/src/iterator.o
CXX(target) Release/obj.target/leveldown/src/iterator_async.o
CXX(target) Release/obj.target/leveldown/src/leveldown.o
CXX(target) Release/obj.target/leveldown/src/leveldown_async.o
SOLINK_MODULE(target) Release/obj.target/leveldown.node
SOLINK_MODULE(target) Release/obj.target/leveldown.node: Finished
COPY Release/leveldown.node
make: Leaving directory `/root/hyper/node_modules/level-hyper/node_modules/leveldown-hyper/build'
level-hyper@0.18.0 node_modules/level-hyper
├── level-packager@0.18.0 (levelup@0.18.1)
└── leveldown-hyper@0.10.0 (bindings@1.1.1, nan@0.5.2)
$ node example.js
node: symbol lookup error: /root/hyper/node_modules/level-hyper/node_modules/leveldown-hyper/build/Release/leveldown.node: undefined symbol: __sync_add_and_fetch_8
Maybe this is an issue for https://github.com/rescrv/HyperLevelDB ?
rvagg commented
Yes, I'm sorry, file an issue with @rescrv, he's using __sync_add_and_fetch()
which isn't supported by all platforms. I could probably come up with a way to add something like -DHAVE_SYNC_ADD_FETCH=0 in the gyp build especially for PPC if need be, but the actual alternative compile path needs to go into HyperLevelDB.