Undefined reference to log4cxx when adding openni_camera dependency to package
Hi, I've been struggling with this for a few hours. I created a package depending on
openni
, openni_camera
and openni_launch
.
My problem is: on compilation, i'm getting
Linking CXX executable ../bin/listener
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'log4cxx::Logger::getLogger(char const*)'
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'log4cxx::Level::getError()'
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'log4cxx::Level::getWarn()'
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'typeinfo for log4cxx::helpers::ObjectPtrBase'
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'log4cxx::helpers::ObjectPtrBase::~ObjectPtrBase()'
/opt/ros/fuerte/stacks/openni_camera/lib/libopenni_nodelet.so: error: undefined reference to 'log4cxx::Level::getFatal()'
I thought it was whining about the fact that I didn't link the log4cxx library on compilation. So I added this in CMakeLists.txt
rosbuild_add_library(${PROJECT_NAME} /usr/lib/liblog4cxx.so)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
but it didn't change much. Then I tried the answer from another question (which I'm not allowed to mention giving my baby karma) suggesting to use target_link_libraries()
but I couldn't use it successfully.
Any ideas? NB: I'm running fuerte on ubuntu 12.04. Thanks for your help