Transferred from: http://blog.csdn.net/u013453604/article/details/51686002
First, preface
Memo Mrpt Compile Details
The system used in this article is Ubuntu 14.04 64 bit and the MRPT version is 1.3.2
This address: http://blog.csdn.net/u013453604/article/details/51686002
Reference:
Building and installing instructions
Compiling mrpt
The instructions for compiling mrpt in the fifth part of the 64-bit Windows 10, Visual Studio 2015 environment are also attached
Remind
Need to say is if you do not want to recompile the source code but choose to install directly with Apt-get mode, run the following command, and soon installed
$ sudo apt-get install Mrpt-apps Libmrpt-dev
1 1
second, about the version
mrpt1.4.0 corresponding to Opencv3, so use Opencv2 to download mrpt1.3.2 source code to compile three, download the source code
On GitHub You can download the historical version, view the version tree, click on the "tags" bar to find the mrpt1.3.2 version
https://github.com/MRPT/mrpt/tree/1.3.2 Four, compile source 1, install dependent
$ sudo apt-get install build-essential pkg-config cmake \
libwxgtk2.8-dev libftdi-dev freeglut3-dev \
Zlib1g-dev Libusb-1.0-0-dev Libudev-dev libfreenect-dev \
libdc1394-22-dev libavformat-dev libswscale-dev \
Libassimp-dev libjpeg-dev Libopencv-dev libgtest-dev \
Libeigen3-dev Libsuitesparse-dev Libpcap-dev
1 2 3 4 5 6 1 2 3 4 5 6
Note If some of the above software has been compiled from the source code, please remove it from the 2, cmake option
Create a new empty build folder to hold the compiled generated files
$ cd mrpt-1.3.2
$ mkdir build
starts CMake interface
$ cd build
$ cmake.
$ ccmake.
1 2 3 4 5 6 7 1 2 3 4 5 6 7
At this point the CMake interface appears, as shown below
If you want to build a. dbg file for debug when compiling, then you need to change the following cmake_build_type parameter to debug, which is empty by default (no need to control this option when debug is not required)
Action: Use the arrow keys to move the cursor down to the option, press ENTER to enter the edit mode, and then enter the debug and then press ENTER to confirm the modification
Cmake_build_type Debug
1 1
After changing the options, press "C" to configure, then press "G" to generate makefiles in the build folder.
If Debug is selected above, pressing "C" configuration appears as follows warning:
Warning:the Debug libraries for WxWidgets couldn ' t is found by CMake. Please install them (libwxgtk2.8-dbg) or build in release.
1 2 1 2
After installing libwxgtk2.8-dbg, press the "C" Configuration again and press "G" to generate makefiles.
$ sudo apt-get install libwxgtk2.8-dbg
1 1
3. Start compiling
To start compiling, if the quad-core CPU can increase the number of parallel-compiled tasks with-j,-j4 means to allow four tasks to be compiled in parallel,-j without a number, no limit to the number of tasks, without the-j parameter by default only with single core, the longest compile time, but the most secure
(Generally the number of parallel compilation tasks to twice times the number of CPU cores is appropriate, not too much, and the program dependency settings unreasonable or too conservative will cause parallel compilation failure)
$ make-j8
1 1
If you encounter an error (such as memory allocation errors), please change the number behind-j (e.g.-j4)
If you want to install the MRPT executable and library into the system (the library is copied to the/usr/local/lib/, the executable is copied to/usr/local/bin) run the following command, it is recommended to perform this step
$ sudo make install
1 1
Five, Windows compiled mrpt source code
First explain the environment:
64-bit Windows 10, Visual Studio 2015
The simplest way to install is to only compile mrpt and WXWIDGETS,OPENCV self-installing
Because Visual Studio 2015 is newer and requires the latest version of MRPT and wxwidgets support, select the following versions
WxWidgets 3.1.0 Windows 7Z (MB)
Mrpt-1.4.0.tar.gz (20.1MB)
The two packages are unpacked and placed on the D drive as follows (preferably not on the C drive):
D:\wxWidgets-3.1.0
D:\mrpt-1.4.0
1 2 1 2
Compile mode reference compiling MRPT
Download CMake 3.6 Windows win64-x64 Installer First, double click Install MSI file, other download see Get the Software 1, compile wxwidgets
Wxwidgets is a third-party library that is dependent on the interface-related libraries in mrpt
Using the search box in the lower-left corner of the WINDOWS10, locate the command-line tool named "VS2015 x64 Native Tools command Prompt", and under CD to D:\WXWIDGETS-3.1.0\BUILD\MSW directory, run the following command line
64-bit:
Nmake-f makefile.vc build=release shared=1 runtime_libs=dynamic debug_info=0 vendor=mrpt USE_OPENGL=1 TARGET_CPU=amd64
nmake-f makefile.vc build=debug shared=1 runtime_libs=dynamic debug_info=1 vendor=mrpt USE_OPENGL=1 TARGET_CPU= Amd64
1 2 1 2
If it is 32 bits, run the following command line:
Nmake-f makefile.vc build=release shared=1 runtime_libs=dynamic debug_info=0 vendor=mrpt USE_OPENGL=1
nmake-f MAKEFILE.VC build=debug shared=1 runtime_libs=dynamic debug_info=1 vendor=mrpt use_opengl=1
1 2 1 2
You can also go directly to the D:\WXWIDGETS-3.1.0\BUILD\MSW directory without a command line to find Wx_vc14.sln with Visual Studio 2015 open (there are wx_vcn.sln,n=7~14 eight configurations to choose from, For different versions of VS), compile all the projects in this solution one at a time (seemingly unable to compile all the projects at once), because there is no guarantee that these items will be compiled in the correct order, you may have to repeat the compilation multiple times.
It is important to note that only VC10 or more versions of Visual Studio can compile WXWIDGETS64-bit versions
After compiling to ensure that D:\WXWIDGETS-3.1.0\BUILD\MSW below have similar vc_x64_mswud, vc_mswud such folder, which contains a variety of DLL files 2, compiled Mrpt
Under Windows compile mrpt similar to Ubuntu, start the CMake GUI to set the source path to mrpt root directory, the root directory to create a new empty Build folder as a compilation directory, point configure, if the error is prompted to fill in Wxwidgets_ Root_dir root directory path, configure end point generate success can produce a VS solution under the build folder, with VS open MRPT.sln can see MRPT source is loaded in.
Then choose Debug or Release mode to compile, if it appears
4>c1xx:error C3859: The virtual memory range of the PCH is exceeded; recompile 4>c1xx:fatal error C1076 using "-zm89" or a larger command-line option:
compiler limit: to reach the internal heap limit; use/zm Specify a higher limit
1 2 1 2
Such an error, please select a module right-click "Properties"--"C + +"--"command line"--"other options" below to see if there is a statement like/zm100/bigobj, you can change it to/zm1000/bigobj, If not, please compile the module one at a time (the module is set as the startup item to compile), as long as the first few and then re-select all build to recompile the startup item, you can also delete the/zm1000/bigobj
If you use Mrpt to write a project after compiling mrpt you encounter an error like "Lost Libmrpt-base140-dbg.dll" Add the directory containing the dynamic link library file to the environment variable path
Mine is:
Path=d:\mrpt\mrpt-1.4.0\build\bin\debug;d:\wxwidgets-3.1.0\build\msw\vc_x64_mswud;
1 1
Six, Error
1, OPENCV related error
If you run Mrpt's demo (such as Icp-slam-live), you encounter an error like this: