Open wkoa opened 4 years ago
Did you get any progress on this? I'm stuck at the same issue with Windows 10-built foxy.
Did you get any progress on this? I'm stuck at the same issue with Windows 10-built foxy.
Not yet
+1. Stuck at the same issue as well here.
@wkoa @Sammysedo
Were you guys able to resolve this issue? Been attempting for a week now but to no avail.
Below are details of what I tried so far:
boost_1_71_0.zip
from the official boost.org
website.Program Files
.cd C:\Program Files\boost\boost_1_71_0
bootstrap vc142
.\b2
I have looked at #289 which is resolved by an earlier merged pull request and have also verified that the installed BOOST library I have contains a python
library folder at the following local directory:
C:\Program Files\boost\boost_1_71_0\libs\python
The Path
environment variable has also been verified to link to that specific library. Below is a terminal output of the following command:
echo %Path% | findstr boost\boost_1_71_0\libs\python
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;C:\Python38\Scripts\;C:\Python38\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\OpenSSL-Win64\bin;C:\opencv\x64\vc16\bin;C:\ProgramData\chocolatey\lib\cunit\lib;C:\ProgramData\chocolatey\lib\tinyxml2\lib;C:\ProgramData\chocolatey\lib\log4cxx\lib;C:\ProgramData\chocolatey\lib\bullet\lib;C:\Program Files\Graphviz\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;C:\Users\beyhy\cd-comms;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\beyhy\anaconda3\Scripts;C:\Users\beyhy\AppData\Local\atom-beta\bin;C:\Program Files\VideoLAN\VLC;C:\Qt\5.15.2\mingw81_64\bin;C:\Program Files\Cppcheck;C:\Program Files (x86)\GnuWin32\bin;C:\iconv-1.14-win32-x86_64\bin;C:\zlib-1.2.8-win32-x86_64\bin;C:\xmllint\bin;C:\Python38\Lib\site-packages\PyQt5\Qt5\bin;C:\Program Files\CMake\bin;C:\Program Files\boost\boost_1_71_0;C:\Program Files\boost\boost_1_71_0\libs\python;;C:\Users\beyhy\AppData\Local\Microsoft\WindowsApps;C:\Users\beyhy\AppData\Local\atom-beta\bin
I have also tried replacing line 32 of CMakeLists.txt
in cv_bridge
under the ros2 branch from this:
find_package(Boost COMPONENTS python3 REQUIRED)
to this:
find_package(Boost COMPONENTS python REQUIRED)
Since the python library in the installed BOOST library is labelled python
instead of python3
.
However, that still did not work.
i ran into the same problem, and solved it by adding the following code to line 32 in the CMakeList.txt file within the cv_bridge
pacakge.
the problem comes from newer versions of boost-python including the full version string, so if you have python 3.8 installed it will be python38
, for python 3.7 it would be python37
. missing the second number would cause the above error.
string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
list(GET VERSION_LIST 0 PYTHONLIBS_VERSION_MAJOR)
list(GET VERSION_LIST 1 PYTHONLIBS_VERSION_MINOR)
find_package(Boost COMPONENTS python${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR} REQUIRED)
im working on a PR now to add this update into the main ros2
branch
@flynneva Thanks for the prompt clarification π as well as the pull request to fix this long-standing issue.
I have tried the solution you provided and the results are similar, as shown below;
Followed the modifications made in the pull request #390. See here for what the cv_bridge CMakeLists.txt files looks after modifying.
I have ensured no other unintentional modifications are made by redownloading the ros2 branch of vision_opencv via the following commands:
rem Opening up the Visual Studio Native Command Prompt Terminal
cd C:\Users\beyhy\ros_workspaces\vcam_ws\src
git clone https://github.com/ros-perception/vision_opencv.git --single-branch --branch ros2 --depth 1
cd C:\Users\beyhy\ros_workspaces\vcam_ws
call C:\opt\ros\foxy\local_setup.bat
colcon build --packages-select cv_bridge
Similar error as before. See screenshot below.
It continues to generate the error:
Could NOT find Boost (missing: python38) (found version "1.71.0")
I have verified my Python installation as shown below by running python
in the Visual Studio Native Command Prompt:
I don't think Boost.Python is using its own internal PythonLibs so I am unsure what else I am doing wrong here.
@cardboardcode do you have boost-python
installed? you can figure this out by navigating to where you installed boost and scrolling through the libs
directory for python. if its there, great you have it (and you should be able to see the python version you need to specify in your CMakeList.txt then too!)
to get boost python you either have to download the pre-compiled version of boost or compile it yourself. id recommend downloading the pre-compiled version and adding it to your environment variable (you need to add the full path to where-ever you installed boost to your PATH
environment variable.
So for instance on my window setup I added this to my PATH
: C:\boost\boost_1_74_0\lib64-msvc-14.2
yours might be different depending on what boost version you install. i've spent my fair share of grinding through getting boost installed on windows so let me know if you have issues still....and know that I feel your pain.
i think going forward it would be best to remove the boost dependency all together from this package...but that'll take some work id expect. ill eventually look into it, just dont have the time now
Thanks @flynneva. I finally managed to resolve this build error and successfully built cv_bridge
with what you have suggested above.
I will delve into deeper details on how I resolved it on my side shortly.
Looking at what resolved it for me personally, the reasons why I encountered the build error is due to 2 sources:
Python 3.8
and BOOST 1.71.0
In following the Installing ROS2 on Windows article from the official ROS2 Foxy documentation, the instructions recommended installing python 3.8 via the command:
choco install -y python --version 3.8.3
This was the first BOOST library version I came across which is verified to be compatible and stable with Visual Studio 2019 Community Edition. As stated under Solution, I would later realize that BOOST 1.71.0 is only compatible with Python 3.7.
This section covers how the build error is resolved by addressing the 2 aformentioned sources:
.msi
Eg. For me, I got
boost_1_71_0-msvc-12.0-64.exe
.
Path
.
Eg. I added
C:\local\boost_1_71_0\lib64-msvc-14.2
toPath
.
C:\local\boost_1_71_0
lib64-msvc-14.2
sub-folder and use the explorer windows to search for this keyword libboost-python
. You should get something similar to below:
With that, I identified that this version of BOOST library requires Python 3.7 instead Python 3.8 which I have.
Path
system environment variable.
Eg. I removed C:\Python38\ and C:\Python38\Scripts
Path
system environment variable.
Eg. I included C:\Python37\ and C:\Python37\Scripts
In deleting Python 3.8, all your python dependencies you installed before for ROS2 will be gone. So you will have to install it again via the following commands:
python -m pip install -U catkin_pkg cryptography empy ifcfg lark-parser lxml netifaces numpy opencv-python pyparsing pyyaml setuptools
python -m pip install -U pydot PyQt5
Go through the steps below to verify if the build error is still encountered.
rem Opening up the Visual Studio Native Command Prompt Terminal
mkdir -p c:\ros2_ws\src
cd c:\ros2_ws\src
git clone https://github.com/flynneva/vision_opencv.git --single-branch --branch ros2 --depth 1
cd c:\ros2_ws\
call c:\opt\ros\foxy\local_setup.bat
colcon build --packages-select cv_bridge
You should get an output similar to the one below:
@flynneva
Thanks for the help in resolving this issue and preventing further hair from growing white due to stress. π
I will test your pull request in a MacOS environment as well and address the original build error encountered by @wkoa, ... once I have time.
Once that is done, we can safely close this issue.
Hi all, please follow this instead. Realized the solution I proposed above is faulty because using Python 3.7.9 instead of Python 3.8.3 will cause ROS2 commands to fail.
So here's the rectified version of the instructions.
For this, just use the recommended command in the ROS2 documentation in an administrator command prompt:
choco install -y python --version 3.8.3
Identified that BOOST 1.73.0 is compatible with Python 3.8 using the instructions in Finding out What Python Library version is compatible with BOOST 1.71.0.
Eg. For me, I got boost_1_73_0-msvc-12.0-64.exe.
Path
.
Eg. I added C:\local\boost_1_73_0\lib64-msvc-14.2 to Path.
Go through the steps below to verify if the build error is still encountered.
rem Opening up the Visual Studio Native Command Prompt Terminal
mkdir -p c:\ros2_ws\src
cd c:\ros2_ws\src
git clone https://github.com/flynneva/vision_opencv.git --single-branch --branch ros2 --depth 1
cd c:\ros2_ws\
call c:\opt\ros\foxy\local_setup.bat
colcon build --packages-select cv_bridge
sudo -H apt-get install -y libboost-dev
In my case, I have failed to execute "colcon build" My environment is :
MacOS Catalina
ROS2 Foxy
Cmake 3.18
Boost 1.72