Building Packages

一旦安装了所需的系统依赖项,我们就可以编译刚刚创建的package了。

使用rosmake

rosmake是跟make 类似的小工具, 但它会针对ROS做一些相应的处理。当你执行rosmake beginner_tutorials命令, 编译beginner_tutorials package,并按照正确的顺序链接所依赖的package。 因为我们在创建的ROS package的时候加入了对 rospy, roscpp, 和std_msgs 的依赖,所以这些package(以及它们的依赖项,等等,如此反复) 都将会被rosmake所编译。

使用方法:

rosmake [package]

执行:

$ rosmake beginner_tutorials

这条指令的执行需要一些时间。在这期间,你会看到如下的信息输出:

  • [ rosmake ] No package specified.  Building ['beginner_tutorials']
    [ rosmake ] Logging to directory
    [ rosmake ] /home/dbking/.ros/rosmake_output-2009-09-22-03-17-14
    [ rosmake ] [ 0 of 18  Completed ]
    [rosmake-0] >>> genmsg_cpp >>> [ make ]
    [rosmake-0] <<< genmsg_cpp <<< [PASS] [ 0.39 seconds ]
    [ rosmake ] [ 1 of 18  Completed ]
    ...
    ...
    ...
    [ rosmake ] [ 17 of 18  Completed ]
    [rosmake-0] >>> beginner_tutorials >>> [ make ]
    [rosmake-0] <<< beginner_tutorials <<< [PASS] [ 0.79 seconds ]

在Fuerte版本, 依赖项被大规模精简,所以几乎会马上输出:

  • [ rosmake ] rosmake starting...                                                                     
    [ rosmake ] Packages requested are: ['beginner_tutorials']                                          
    [ rosmake ] Logging to directory /home/alex/.ros/rosmake/rosmake_output-20120603-082414             
    [ rosmake ] Expanded args ['beginner_tutorials'] to:
    ['beginner_tutorials']                         
    [rosmake-0] Starting >>> std_msgs [ make ]                                                          
    [rosmake-1] Starting >>> roslang [ make ]                                                           
    [rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs
     No Makefile in package std_msgs  
    [rosmake-1] Finished <<< roslang ROS_NOBUILD in package roslang
     No Makefile in package roslang     
    [rosmake-1] Starting >>> rospy [ make ]                                                             
    [rosmake-2] Starting >>> roscpp [ make ]                                                            
    [rosmake-1] Finished <<< rospy ROS_NOBUILD in package rospy
     No Makefile in package rospy           
    [rosmake-2] Finished <<< roscpp ROS_NOBUILD in package roscpp
     No Makefile in package roscpp        
    [rosmake-2] Starting >>> beginner_tutorials [ make ]                                                
    [rosmake-2] Finished <<< beginner_tutorials [PASS] [ 1.14 seconds ]                                 
    [ rosmake ] Results:                                                                                
    [ rosmake ] Built 5 packages with 0 failures.                                                       
    [ rosmake ] Summary output to directory                                                             
    [ rosmake ] /home/alex/.ros/rosmake/rosmake_output-20120603-082414  

rosmake 多个ROS package

同样,我们可以利用 rosmake同时编译多个package。

使用方法:

rosmake [package1] [package2] [package3]

Review

下面,复习一下刚刚使用过的指令:

  • rosdep = ros+dep(endencies) : 安装package所需系统依赖项的小工具
  • rosmake = ros+make : 编译 ROS package

Wiki: cn/ROS/Tutorials/rosbuild/BuildingPackages (last edited 2013-11-01 02:56:33 by zhongjin616)