Items with no label
3335 Discussions

The apply_filter() always causes a Segmentation fault (core dumped) when called.

DMing4
Beginner
1,149 Views

Hi, I am using the RealSense D435i on Ubuntu 18.04.2.

I tried to rebuild the rs-capture example in order to extend it.

 

I copied below the code. It prints indx:0 and then crashes.

If I run the commented part it works fine.

 

I installed the librealsense packages: the same rs-capture binary works, so it is not due to the firmware or the device.

Do I have to add any symbol at compile time (-D)?

 

I tried to rebuild the library and I found that the compile options are different.

 

Any idea?

 

Thanks in advance.

 

 

Diego

 

 

#include <iostream>

#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API

 

int main(int argc, char * argv[]) try

{

 rs2::log_to_console(RS2_LOG_SEVERITY_ERROR);

 rs2::colorizer color_map;

 rs2::pipeline pipe;

 pipe.start();

 

 for (int indx=0; indx<10; ++indx)

 {  

  std::cout <<"indx:" <<indx <<' ' <<std::endl;

  rs2::frameset data = pipe.wait_for_frames().  // Wait for next set of frames from the camera

                        apply_filter(color_map); // Find and colorize the depth data

  std::cout <<"Size:" <<data.size() <<std::endl;

 

  /*

  std::cout <<"indx:" <<indx <<' ';

  rs2::frameset data = pipe.wait_for_frames();   // Print each enabled stream frame rate

  std::cout <<"Size:" <<data.size() <<std::endl;

  */

 }

 

 pipe.stop();

 return 0;

}

catch (const rs2::error & e)

{

  std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n  " << e.what() << std::endl;

  return EXIT_FAILURE;

}

catch (const std::exception& e)

{

  std::cerr << e.what() << std::endl;

  return EXIT_FAILURE;

 

}

 

 

 

0 Kudos
3 Replies
MartyG
Honored Contributor III
618 Views

The default set of instructions for building Librealsense are these ones:

 

https://github.com/IntelRealSense/librealsense/blob/development/doc/distribution_linux.md

 

There are a different set of instructions that only need to be used if you need to build the project from sources and prepare / patch the OS manually.

 

https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md

0 Kudos
DMing4
Beginner
618 Views

Hi MartyG,

 

thank you for your prompt response.

I rebuilt the library following the instructions.

The result is the same both using the downloaded packages and rebuilding the library.

 

The only way I made it working is by using the CMakeList.txt files from the librealsense source tree and making sure that my source files are built using the same compile flags.

I am going to wrap the functionalities that I need in a library that I will integrate in my project.

 

Best regards,

Diego

 

0 Kudos
MartyG
Honored Contributor III
618 Views

Thanks for the update on your progress!

 

Intel have released documentation for another method for setting up Librealsense on installations that have problems. You may find it useful.

 

https://forums.intel.com/s/question/0D50P00004EmJPySAN/setting-up-librealsense-on-linux-versions-with-installation-problems-by-using-libuvcbackend

0 Kudos
Reply