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

Boost 1_57 not working with version 18.14 of dlib #9

Closed
superphil0 opened this issue Mar 6, 2015 · 16 comments
Closed

Boost 1_57 not working with version 18.14 of dlib #9

superphil0 opened this issue Mar 6, 2015 · 16 comments

Comments

@superphil0
Copy link

Hey, when trying to build the dlib python module I receive errors, because boost can not be found, I believe this is because the boost folder structure has changed

https://github.com/davisking/dlib/blob/master/dlib/add_python_module#L119-L127

I had to build the shared libraries as well, this is very bad documented
also I had to rename the lib and dll files because they are not recognized

I was building for python3.4 on windows8.1 64 bit

I now built the python bindings with boost 1_55 successfully but had to copy and rename the boost libs anyway to the build folder during compilation and before linking

@davisking
Copy link
Owner

Well, you are ahead of the game because I haven't gotten boost.python to work on windows with anything but Python 2.7 32bit. However, that works with all versions of boost. I've only tried the precompiled boost binaries though. So as you say, I can imagine they are just not compiled correctly.

I also just tried compiling using python 3.4 on windows 8.1 with visual studio 2013 in 64bit mode and I get a linker error (just one error though). It's that boost::python::detail::init_module is missing and googling for this shows a bunch of people complaining about the same thing.

By the way, did you set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake? That should make it all work (aside from the eventual linker error because boost-python is broken). These variables need to be set to something like this:
BOOST_LIBRARYDIR=C:\local\boost_1_57_0\lib32-msvc-12.0
BOOST_ROOT=C:\local\boost_1_57_0

@superphil0
Copy link
Author

I managed to build boost python 3.4 64 bit lib and dll without problems I only set the env var for BOOST_ROOT and changed the config jam file to

import option ; 

using msvc : 12.0 ;
using python : 3.4 : C:\\Python34 ;

option.set keep-going : false ; 

and compiling with
.\bjam.exe --with-python address-model=64 variant=release link=shared --build-type=complete

I also managed to build dlib but with a lot of hassles, first i had to rename the libs in BOOST_LIBRARYDIR to "boost_python-py34" to satisfy the cmake module find of cmake
then while it was compiling (before linking) i copied the lib and dll to the build folder and renamed them to boost_python-vc120-mt-1_55.lib or dll

I am able to use your library now, so if you update the buildfile python3.4 dlib should be no problem

I suggest you add some documentation that clarifies the path's you are looking for boost in the add_python_module script, or better make a config file for the python build script

Additionally I suggest you add a requirements.txt for python that includes at least
scipy and numpy

This would make it much easier to start using your library with python 3.4

keep up the great work!

@davisking
Copy link
Owner

Thanks for the info. I just tweaked the cmake scripts so it's more straight forward to compile. In particular, I just tested it on linux with python 2.7 and 3.4 as well as on windows with your particular configuration as well as a few others and cmake now correctly builds everything (so long as BOOT_ROOT and BOOST_LIBRARYDIR env variables are set).

I also added cmake messages that print when boost.python isn't found and give instructions for compiling and setting up boost.python. If you pull from the repo you will get the new changes. Let me know if they don't work out.

@shelper
Copy link

shelper commented Aug 5, 2015

i was able to compile under windows 64bit by following @superphil0 's comments above, and i get the dlib.pyd, however, when i import in python, i got "ImportError: DLL load failed: The specified module could not be found."
i also tried to copy dlib.pyd to the site-packages folder, but still not working, could you provide a little guidance here on how to install dlib.pyd for python?

thanks!

@davisking
Copy link
Owner

You are probably missing something from your path, maybe the boost dlls. The compile_dlib_python_module.bat should output the dlls that are needed. Make sure they are in your path or in the current working folder.

@shelper
Copy link

shelper commented Aug 6, 2015

i found out that i need to rename the boost_python dll from boost_python to boost_python3, that saved me .

@davisking
Copy link
Owner

Huh, yeah, the filenames in boost and related python libraries are always changing. This makes it really hard to keep the cmake scripts working on all configurations. It's kinda aggravating.

What version of windows, visual studio, boost, and python are you using exactly? I'll see if I can roll in whatever changes are necessary to the cmake script to cover that configuration.

@davisking davisking reopened this Aug 6, 2015
@shelper
Copy link

shelper commented Aug 6, 2015

win 7 64bit, python3.4 64 bit, visual studio community version 2013, boost
1_58
it would be nice if there is a config file to setup for different
environment.

thanks!

On Wed, Aug 5, 2015 at 9:33 PM, Davis E. King notifications@github.com
wrote:

Huh, yeah, the filenames in boost and related python libraries are always
changing. This makes it really hard to keep the cmake scripts working on
all configurations. It's kinda aggravating.

What version of windows, visual studio, boost, and python are you using
exactly? I'll see if I can roll in whatever changes are necessary to the
cmake script to cover that configuration.


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

