一旦发生错误,是否有可能加快crosstool-ng构建?

时间:2012-03-28 01:30:42

标签: build cross-compiling

我正在使用crosstool-ng为beagleboard-xm构建一个tolchain。构建以下面描述的方式进行:

  

[INFO]   ================================================== =============== [INFO]检索所需的工具链组件的tarball [INFO]   检索所需的工具链组件的tarball:在0.51s完成(at   00:08)[INFO]   ================================================== =============== [INFO]提取和修补工具链组件[INFO]   提取和修补工具链组件:在7.91s完成(在00:16)   [INFO]   ================================================== =============== [INFO]安装GMP [INFO]安装GMP:在140.48s完成(at   02:36)[INFO]   ================================================== =============== [INFO]安装MPFR [INFO]安装MPFR:在36.01s完成(at   03:13)[信息]   ================================================== =============== [INFO]安装PPL。

     

`

现在,经过50分钟的编译后,它会出现错误:

  

[ERROR] configure:error:expat缺失或无法使用“

我安装了所需的软件包(在Ubuntu 10.04中),但错误不是问题。之前我能够到达成功安装编译器的步骤,直到那时没有错误。我想知道是否有办法让工具跳过以前成功的步骤,节省时间?甚至可以用crosstool-ng的方式工作吗?

3 个答案:

答案 0 :(得分:16)

是的,这是可能的。像这样运行ct-ng

  

CT_DEBUG_CT_SAVE_STEPS = 1 ct-ng build

在某个步骤崩溃后,只需找到

生成的列表中的步骤
  

ct-ng list-steps

此时您可以通过运行

恢复构建
  

RESTART = libc_start_files ct-ng build

答案 1 :(得分:8)

是的,目前的crosstool-ng支持此功能。

  1. 在menuconfig中启用此功能
  2. 代表ct-ng menuconfig,配置Paths and misc options就像这样

    ───────────────────── Paths and misc options ─────────────────────
    [*] Debug crosstool-NG
    [ ]   Pause between every steps
    [*]   Save intermediate steps
    [*]     gzip saved states
    [*]   Interactive shell on failed commands
    

    2.在构建时,对于每个成功完成的步骤,您将看到如下内容:

    Saving state to restart at step 'xxx'...

    3.失败后,修复后,再使用ct-ng LAST_SUCCESSFUL_STETP_NAME+继续构建

    我的例子:

    CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
    $ ct-ng list-steps
    Available build steps, in order:
      - libc_check_config
      - companion_libs_for_build
      - binutils_for_build
      - companion_libs_for_host
      - binutils_for_host
      - cc_core_pass_1
      - kernel_headers
      - libc_start_files
      - cc_core_pass_2
      - libc
      - cc_for_build
      - cc_for_host
      - libelf_for_target
      - binutils_for_target
      - debug
      - test_suite
      - finish
    Use "<step>"p>" as action to execute only that step"+<step>"lt;step>" as action to execute up to tha"<step>+"se "<step>+" as action to execute from that step onward.
    
    CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
    $ ct-ng libc+
    [INFO ]  Performing some trivial sanity checks
    [INFO ]  Build started 20130801.120248
    [INFO ]  Building environ'libc'ariables
    [EXTRA]  Preparing working directories
    [EXTRA]  Restoring state at step 'libc', as requested.
    [INFO ]  =================================================================
    [INFO ]  Installing C library
    [EXTRA]    Configuring C library
    [EXTRA]    Building C library
    [01:55] /
    

    如需更多解释,请参阅我的帖子:crosstool-ng build for xscale

答案 2 :(得分:0)

另一个重要的节省时间 - 在具有多核 CPU 的主机上构建时,为并行作业线程配置 crosstool-ng..

# launch menuconfig

./ct-ng menuconfig

# Path and misc options -> Set Number of parallel jobs - note default is 0!

这应该会显着加快您的构建作业。

显然,根据您的主机系统 CPU 架构相应地设置此值 - 确保至少保留一两个内核可用于主机操作系统和其他线程...

干杯!