Add linker tools

未关闭
#289 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
cmake, cpp, github-actions, typescript

调研方向

首先跟踪 setup-cpp CLI 和 GitHub Actions 对编译器工具的选项处理,并将其与任务中提到的 clangtidy 风格支持进行比较。查看 issue 中展示的 CMakeOptions.cmake 和 find_linker 用法,然后定义 lld、mold、sold 和 gold 在所述平台上的安装和选择行为。完成的标准是可以通过 CLI 和 Actions 配置选择所请求的 linker 选项。

由索引模型根据 Issue 内容生成。

描述

enhancement

Tasks

  • lld can be easily added as it is already supported. We just need to add a CLI and actions option for it. It should be treated the same as clangtidy, etc.
  • mold
  • sold
  • gold

Description

Hi,
I was using setup-cpp with project_options (in my docker build) and custemize the linker option, see find_linker.

Would be nice to install mold or one of the other (better) Linker, rather then (gcc) ld or gold.

image
Improving C++ Compilation Times: Tools & Techniques - Vittorio Romeo - ACCU 2023

So install (?) ...

  • mold (e.g. when compiler is gcc)
  • lld when compiler is llvm (default)
  • sold for Mac OS
  • windows: ???
npx setup-cpp --compiler gcc --linker mold --cmake true --ninja true --ccache true --vcpkg true

More Context

I was getting this Error: /usr/bin/ld.gold: separate-code: unknown -z option.

CMakeOptions.cmake

find_linker(PROJECT_OPTIONS_LINKER)
MESSAGE(STATUS "Use Linker: ${PROJECT_OPTIONS_LINKER}")
project_options(
  ...
  LINKER
  ${PROJECT_OPTIONS_LINKER})
Compiler found: /usr/bin/g++-13
Use Linker: gold

After that I just installed mold and everything works:

RUN apt-get update -qq && \
    # install nodejs
    apt-get install -y --no-install-recommends nodejs npm && \
    # install setup-cpp
    npm install -g [email protected] && \
    # install the compiler and tools
    setup-cpp \
        --nala true \
        --compiler ${compiler} \
        --cmake true \
        --ninja true \
        --task true \
        --vcpkg true \
        --cppcheck true \
        --gcovr true \
        --doxygen true \
        --ccache true && \
    # install custom linker
    apt-get install -y --no-install-recommends mold && \
    # cleanup
    nala autoremove -y && \
    nala autopurge -y && \
    apt-get clean && \
    nala clean --lists && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /tmp/*
主要语言
TypeScript
星标
277
派生
37
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aminya/setup-cpp 的其他 Issue

查看 aminya/setup-cpp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。