赞
踩
之前以为catkin_make 后面不能加多核/多线程,现在发现是可以的,catkin_make -jn(n为数字)命令在编译时被拆分为以下两个:
- make cmake_check_build_system
-
- make -jn
而且可以使用:
- catkin_make --pkg packagename -jn
- #就是编译指定包也可以使用多核/多线程
而且比使用catkin_make会快一些(有时候会快很多,取决于上面两条命令中的make -jn)
下面以catkin_make -j16为例进行演示:
- meng@meng:~/ideas/ros_ws$ catkin_make -j16
- Base path: /home/meng/ideas/ros_ws
- Source space: /home/meng/ideas/ros_ws/src
- Build space: /home/meng/ideas/ros_ws/build
- Devel space: /home/meng/ideas/ros_ws/devel
- Install space: /home/meng/ideas/ros_ws/install
- ####
- #### Running command: "cmake /home/meng/ideas/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/meng/ideas/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/meng/ideas/ros_ws/install -G Unix Makefiles" in "/home/meng/ideas/ros_ws/build"
- ####
- -- The C compiler identification is GNU 7.5.0
- -- The CXX compiler identification is GNU 7.5.0
- -- Check for working C compiler: /usr/bin/cc
- -- Check for working C compiler: /usr/bin/cc -- works
- -- Detecting C compiler ABI info
- -- Detecting C compiler ABI info - done
- -- Detecting C compile features
- -- Detecting C compile features - done
- -- Check for working CXX compiler: /usr/bin/c++
- -- Check for working CXX compiler: /usr/bin/c++ -- works
- -- Detecting CXX compiler ABI info
- -- Detecting CXX compiler ABI info - done
- -- Detecting CXX compile features
- -- Detecting CXX compile features - done
- -- Using CATKIN_DEVEL_PREFIX: /home/meng/ideas/ros_ws/devel
- -- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
- -- This workspace overlays: /opt/ros/melodic
- -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
- -- Using PYTHON_EXECUTABLE: /usr/bin/python2
- -- Using Debian Python package layout
- -- Using empy: /usr/bin/empy
- -- Using CATKIN_ENABLE_TESTING: ON
- -- Call enable_testing()
- -- Using CATKIN_TEST_RESULTS_DIR: /home/meng/ideas/ros_ws/build/test_results
- -- Forcing gtest/gmock from source, though one was otherwise available.
- -- Found gtest sources under '/usr/src/googletest': gtests will be built
- -- Found gmock sources under '/usr/src/googletest': gmock will be built
- -- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
- -- Found Threads: TRUE
- -- Using Python nosetests: /usr/bin/nosetests-2.7
- -- catkin 0.7.29
- -- BUILD_SHARED_LIBS is on
- -- BUILD_SHARED_LIBS is on
- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- -- ~~ traversing 1 packages in topological order:
- -- ~~ - using_markers
- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- -- +++ processing catkin package: 'using_markers'
- -- ==> add_subdirectory(using_markers)
- -- Configuring done
- -- Generating done
- -- Build files have been written to: /home/meng/ideas/ros_ws/build
- ####
- #### Running command: "make -j16" in "/home/meng/ideas/ros_ws/build"
- ####
- Scanning dependencies of target basic_shapes
- [ 50%] Building CXX object using_markers/CMakeFiles/basic_shapes.dir/src/basic_shapes.cpp.o
- [100%] Linking CXX executable /home/meng/ideas/ros_ws/devel/lib/using_markers/basic_shapes
- [100%] Built target basic_shapes
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。