Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linker tools #289

Open
4 tasks
abeimler opened this issue Sep 11, 2024 · 0 comments
Open
4 tasks

Add linker tools #289

abeimler opened this issue Sep 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@abeimler
Copy link
Contributor

abeimler commented Sep 11, 2024

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 setup-cpp@v0.41.0 && \
    # 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/*

Upvote & Fund

@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.

Thank you in advance for helping prioritize & fund our backlog!


Fund with Polar
@aminya aminya added the enhancement New feature or request label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants