ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problems linking pcl::io in ROS indigo

asked 2015-06-17 06:35:04 -0600

altella gravatar image

Hello all;

I have been working for a while with ROS Indigo and its included version of PCL. I am on a Ubuntu 14.04 x64 desktop. Previous nodes all work ok, but in the one I am programming now, I need to include pcl::io. the code reduced to minimal is:

#include "ros/ros.h"
#include <ros/package.h>
#include <sensor_msgs/PointCloud2.h>

//PCL
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>

int main(int argc, char **argv)
{

  ros::init(argc, argv, "halcon3D_test_node");
  ros::NodeHandle n;

  //test PointCloud_to_ObjectModel3D
  ros::Publisher pub = n.advertise<sensor_msgs::PointCloud2>("point_cloud", 1000);

  std::string path = ros::package::getPath("tekniker_halcon_drivers") + "/resources/";
    std::string fileName = path + "CSite1_orig-utm.pcd";

    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
    //pcl::io::loadPCDFile<pcl::PointXYZ> ("/home/alberto/catkin_euroc_ch1/src/tekniker_euroc_c1/resources/STL/object.pcd", *cloud);

  ros::Rate loop_rate(10);
  while (ros::ok())
  {
        sensor_msgs::PointCloud2 cloud2;
        pcl::toROSMsg(*cloud, cloud2);
        cloud2.header.frame_id = "point_cloud_link";
        cloud2.header.stamp = ros::Time::now();
        pub.publish(cloud2);
    ros::spinOnce();
    loop_rate.sleep();
  }
  return 0;
}

However, if I uncomment ths line:

pcl::io::loadPCDFile<pcl::PointXYZ> ("/home/alberto/catkin_euroc_ch1/src/tekniker_euroc_c1/resources/STL/object.pcd", *cloud);

I obtain the following linking errors:

//usr/lib/libpq.so.5: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_read@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSLv23_method@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_new@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference ...
(more)
edit retag flag offensive close merge delete

Comments

Please show us how you are building all of this. Without your CMakeLists.txt, we cannot know whether the issue might just be a missing statement or something more involved. Also: please remove all the boilerplate comments from your CMakeLists.txt before copy/pasting it in your question.

gvdhoorn gravatar image gvdhoorn  ( 2015-06-17 07:04:19 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-17 07:15:49 -0600

kokirits gravatar image

updated 2015-06-17 07:17:13 -0600

Add

  find_package(PCL 1.7 REQUIRED COMPONENTS common io)
  include_directories(${PCL_INCLUDE_DIRS})
  link_directories(${PCL_LIBRARY_DIRS})
  add_definitions(${PCL_DEFINITIONS})

and then

target_link_libraries(your_executable_name ${catkin_LIBRARIES} ${PCL_LIBRARIES})

to your CMakeLists.txt.

edit flag offensive delete link more

Comments

My CMakeLists.txt is as follows. I have included PCL without specifying the components. Is this correct?

find_package(PCL REQUIRED)
include_directories(${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})
target_link_libraries(halcon3D_test_node ${catkin_LIBRARIES} ${PCL_LIBRARIES})
altella gravatar image altella  ( 2015-06-17 07:55:39 -0600 )edit

It should be ok.

kokirits gravatar image kokirits  ( 2015-06-17 09:55:11 -0600 )edit

Already tested with your CMakeLists.txt and mine, specifying PCL version and so on. The error is still there, and I still think something strange is happening. Any clue is highly appreciated !

altella gravatar image altella  ( 2015-06-17 10:25:10 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-17 06:35:04 -0600

Seen: 907 times

Last updated: Jun 17 '15