Raspberry Hacks
Monday, September 30, 2013
Wednesday, August 14, 2013
PCL cross compilation
This is work in progress..
Compiling PCL on Raspberry Pi gives an internal compiler error because of limited memory, so we need to cross compile it on a Linux PC.
Below are the steps documented for compilation of PCL on Pi that leads to the error.
The Point Cloud Library (or PCL) is a large scale, open project [1] for 2D/3D image and point cloud processing. The PCL framework contains numerous state-of-the art algorithms including filtering, feature estimation, surface reconstruction, registration, model fitting and segmentation http://pointclouds.org/about/
This is a guide of how to compile PCL on Raspberry Pi.
Step 0:
Download version 1.6.0 should be PCL-1.6.0-Source.tar.bz2.
Uncompress the tar-bzip archive, e.g. (replace 1.6.0 with the correct version number):
Step 1: Architecture changes
b) Edit the files
src/pcl/io/include/pcl/io/ply/byte_order.h
src/pcl/common/include/sensor_msgs/PointCloud2.h
and define PLY_LITTLE_ENDIAN, right after it checks if it was already defined:
#if (defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || defined(__ARCH_PPC))
# define PCL_BIG_ENDIAN
#elif (defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__)) \
|| (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64)) \
|| (defined(__ANDROID__))
# define PCL_LITTLE_ENDIAN
#else
# define PCL_LITTLE_ENDIAN
#endif
http://www.ros.org/wiki/groovy/Installation/Raspbian/Source
Step 2: Install PCL dependencies:
sudo apt-get install libboost-all-dev libeigen3-dev libflann-dev libvtk5-dev g++-multilib libusb-1.0-0-dev
Step 3:
Step 4 - Note enough memory?
installing another compiler version gcc 4.7 gives the same internal compiler error as with gcc 4.6 like just like in other places:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=7104
sudo apt-get install gcc-4.7
sudo update-alternatives --config gcc
choose gcc 4.7 during config
Step 5: Try another ARM board
Step 6: CUDA support
if you happen to have an ARM board with an NVidia card ;)
you need to to install the CUDA repository package for Ubuntu 12.10 from the CUDA download site - this is the direct link, maybe it still works:
http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/armhf/cuda-repo-ubuntu1204_5.5-0_armhf.deb
and install it in a terminal:
Some posts about problems compiling on some ARM platforms:
http://www.pcl-users.org/Failure-to-compile-daily-builds-on-Pandaboard-td4020376.html
http://www.pcl-developers.org/unable-to-compile-PCL-for-ARM-Cortex-A9-td5707514.html
Compiling PCL on Raspberry Pi gives an internal compiler error because of limited memory, so we need to cross compile it on a Linux PC.
Below are the steps documented for compilation of PCL on Pi that leads to the error.
The Point Cloud Library (or PCL) is a large scale, open project [1] for 2D/3D image and point cloud processing. The PCL framework contains numerous state-of-the art algorithms including filtering, feature estimation, surface reconstruction, registration, model fitting and segmentation http://pointclouds.org/about/
This is a guide of how to compile PCL on Raspberry Pi.
Step 0:
Download version 1.6.0 should be PCL-1.6.0-Source.tar.bz2.
Uncompress the tar-bzip archive, e.g. (replace 1.6.0 with the correct version number):
tar xvfj PCL-1.6.0-Source.tar.bz2
Step 1: Architecture changes
a) Edit src/pcl/cmake/pcl_find_sse.cmake and replace '-march=native' from line 10 with
'-march=armv6 -mfloat-abi=hard -mfpu=vfp'. for Raspberry Pi
'-march=armv7-a -mtune=cortex-a9 -mfloat-abi=softfp -mfpu=neon' for ARM Cortex 9 CPUs
'-march=armv6 -mfloat-abi=hard -mfpu=vfp'. for Raspberry Pi
'-march=armv7-a -mtune=cortex-a9 -mfloat-abi=softfp -mfpu=neon' for ARM Cortex 9 CPUs
b) Edit the files
src/pcl/io/include/pcl/io/ply/byte_order.h
src/pcl/common/include/sensor_msgs/PointCloud2.h
and define PLY_LITTLE_ENDIAN, right after it checks if it was already defined:
#if (defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || defined(__ARCH_PPC))
# define PCL_BIG_ENDIAN
#elif (defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__)) \
|| (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64)) \
|| (defined(__ANDROID__))
# define PCL_LITTLE_ENDIAN
#else
# define PCL_LITTLE_ENDIAN
#endif
http://www.ros.org/wiki/groovy/Installation/Raspbian/Source
Step 2: Install PCL dependencies:
sudo apt-get install libboost-all-dev libeigen3-dev libflann-dev libvtk5-dev g++-multilib libusb-1.0-0-dev
Step 3:
- Change the directory to the PCL-1.6.0-Source (replace 1.6.0 with the
correct version number) directory, and create a build directory in
there:
cd PCL-1.6.0-Source && mkdir build && cd build
- Run the CMake build system using the default options:cmake ..
make
make install
Step 4 - Note enough memory?
installing another compiler version gcc 4.7 gives the same internal compiler error as with gcc 4.6 like just like in other places:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=7104
sudo apt-get install gcc-4.7
sudo update-alternatives --config gcc
choose gcc 4.7 during config
Step 5: Try another ARM board
Step 6: CUDA support
if you happen to have an ARM board with an NVidia card ;)
you need to to install the CUDA repository package for Ubuntu 12.10 from the CUDA download site - this is the direct link, maybe it still works:
http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/armhf/cuda-repo-ubuntu1204_5.5-0_armhf.deb
and install it in a terminal:
$ sudo dpkg -i cuda-repo-ubuntu1210_5.5-0_amd64.deb
$ sudo apt-get update
$ sudo apt-get update
$ sudo apt-get install cuda
Some posts about problems compiling on some ARM platforms:
http://www.pcl-users.org/Failure-to-compile-daily-builds-on-Pandaboard-td4020376.html
http://www.pcl-developers.org/unable-to-compile-PCL-for-ARM-Cortex-A9-td5707514.html
Subscribe to:
Posts (Atom)