ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Problem libOpenni2 for hydro installation with homebrew

asked 2015-01-19 04:59:47 -0600

kpax77 gravatar image

updated 2015-08-11 11:11:48 -0600

130s gravatar image

Hi everybody,

I try to install ROS Hydro on my mac with homebrew following this tutorial And I face a problem. For the installation of openni2_camera, I have the following error.

-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.28")
-- checking for module 'libopenni2'
--   package 'libopenni2' not found
CMake Error at /opt/local/share/cmake-3.0/Modules/FindPkgConfig.cmake:341 (message):
  A required package was not found
Call Stack (most recent call first):
  /opt/local/share/cmake-3.0/Modules/FindPkgConfig.cmake:395 (_pkg_check_modules_internal)
  CMakeLists.txt:9 (pkg_check_modules)

-- Configuring incomplete, errors occurred!

Of course I installed openni2 via hombrew but it seems like it doesn't create any libopenni2.pc which is a problem.

Any ideas about it ?

Thank you.


This is the result of brew info openni2

openni2: stable, HEAD
/usr/local/Cellar/openni2/ (149 files, 6,8M) *
  Built from source
==> Dependencies
Required: libusb ✔
==> Options
    Build a universal binary
    Build documentation using javadoc (might fail with Java 1.8)
    Install HEAD version
==> Caveats
Add the recommended variables to your dotfiles.
 * On Bash, add them to `~/.bash_profile`.
 * On Zsh, add them to `~/.zprofile` instead.

export OPENNI2_INCLUDE=/usr/local/include/ni2
export OPENNI2_REDIST=/usr/local/lib/ni2
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-01-19 23:02:29 -0600

updated 2015-01-21 03:33:45 -0600

Hi there,

The Hydro version of openni2_camera does not handle well libopenni2 on mac. You should edit the file openni2_camera/CMakeLists.txt and change this line:

pkg_check_modules(PC_OPENNI2 REQUIRED libopenni2)

for this:

pkg_check_modules(PC_OPENNI2 libopenni2)
  pkg_check_modules(PC_OPENNI2 REQUIRED openni2)

(This patch is already present on Indigo)


According to the result of brew info openni2, could you try to add the following two lines to your ~/.bash_profile file

export OPENNI2_INCLUDE=/usr/local/include/ni2
export OPENNI2_REDIST=/usr/local/lib/ni2

then restart your terminal. If it doesn't work try uninstalling openni2 (you currently installed it from the formula ) and try installing it again, but this time using the formula at .

edit flag offensive delete link more


Thank you. I did it and I have the same problem now it doesn't find openni2.

kpax77 gravatar image kpax77  ( 2015-01-20 04:30:37 -0600 )edit

Can you post the result of the command "brew info openni2"?

Martin Peris gravatar image Martin Peris  ( 2015-01-20 19:28:56 -0600 )edit

Now it almost compiled everything but it doesn't find the linux/usbdevice_fs.h:

/Users/skynet/ros_catkin_ws/src/openni2_camera/src/usb_reset.c:40:10: fatal error: 'linux/usbdevice_fs.h' file not found #include <linux usbdevice_fs.h=""> ^ 1 error generated.

kpax77 gravatar image kpax77  ( 2015-01-21 10:16:08 -0600 )edit

This worked for Indigo installation on my OSX 10.10 too. Key for me was restarting the terminal after doing export OPENNI2_*.

130s gravatar image 130s  ( 2015-08-11 11:22:08 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-01-19 04:59:47 -0600

Seen: 1,388 times

Last updated: Aug 11 '15