Solving a difficult compilation issue

2019-05-27 05:18发布

问题:

Good day,

First up, I have a mac running Mavericks, and I am attempting to build PCL (Point Cloud Library) as part of ROS.

This is the command that fails:

cd /Users/X/ros_catkin_ws/build_isolated/pcl_ros && /Users/X/ros_catkin_ws/install_isolated/env.sh cmake -vd /Users/X/ros_catkin_ws/src/perception_pcl/pcl_ros -DCATKIN_DEVEL_PREFIX=/Users/X/ros_catkin_ws/devel_isolated/pcl_ros -DCMAKE_INSTALL_PREFIX=/Users/X/ros_catkin_ws/install_isolated -DCMAKE_BUILD_TYPE=Release 

With:

CMake Error at /usr/local/share/pcl-1.8/PCLConfig.cmake:47 (message):
  simulation is required but glew was not found
Call Stack (most recent call first):
  /usr/local/share/pcl-1.8/PCLConfig.cmake:500 (pcl_report_not_found)
  /usr/local/share/pcl-1.8/PCLConfig.cmake:663 (find_external_library)
  CMakeLists.txt:8 (find_package)

Now, I have done what I can to debug this. Looking up online, I notice this is happening due to the fact that in Mavericks, there is no longer the GLEW.framework https://github.com/PointCloudLibrary/pcl/issues/492

Hence, I installed it via brew, and yet I still get the same issue. Now, I'm thinking, perhaps cmake cannot find it, so I created my own cmake project, and attempted to add find_package(glew). It seems to have found the package here:

-- Found GLEW: /usr/local/include  

Hence, I included /usr/local/include in my $PATH variable. Yet once again, it seems to fail with the same error. I am kind of at a lost here, and am not sure how to continue. I am speculating that in the command above, it seems that somehow the env.sh there seems to change the environmental variables such that it can't find glew.

Any thoughts?

EDIT: More absurdity. I create a CMake file and included find_package(PCL). It works perfectly. WTF? It even says it found glew

Found Glew: -framework GLEW;-framework Cocoa

How come it works in my Cmake file, but not in theirs? What might cause this

回答1:

Bastards. I went to the pcl_ros folder, and the glew include directory was pointing to Glew.Framework, which is deprecated as of OSX 10.8!

Scumbag Mavericks! I simply pointed it to the correct glew include directory, which for me is:

/usr/local/Cellar/glew/1.11.0/include/GL



回答2:

Same as user ovfstack described encountered on OS X 10.10. While compiling ros indigo I found that /usr/local/share/pcl-1.8/PCLConfig.cmake is deprecated.

I installed glew via homebrew under /usr/local/Cellar/glew/1.11.0/include/ and changed line 415 in the above mentioned cmake file from

/System/Library/Frameworks/GLEW.framework/Versions/A/Headers

to

/usr/local/Cellar/glew/1.11.0/include/

Now it compiles just fine.