【问题标题】:Is it possible to speed up crosstool-ng builds once errors have occured?一旦发生错误,是否可以加快 crosstool-ng 的构建速度?
【发布时间】:2012-03-28 01:30:42
【问题描述】:

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

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

`

现在,经过 50 分钟的编译,它因错误而中断:

[ERROR] configure: error: expat is missing or unusable"

我安装了所需的软件包(在 Ubuntu 10.04 中),但该错误不是问题。早些时候,我能够进入成功安装编译器的步骤,并且在此之前没有错误。我想知道是否有办法让工具跳过以前成功的步骤,节省时间? crosstool-ng 的工作方式是否可行?

【问题讨论】:

  • *请原谅格式化。谢谢。
  • 找到了。 “ct-ng --help”没有提供正确的信息。使用“ct-ng 帮助”。查找重新开始构建的选项。
  • 对于未来的 Google 员工,请使用 sudo apt-get install libexpat1-dev 修复此错误。 (仅仅安装 expat 并不能解决问题。)

标签: build cross-compiling


【解决方案1】:

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

CT_DEBUG_CT_SAVE_STEPS=1 ct-ng 构建

在某个步骤崩溃后,只需在生成的列表中找到该步骤

ct-ng 列表步骤

此时您可以通过运行恢复构建

RESTART=libc_start_files ct-ng 构建

【讨论】:

    【解决方案2】:

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

    1. 在 menuconfig 中启用此功能

    对于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

    【讨论】:

      【解决方案3】:

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

      # launch menuconfig
      
      ./ct-ng menuconfig
      
      # Path and misc options -> Set Number of parallel jobs - note default is 0!
      

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

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

      干杯!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-18
        • 2012-02-13
        • 1970-01-01
        • 1970-01-01
        • 2012-09-05
        相关资源
        最近更新 更多