warm regards

Zhijia Yuan

@davisking
Copy link
Owner

davisking commented Aug 6, 2015 via email

@shelper
Copy link

shelper commented Aug 6, 2015

yes, i am using the most updated one

On Wed, Aug 5, 2015 at 9:58 PM, Davis E. King notifications@github.com
wrote:

Thanks, I'll see what I can do. The general idea is to make cmake just
work automatically regardless of the environment. Also, you are using dlib
18.16 right?


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

warm regards

Zhijia Yuan

@davisking
Copy link
Owner

I've run through a few configurations but haven't been able to reproduce this. For example, I just did the following:

  • downloaded boost 1_58 and python 3.4.3 64bit
  • ran cmake inside dclib/python_examples/build and got an error about not being able to find boost. The error message has instructions for compiling boost which I followed. This resulted in a bunch of boost binaries in C:\local\boost_1_58_0\stage\lib.
  • Then I ran cmake again, selected the PYTHON3 option via cmake-gui
  • Then I ran cmake --build . --config release --target install and cmake built everything and put a dlib.pyd in the examples folder as well as the needed boost dlls.
  • Then from within dclib/python_examples I ran python svm_rank.py and it worked correctly.

What did you do?

@shelper
Copy link

shelper commented Aug 20, 2015

i think the problem i have is that i am using vs2013, while the boost i
downloaded is not compiled by vs2013, that causes problem.
i build the boost myself and now everything seems to be fine.

still i think it would be very helpful if a notice can be put in the
installation manual so people like me can avoid these painful steps...

thanks :)

On Sat, Aug 15, 2015 at 12:12 PM, Davis E. King notifications@github.com
wrote:

I've run through a few configurations but haven't been able to reproduce
this. For example, I just did the following:

  • downloaded boost 1_58 and python 3.4.3 64bit
  • ran cmake inside dclib/python_examples/build and got an error about
    not being able to find boost. The error message has instructions for
    compiling boost which I followed. This resulted in a bunch of boost
    binaries in C:\local\boost_1_58_0\stage\lib.
  • Then I ran cmake again, selected the PYTHON3 option via cmake-gui
  • Then I ran cmake --build . --config release --target install and
    cmake built everything and put a dlib.pyd in the examples folder as well as
    the needed boost dlls.
  • Then from within dclib/python_examples I ran python svm_rank.py and
    it worked correctly.

What did you do?


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

warm regards

Zhijia Yuan

@shelper
Copy link

shelper commented Aug 20, 2015

did you download boost source code and compiled urself?
if not, why i have a different fold structure? i have my boost dll an lib
files in folder :
C:\local\boost_1_58_0\lib64-msvc-12.0

it seems to be a common problem for many OSS on windows....
what a pity. :(

On Thu, Aug 20, 2015 at 1:40 PM, zhijia yuan zhijia.yuan@gmail.com wrote:

i think the problem i have is that i am using vs2013, while the boost i
downloaded is not compiled by vs2013, that causes problem.
i build the boost myself and now everything seems to be fine.

still i think it would be very helpful if a notice can be put in the
installation manual so people like me can avoid these painful steps...

thanks :)

On Sat, Aug 15, 2015 at 12:12 PM, Davis E. King notifications@github.com
wrote:

I've run through a few configurations but haven't been able to reproduce
this. For example, I just did the following:

  • downloaded boost 1_58 and python 3.4.3 64bit
  • ran cmake inside dclib/python_examples/build and got an error about
    not being able to find boost. The error message has instructions for
    compiling boost which I followed. This resulted in a bunch of boost
    binaries in C:\local\boost_1_58_0\stage\lib.
  • Then I ran cmake again, selected the PYTHON3 option via cmake-gui
  • Then I ran cmake --build . --config release --target install and
    cmake built everything and put a dlib.pyd in the examples folder as well as
    the needed boost dlls.
  • Then from within dclib/python_examples I ran python svm_rank.py and
    it worked correctly.

What did you do?


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

warm regards

Zhijia Yuan

warm regards

Zhijia Yuan

@davisking
Copy link
Owner

davisking commented Aug 21, 2015 via email

@tnusraddinov
Copy link

After I compiled boost_1_59_0 version , I compile dlib-master for python (python setup.py install) from github I got error :

-- Could NOT find Boost
-- We couldn't find the right version of boost python. If you installed boost a
nd you are still getting this error then you might have installed a version of b
oost that was compiled with a different version of visual studio than the one yo
u are using. So you have to make sure that the version of visual studio is the
same version that was used to compile the copy of boost you are using.
-- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake.

I set vars to
BOOST_LIBRARYDIR = C:\boost_1_59_0\stage\lib
BOOST_ROOT = C:\boost_1_59_0

What is wrong?

@davisking
Copy link
Owner

I have no idea.

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