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 support for optional sccache in build system #1177

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

NickeZ
Copy link
Collaborator

@NickeZ NickeZ commented Feb 16, 2024

sccache is a binary cache that wraps all calls to gcc/rustc and caches build output in ~/.cache. This speeds up a build after make clean by about 3x. I choose not to put it in the dev dockerfile by default since caching might have unexpected side effects? But I put documentation in the build docs of how to install it.

Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good call to not put it into the container so there are for sure no unexpected side effects.

Can you explain what the point is of this vs simply not calling make clean? cmake/rust already have incremental builds.

--host=${CMAKE_SYSTEM_PROCESSOR}-none-eabi --build=${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu)
--host=${CMAKE_SYSTEM_PROCESSOR}-none-eabi
--build=${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu
"$<$<BOOL:${CMAKE_C_COMPILER_LAUNCHER}>:CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't cmake automatically prepend/use the CMAKE_C_COMPILER_LAUNCHER? why is this line necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those flags are used during configuration of autotools projects like libwally. The way to enable a compiler wrapper there is to set CC="sccache gcc" when calling ./configure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know - pls add a comment 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, i thought we were in a different CMakeLists.txt. It's in external/, so that's clear enough.

@NickeZ
Copy link
Collaborator Author

NickeZ commented Feb 19, 2024

I think it's a good call to not put it into the container so there are for sure no unexpected side effects.

Can you explain what the point is of this vs simply not calling make clean? cmake/rust already have incremental builds.

Sometimes when I jump back and forth between branches it rebuilts almost everything. And before pushing I would like to be able to call .ci/ci to speed up the feedback cycle. Some outputs are probably also the same in build and build-semihosting and then sccache can reuse those compiled units. Right now I have to wait 6-7 minutes on my machine for a clean build, but with scache that takes 1.5 minute. And those minutes add up when I'm trying to get the PR to pass CI.

Especially when I'm dealing with cmake dependencies. I don't trust cmake so I do make clean between biulds.

Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

--host=${CMAKE_SYSTEM_PROCESSOR}-none-eabi --build=${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu)
--host=${CMAKE_SYSTEM_PROCESSOR}-none-eabi
--build=${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu
"$<$<BOOL:${CMAKE_C_COMPILER_LAUNCHER}>:CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know - pls add a comment 😄

@benma benma merged commit fab3ce6 into BitBoxSwiss:master Feb 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants