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

Installing leveldb failed #12

Open
davidshen84 opened this issue Sep 15, 2015 · 18 comments
Open

Installing leveldb failed #12

davidshen84 opened this issue Sep 15, 2015 · 18 comments

Comments

@davidshen84
Copy link

I know it is not your fault. When I execute

pip install -r requirements.txt

in the python directory, I got error that leveldb failed to install. But I saw in the ./install/bin directory that I have:

  • leveldbutil.exe
  • leveldbutild.exe

So, maybe I do not need to use pip to install leveldb again? Care to comment on this?

@willyd
Copy link
Owner

willyd commented Sep 15, 2015

Depends on what you want. LevelDB python bindings are not installed by caffe-builder. The exe you mention are there because caffe requires leveldb c++ and pycaffe requires both leveldb c++ and pyleveldb. Please see BVLC/caffe#15 and/or ask @lunzueta or @happynear for help on getting pyleveldb installed.

@davidshen84
Copy link
Author

Building leveldb.lib is easy, as there are many resources. However, I
could not find any reference on building the python binding.

On Tue, Sep 15, 2015 at 11:36 PM Guillaume Dumont notifications@github.com
wrote:

Depends on what you want. LevelDB python bindings are not installed by
caffe-builder. The exe you mention are there because caffe requires leveldb
c++ and pycaffe requires both leveldb c++ and pyleveldb. Please see
BVLC/caffe#15 BVLC/caffe#15 and/or ask
@lunzueta https://github.com/lunzueta or @happynear
https://github.com/happynear for help on getting pyleveldb installed.


Reply to this email directly or view it on GitHub
#12 (comment)
.

Regards,
David

@happynear
Copy link

@davidshen84
I guess you can read Mandarin from your name. Here is a blog describes how to build leveldb.pyd:
http://blog.csdn.net/toontong/article/details/8442995

If you cannot read it. Try this repository:
https://github.com/chirino/leveldb/blob/master/WINDOWS.md

@davidshen84
Copy link
Author

@happynear I have build leveldb from @chirino 's repository, and got the lib files. The code snippet in that blog seems very old. I will try if it still applies. Thanks.

@davidshen84
Copy link
Author

My working environment is Windows 8 64 bit, VS 2012, leveldb 0.193. I added these lines to the setup.py file in leveldb:

else:
  #print >>sys.stderr, "Don't know how to compile leveldb for %s!" % system
  #sys.exit(0)
  extra_compile_args = common_flags + [
      '-fPIC',
      '-Wall',
      '-g2',
      '-D_GNU_SOURCE',
      '-O2',
      '-DNDEBUG',
      '-DLEVELDB_PLATFORM_WINDOWS',
      ]
  extra_link_args = ['shlwapi.lib', 'snappy.lib','leveldb.lib',]

And made some other changed by following the blog. The error message I got was:

running build
running build_ext
building 'leveldb' extension
error: [Error 2] ???????????

The ? are literal...so I have no idea what it is.

@happynear
Copy link

@davidshen84
I have just created a new repository https://github.com/happynear/py-leveldb-windows .
Sorry that I am not familiar with cmake, so I just created a VS project.
May it help.

@davidshen84
Copy link
Author

Indeed it helps. Thanks a lot!

On Wed, Sep 16, 2015 at 5:26 PM Feng Wang notifications@github.com wrote:

@davidshen84 https://github.com/davidshen84
I have just created a new repository
https://github.com/happynear/py-leveldb-windows .
Sorry that I am not familiar with cmake, so I just created a VS project.
May it help.


Reply to this email directly or view it on GitHub
#12 (comment)
.

Regards,
David

@vfdev-5
Copy link

vfdev-5 commented Sep 22, 2015

A CMake version to compile python leveldb wrapper under Windows using Caffe-builder dependencies:
https://github.com/vfdev-5/py-leveldb-windows

@happynear
Copy link

@vfdev-5
Thanks for your work.

@willyd
Copy link
Owner

willyd commented Sep 22, 2015

@vfdev-5 Thanks. I might consider integrating this in caffe-builder at some point.

@davidshen84
Copy link
Author

@willyd I am trying to integrate @vfdev-5 's work into caffe-builder, but I am stuck at setting the build type. LevelDB python build need to link with python library files. But I don't have the debug version of the python.lib file, and I think most people will not have it either. So only the Release could success.

Now I could not find a way to pass some arguments to your buildem_cmake_recipe macro to only build Release build for this project.

Please kindly advice.

