Segfault when declaring boost shared_ptr

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Segfault when declaring boost shared_ptr

PALin00
Hi guys,

I wanted to try code from advanced tutorial on ransac and I come across this problem: When I try to declare boost shared pointer to a point cloud

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;

I get segmentation fault.

It corresponds to this part of code from tutorial:

30  // initialize PointClouds
31  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
32  pcl::PointCloud<pcl::PointXYZ>::Ptr final (new pcl::PointCloud<pcl::PointXYZ>);

Here is message from GDB:

Debugger name and version: GNU gdb (GDB) 7.6.1-ubuntu
Program received signal SIGSEGV, Segmentation fault.
In boost::math::lanczos::lanczos_initializer<boost::math::lanczos::lanczos17m64, long double>::init::init() () (/usr/lib/libpcl_io.so.1.7)
84 dl-init.c: No such file or directory.
#2  0x00007ffff7de9856 in call_init (l=l@entry=0x7ffff7fd7000, argc=argc@entry=1, argv=argv@entry=0x7fffffffe5a8, env=env@entry=0x7fffffffe5b8) at dl-init.c:84
Debugger finished with status 0


I run PCL 1.7 on a Linux Mint 16 64-bit distribution.
I'm using PCL for my bachelor thesis so any help as soon as possible will be greatly appreciated since I'm stuck until I can resolve this.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

Jochen Sprickerhof
Administrator
Hi PALin00,

* PALin00 <[hidden email]> [2014-01-04 23:43]:
> I wanted to try code from  advanced tutorial on ransac
> <http://pointclouds.org/documentation/tutorials/random_sample_consensus.php#random-sample-consensus>  
> and I come across this problem: When I try to declare boost shared pointer
> to a point cloud
>
> /pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;/

Can you extract a minimal example showing your problem?

Cheers Jochen

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

PALin00
Here it is:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/console/parse.h>
#include <boost/thread/thread.hpp>
#include <pcl/filters/extract_indices.h>
#include <pcl/sample_consensus/ransac.h>
//#include <pcl/visualization/pcl_visualizer.h>  // deprecated, treba nahradit
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl/sample_consensus/sac_model_sphere.h>

int main(int argc, char *argv[])
{
  pcl::console::setVerbosityLevel(pcl::console::L_DEBUG);

  std::string file_name = "/media/palin00/Lokálny disk/Bakalarka/Dataset/Aim@Shape/DataBezPopisu/OilPump.pcd";
  pcl::PointCloud<pcl::PointXYZRGBNormal> my_cloud;
  pcl::PCDReader input;
  if (input.read(file_name, my_cloud, 0) == -1)
  {
    std::cout << "Failed." << std::endl;
    return -1;
  }

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;

  return 0;
}


Thanks for quick response :)
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

Jochen Sprickerhof
Administrator
* PALin00 <[hidden email]> [2014-01-05 04:55]:

> /#include <iostream>
> #include <pcl/io/pcd_io.h>
> #include <pcl/point_types.h>
> #include <pcl/console/parse.h>
> #include <boost/thread/thread.hpp>
> #include <pcl/filters/extract_indices.h>
> #include <pcl/sample_consensus/ransac.h>
> //#include <pcl/visualization/pcl_visualizer.h>  // deprecated, treba
> nahradit
> #include <pcl/sample_consensus/sac_model_plane.h>
> #include <pcl/sample_consensus/sac_model_sphere.h>
>
> int main(int argc, char *argv[])
> {
>   pcl::console::setVerbosityLevel(pcl::console::L_DEBUG);
>
>   std::string file_name = "/media/palin00/Lokálny
> disk/Bakalarka/Dataset/Aim@Shape/DataBezPopisu/OilPump.pcd";
>   pcl::PointCloud<pcl::PointXYZRGBNormal> my_cloud;
>   pcl::PCDReader input;
>   if (input.read(file_name, my_cloud, 0) == -1)
>   {
>     std::cout << "Failed." << std::endl;
>     return -1;
>   }
>
>   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;
>
>   return 0;
> }/
Works for me. Does this really segfault for you?

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

PALin00
Unfortunately it does. It seems weird to me too because I used the part for file reading from another test project and I only changed the actual file it connects to and added that shared_ptr and it went all to hell. And when I create new project and try out just this:

int main(int argc, char *argv[])  
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;
 
  return 0;
}


it works fine. Could it be that file I'm trying to open is corrupted and it throws it off somehow?
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

Jochen Sprickerhof
Administrator
* PALin00 <[hidden email]> [2014-01-05 05:59]:
> it works fine. Could it be that file I'm trying to open is corrupted and it
> throws it off somehow?

Could be, can you try it with a known good file? What happens when you
try to cout the content of my_cloud?

Cheers Jochen

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

PALin00
Ok, I think I zeroed in closer on the problem, although I'm even more confused. I created another test sample:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/console/parse.h>
#include <boost/thread/thread.hpp>
#include <pcl/filters/extract_indices.h>
#include <pcl/sample_consensus/ransac.h>

//#include <pcl/visualization/pcl_visualizer.h>  // deprecated, treba nahradit
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl/sample_consensus/sac_model_sphere.h>



int main()
{
  pcl::PCDReader input;

  return 0;
}


If I include any one of those 4 modules in bold font, it starts to segfault. Without it, it runs just fine. Any ideas what could cause this weird behavior?
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

Jochen Sprickerhof
Administrator
* PALin00 <[hidden email]> [2014-01-05 07:23]:
> If I include any one of those 4 modules in bold font, it starts to segfault.
> Without it, it runs just fine. Any ideas what could cause this weird
> behavior?

Sounds strange, how did you install PCL? Can you compile the current git
version from source?

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

PALin00
I just installed it using package manager.

I originally wanted to program in Windows using MinGW, but I couldn't make it work somehow(I had problems compiling dependencies from source), so I was actually glad that I don't need to build it from source on Linux to make it work. But if you think that building from source could solve it, I give it a try. I guess there could be a problem in that package since it's built for Ubuntu afaik and even though Mint is Ubuntu based it could have some difference that makes it crash(Sorry if that's completely wrong, I'm not very educated on Linux).
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when declaring boost shared_ptr

PALin00
Ok, I compiled whole library from source and it seems, that it did the trick. Everything is running just fine so far.
Thank you very much. :)