stephan-hof / pyrocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
150 stars 169 forks source link

Cannot install pyrocksdb, with python3.5.2, due to warning: the result of the conversion is unspecified because ‘-1’ is outside the range of type ‘rocksdb::CompressionType’ [-Wconversion] #53

Open lovesh opened 7 years ago

lovesh commented 7 years ago

I am on Linux Mint 18 KDE, was able to install rocksdb as shared library. gcc -v output

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2)

But when i do pip install pyrocksdb, i get this error

running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/interfaces.py -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/errors.py -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/__init__.py -> build/lib.linux-x86_64-3.5/rocksdb
    creating build/lib.linux-x86_64-3.5/rocksdb/tests
    copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-3.5/rocksdb/tests
    copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-3.5/rocksdb/tests
    copying rocksdb/tests/__init__.py -> build/lib.linux-x86_64-3.5/rocksdb/tests
    running egg_info
    writing dependency_links to pyrocksdb.egg-info/dependency_links.txt
    writing requirements to pyrocksdb.egg-info/requires.txt
    writing pyrocksdb.egg-info/PKG-INFO
    writing top-level names to pyrocksdb.egg-info/top_level.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pyrocksdb.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pyrocksdb.egg-info/SOURCES.txt'
    copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/_rocksdb.pyx -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/backup.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/cache.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/db.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/env.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/logger.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/options.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/slice_.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/status.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-3.5/rocksdb
    creating build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-3.5/rocksdb/cpp
    running build_ext
    building 'rocksdb._rocksdb' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/rocksdb
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -I/home/lovesh/.virtualenvs/db-bench/include/python3.5m -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-3.5/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    rocksdb/_rocksdb.cpp: In function ‘PyObject* __pyx_pf_7rocksdb_8_rocksdb_19PyBloomFilterPolicy_4create_filter(__pyx_obj_7rocksdb_8_rocksdb_PyBloomFilterPolicy*, PyObject*)’:
    rocksdb/_rocksdb.cpp:6580:105: warning: conversion to ‘int’ from ‘std::vector<rocksdb::Slice>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
         __pyx_t_6->CreateFilter(py_rocks::vector_data(__pyx_v_c_keys), __pyx_v_c_keys.size(), (&__pyx_v_dst));
                                                                                                             ^
    rocksdb/_rocksdb.cpp: In function ‘PyObject* __pyx_pf_7rocksdb_8_rocksdb_7Options_14filter_deletes___get__(__pyx_obj_7rocksdb_8_rocksdb_Options*)’:
    rocksdb/_rocksdb.cpp:19539:57: error: ‘struct rocksdb::Options’ has no member named ‘filter_deletes’
       __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->opts->filter_deletes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
                                                             ^
    rocksdb/_rocksdb.cpp:581:36: note: in definition of macro ‘__Pyx_PyBool_FromLong’
     #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
                                        ^
    rocksdb/_rocksdb.cpp: In function ‘int __pyx_pf_7rocksdb_8_rocksdb_7Options_14filter_deletes_2__set__(__pyx_obj_7rocksdb_8_rocksdb_Options*, PyObject*)’:
    rocksdb/_rocksdb.cpp:19599:23: error: ‘struct rocksdb::Options’ has no member named ‘filter_deletes’
       __pyx_v_self->opts->filter_deletes = __pyx_t_1;
                           ^
    rocksdb/_rocksdb.cpp: In function ‘PyObject* __Pyx_PyInt_From_rocksdb_3a__3a_CompressionType(rocksdb::CompressionType)’:
    rocksdb/_rocksdb.cpp:37381:74: warning: the result of the conversion is unspecified because ‘-1’ is outside the range of type ‘rocksdb::CompressionType’ [-Wconversion]
         const rocksdb::CompressionType neg_one = (rocksdb::CompressionType) -1, const_zero = (rocksdb::CompressionType) 0;
                                                                              ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
bauerj commented 7 years ago

You need to use an older version of RocksDB.

twmht commented 7 years ago

please refer to python-rocksdb (https://github.com/twmht/python-rocksdb) if you have questions.

bauerj commented 7 years ago

Nice!

lovesh commented 7 years ago

@twmht I tried it with latest rocksdb and it works. Thanks