Thanks,
David

@vfdev-5
Copy link

vfdev-5 commented Dec 28, 2015

If you modify the file cmake/packages/leveldb.cmake

set(leveldb_CMAKE_ARGS 
    -DBUILD_SHARED_LIBS=OFF
    -DCMAKE_DEBUG_POSTFIX=d

    -DCMAKE_BUILD_TYPE=Release

    -DBoost_USE_STATIC_LIBS=ON
    -DBoost_USE_MULTITHREAD=ON
    -DBoost_USE_STATIC_RUNTIME=OFF   
    )

it does not work ?

@davidshen84
Copy link
Author

@vfdev-5 MSVC does not accept build type in configuration, it has to be specified at build type. So I guess it won't work.

But I saw you were using nmake. Maybe it works with nmake. But I will have to find a way to let nmake build in 32/64 bit mode.

@vfdev-5
Copy link

vfdev-5 commented Dec 28, 2015

The way to choose 32 or 64 bit mode can be defined, for example, with
vcvarsall.bat (https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx).
Somewhere in Visual Studio folder you, probably, have a folder with .bat
files which define an environment to compile in a chosen mode. E.g C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
Hope it helps

On Mon, Dec 28, 2015 at 1:32 PM, Xi Shen notifications@github.com wrote:

@vfdev-5 https://github.com/vfdev-5 MSVC does not accept build type in
configuration, it has to be specified at build type. So I guess it won't
work.

But I saw you were using nmake. Maybe it works with nmake. But I will have
to find a way to let nmake build in 32/64 bit mode.


Reply to this email directly or view it on GitHub
#12 (comment)
.

@davidshen84
Copy link
Author

But I prefer not to relay on the .bat file. I want to integrate the
py-leveldb into the caffe-builder.

On Mon, Dec 28, 2015 at 10:15 PM vfdev notifications@github.com wrote:

The way to choose 32 or 64 bit mode can be defined, for example, with
vcvarsall.bat (https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx).
Somewhere in Visual Studio folder you, probably, have a folder with .bat
files which define an environment to compile in a chosen mode. E.g
C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
Hope it helps

On Mon, Dec 28, 2015 at 1:32 PM, Xi Shen notifications@github.com wrote:

@vfdev-5 https://github.com/vfdev-5 MSVC does not accept build type in
configuration, it has to be specified at build type. So I guess it won't
work.

But I saw you were using nmake. Maybe it works with nmake. But I will
have
to find a way to let nmake build in 32/64 bit mode.


Reply to this email directly or view it on GitHub
<
https://github.com/willyd/caffe-builder/issues/12#issuecomment-167562113>
.


Reply to this email directly or view it on GitHub
#12 (comment)
.

Regards,
David

@davidshen84
Copy link
Author

@vfdev-5 do you know why we want to enforce build a Debug version? I am trying to find a way to only build a Release version for my pyleveldb project, without changing https://github.com/willyd/caffe-builder/blob/master/cmake/buildem_cmake_recipe.cmake#L36.

@willyd
Copy link
Owner

willyd commented Jan 4, 2016

Hi @davidshen84 why not add an option like this:

option(BUILD_DEBUG_AND_RELEASE "Build debug and release simultaneously" ON)
    if(MSVC AND BUILD_DEBUG_AND_RELEASE)        

        externalproject_add_step(${_name} BuildOtherConfig
                            COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --config "$<$<CONFIG:Debug>:Release>$<$<CONFIG:Release>:Debug>" --target INSTALL
                            DEPENDEES install
                            )
    endif()

and then you can disable this option on the command-line how does that sound?

@davidshen84
Copy link
Author

Hi @guillaume,

I see. I will try that out.

Thanks,
David

On Mon, Jan 4, 2016 at 11:32 PM Guillaume Dumont notifications@github.com
wrote:

Hi @davidshen84 https://github.com/davidshen84 why not add an option
like this:

option(BUILD_DEBUG_AND_RELEASE "Build debug and release simultaneously" ON)
if(MSVC AND BUILD_DEBUG_AND_RELEASE)

    externalproject_add_step(${_name} BuildOtherConfig
                        COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --config "$<$<CONFIG:Debug>:Release>$<$<CONFIG:Release>:Debug>" --target INSTALL
                        DEPENDEES install
                        )
endif()

and then you can disable this option on the command-line how does that
sound?


Reply to this email directly or view it on GitHub
#12 (comment)
.

Regards,
David

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

No branches or pull requests

4 participants