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

[FIXUP] cmake: Do not trigger cross-compiling unnecessarily #125

Merged
merged 3 commits into from
May 20, 2024

Conversation

hebasto
Copy link
Owner

@hebasto hebasto commented Mar 21, 2024

As it was pointed out during today's call, the toolchain file, which is generated by the depends build system, unnecessarily triggers CMake's cross-compiling mode by setting the CMAKE_SYSTEM_NAME variable even the host and build systems coincides.

That behavior deviates from the current master branch and potentially might have unwanted/unexpected side effects.

This PR fixes this issue.

All Guix builds remain cross-compiling.

@hebasto
Copy link
Owner Author

hebasto commented Mar 21, 2024

Friendly ping @fanquake, @TheCharlatan, @m3dwards, @theuni :)

Copy link

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tACK 5c50fe9

Nice catch! All this testing and didn't notice it 🤦🏻‍♂️🙏🏼.

Tested on Ubuntu 22.04, building both first without specifying HOST and then cross for Windows.

Before (cmake-staging) building for linux host in linux triggers cross-compilation which is wrong.
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/share/toolchain.cmake

...
Configure summary
=================
...
Cross compiling ....................... TRUE, for Linux, x86_64
...

That's wrong.

cmake -B build --toolchain depends/x86_64-w64-mingw32/share/toolchain.cmake

...
Configure summary
=================
...
Cross compiling ....................... TRUE, for Windows, x86_64
...

That's correct.

This PR fixes the issue.
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/share/toolchain.cmake

...
Configure summary
=================
...
Cross compiling ....................... FALSE
...

Now it's correct.

cmake -B build --toolchain depends/x86_64-w64-mingw32/share/toolchain.cmake

...
Configure summary
=================
...
Cross compiling ....................... TRUE, for Windows, x86_64
...

That's still correct.

@hebasto
Copy link
Owner Author

hebasto commented Apr 3, 2024

Rebased.

else()
set(c_compiler_command ${CMAKE_C_COMPILER})
endif()
set(c_compiler_command "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}")

Choose a reason for hiding this comment

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

Shouldn't this just be CMAKE_C_COMPILER? Or why has it now changed from that?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Please consider the following example:

$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.22)
set(CMAKE_CXX_COMPILER clang++ -stdlib=libc++ -std=c++20)
project(compiler_demo CXX)
message("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message("CMAKE_CXX_COMPILER_ARG1: ${CMAKE_CXX_COMPILER_ARG1}")
$ cmake -B build
-- The CXX compiler identification is Clang 18.1.3
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_CXX_COMPILER_ARG1: -stdlib=libc++ -std=c++20
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/hebasto/CMAKE_COMPILER_DEMO/build

When a language being initialized, CMake splits the compiler command into two parts, i.e., a binary and its options.

@@ -4,8 +4,10 @@

# This file is expected to be highly volatile and may still change substantially.

set(CMAKE_SYSTEM_NAME @host_system@)
set(CMAKE_SYSTEM_PROCESSOR @host_arch@)
if(@depends_crosscompiling@)

Choose a reason for hiding this comment

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

I really dislike that we still have to have this logic (and the depends counterpart), and I still don't really understand why it's needed. Now that the depends hacks are being removed, shouldn't we just be able to set CMAKE_SYSTEM_NAME, because the build system isn't going to operate specially for depends, and we've removed the CMAKE_CROSSCOMPILING usage?

In any case, according to the docs, if we are setting CMAKE_SYSTEM_NAME, we should also be setting CMAKE_SYSTEM_VERSION, or is that not needed?

CMAKE_SYSTEM_NAME may be set explicitly when first configuring a new build tree in order to enable cross compiling. In this case the CMAKE_SYSTEM_VERSION variable must also be set explicitly.

Copy link
Owner Author

Choose a reason for hiding this comment

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

we've removed the CMAKE_CROSSCOMPILING usage

Right. But CMake internally still uses it, which might affect its behaviour (feature tests, compiler invocation string, testing framework etc).

Copy link
Owner Author

@hebasto hebasto May 15, 2024

Choose a reason for hiding this comment

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

In any case, according to the docs, if we are setting CMAKE_SYSTEM_NAME, we should also be setting CMAKE_SYSTEM_VERSION

FWIW, we are not doing this on the master branch:

bitcoin/depends/funcs.mk

Lines 193 to 197 in 7fcf4e9

ifneq ($(host),$(build))
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
endif

or is that not needed?

From the CMake source code, it follows that it is used for Android and Darwin platforms. For example, on Darwin, it affects on which flags will be used by default (-Wl,-search_paths_first).

Copy link

Choose a reason for hiding this comment

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

For example, on Darwin, it affects on which flags will be used by default (-Wl,-search_paths_first).

This seems like a more correct thing to do, so that's fine, but apparently it will have no effect with lld.

Copy link

Choose a reason for hiding this comment

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

I really dislike that we still have to have this logic (and the depends counterpart), and I still don't really understand why it's needed. Now that the depends hacks are being removed, shouldn't we just be able to set CMAKE_SYSTEM_NAME, because the build system isn't going to operate specially for depends, and we've removed the CMAKE_CROSSCOMPILING usage?

FWIW, in depends we do:

cross_compiling=maybe
host_alias="@HOST@"

Which I believe pretty much has the same effect for autotools that @hebasto is describing here for CMake.

Choose a reason for hiding this comment

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

Then we should at least be documenting why we are avoiding this behaviour (besides calling something that isn't cross-compiling, cross-compiling, which is just confusing).

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sorry, but I don't understand this point. We are not trying to avoid something, rather following the CMake docs.

When we want to enable cross-compiling, we set the CMAKE_SYSTEM_NAME variable, which sets the CMAKE_CROSSCOMPILING one explicitly.

When we don't want to enable cross-compiling, we skip touching the CMAKE_SYSTEM_NAME variable.

Anyway, I'll be happy to add a comment to this code. Do you mind suggesting a good wording for it?

Choose a reason for hiding this comment

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

When we don't want to enable cross-compiling, we skip touching the CMAKE_SYSTEM_NAME variable.

This is what we are avoiding. Otherwise CMake decides things are cross-compilation, even when they are not. Otherwise we'd be free to set this all the time.

Choose a reason for hiding this comment

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

@hebasto, for the wording, if @fanquake allows me here and agrees with it, perhaps something like:

# Setting CMAKE_SYSTEM_NAME only when cross-compiling is intended.
# This prevents CMake from misinterpreting the build as a cross-compilation,
# which could lead to incorrect configurations. If we are not cross-compiling,
# leave CMAKE_SYSTEM_NAME unset to allow CMake to correctly infer the build system.

If it's too long, I'd just get the first 2 lines and add the link to the CMAKE_CROSSCOMPILING documentation.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Then we should at least be documenting why we are avoiding this behaviour (besides calling something that isn't cross-compiling, cross-compiling, which is just confusing).

An explanatory comment has been added.

@hebasto hebasto force-pushed the 240321-cmake-CP branch 4 times, most recently from a8b35ef to 9babd89 Compare April 25, 2024 23:22
@hebasto
Copy link
Owner Author

hebasto commented Apr 26, 2024

My Guix build:

x86_64
8d8a3cdf85ef1db894ea32513f4ffc9cec8956f22d86347273fe47e5deafe944  guix-build-9babd89ffa4f/output/aarch64-linux-gnu/SHA256SUMS.part
f81276590ba8e61c2561d9e4e11f6ac131f0d0118441b9358ad07c54ea4a0e2b  guix-build-9babd89ffa4f/output/aarch64-linux-gnu/bitcoin-9babd89ffa4f-aarch64-linux-gnu-debug.tar.gz
efa171833b8ec02bc47d2bebf8e2a0548547ac8ca9360ba3ba7b9a4c9cb927b3  guix-build-9babd89ffa4f/output/aarch64-linux-gnu/bitcoin-9babd89ffa4f-aarch64-linux-gnu.tar.gz
d43586550804789802d6b7517624eb29c077609b65ef24a212f3c16e8446ac59  guix-build-9babd89ffa4f/output/arm-linux-gnueabihf/SHA256SUMS.part
d1d016eda31aea2b0755334bc12ec7550187f4ee932790d17dafe82577ece481  guix-build-9babd89ffa4f/output/arm-linux-gnueabihf/bitcoin-9babd89ffa4f-arm-linux-gnueabihf-debug.tar.gz
97d3c45af24900b740e42336cd0406069d3d2e68e62d1baec0b3d81a8e1ac7a0  guix-build-9babd89ffa4f/output/arm-linux-gnueabihf/bitcoin-9babd89ffa4f-arm-linux-gnueabihf.tar.gz
84d835cce5666cdbd526591416ac70eaaee9cd0eba6d3f8e8019a37cfbae0a6b  guix-build-9babd89ffa4f/output/arm64-apple-darwin/SHA256SUMS.part
05ab87a6e8ea82f2d84804103e6a3418560117a88660be1f83e40e827ac6b87a  guix-build-9babd89ffa4f/output/arm64-apple-darwin/bitcoin-9babd89ffa4f-arm64-apple-darwin-unsigned.tar.gz
08a3b22fedeb97af9b7ade56db64221c4f497d596181edad3093da55031bece4  guix-build-9babd89ffa4f/output/arm64-apple-darwin/bitcoin-9babd89ffa4f-arm64-apple-darwin-unsigned.zip
92c8755b141a1c6a3342124df25ee314d51abfe3bd15e88cfbe71a4e4b32559b  guix-build-9babd89ffa4f/output/arm64-apple-darwin/bitcoin-9babd89ffa4f-arm64-apple-darwin.tar.gz
c71d1a07c157ce9a841d2baf99751af407b06f1a43c75cf1ea7cca20304e4ef9  guix-build-9babd89ffa4f/output/dist-archive/bitcoin-9babd89ffa4f.tar.gz
84bb4ce791b1a1600c4ae205d3ca92108f25b9e53ae7c54575fa995baf3a43de  guix-build-9babd89ffa4f/output/powerpc64-linux-gnu/SHA256SUMS.part
781818648af640695cede2000731c382419e2c586151661f1ba69c547783604f  guix-build-9babd89ffa4f/output/powerpc64-linux-gnu/bitcoin-9babd89ffa4f-powerpc64-linux-gnu-debug.tar.gz
6ba90ee845607715f948bddbc7072ee055f9244deff0f0eb9a7190f85324538b  guix-build-9babd89ffa4f/output/powerpc64-linux-gnu/bitcoin-9babd89ffa4f-powerpc64-linux-gnu.tar.gz
ea9b6a01595730b16606f18011bf0424c50836741c1491f4f071105788f279ac  guix-build-9babd89ffa4f/output/riscv64-linux-gnu/SHA256SUMS.part
f0191f7e7f62c693269dd464910984b755df8ea624d6a2e39725be577fd5a80d  guix-build-9babd89ffa4f/output/riscv64-linux-gnu/bitcoin-9babd89ffa4f-riscv64-linux-gnu-debug.tar.gz
28ee87adf4f84a5e49c7ba165dff470faccee5bec695b579fea40bad39b25067  guix-build-9babd89ffa4f/output/riscv64-linux-gnu/bitcoin-9babd89ffa4f-riscv64-linux-gnu.tar.gz
fdd2c1c1e348c7838403b7ab9c15384427da3a35bcd23f69414e50f3f39575d7  guix-build-9babd89ffa4f/output/x86_64-apple-darwin/SHA256SUMS.part
4a0196fd8d7d0802711e92f9b7d9d0c7c9a5794b7a170ea34132fbee37fe536f  guix-build-9babd89ffa4f/output/x86_64-apple-darwin/bitcoin-9babd89ffa4f-x86_64-apple-darwin-unsigned.tar.gz
31ab48843135c4991380d3090317627157d71e3140e47875462e560f7d573633  guix-build-9babd89ffa4f/output/x86_64-apple-darwin/bitcoin-9babd89ffa4f-x86_64-apple-darwin-unsigned.zip
62985bf885bfa6fb5807728ad14e80e5f6e4d9948e49d1cc006f2516fd99f421  guix-build-9babd89ffa4f/output/x86_64-apple-darwin/bitcoin-9babd89ffa4f-x86_64-apple-darwin.tar.gz
09527fa5eec31219450eb145b63985638843c707b2eeab2b20815da125f26820  guix-build-9babd89ffa4f/output/x86_64-linux-gnu/SHA256SUMS.part
19b12811fb3fa499100145e7f5c590f3616098e95dd4d750316674aba13f6216  guix-build-9babd89ffa4f/output/x86_64-linux-gnu/bitcoin-9babd89ffa4f-x86_64-linux-gnu-debug.tar.gz
4735adf7b960944b43eb159aacf1942fbfdc68b098eb523238ac85e16ae51642  guix-build-9babd89ffa4f/output/x86_64-linux-gnu/bitcoin-9babd89ffa4f-x86_64-linux-gnu.tar.gz
c67b9f63f89db74cde26b87db327c64ce4083e45f545b7268d84da2a747792b4  guix-build-9babd89ffa4f/output/x86_64-w64-mingw32/SHA256SUMS.part
a21e5947bf57e1cb984b1a075cbe16b3262cdb30d1f86c5ab49dafe4c48c3d78  guix-build-9babd89ffa4f/output/x86_64-w64-mingw32/bitcoin-9babd89ffa4f-win64-debug.zip
d68d01dfc358e362cace8c8bc5793649d870c5c0bb44c3f320cbea0fda1d33c1  guix-build-9babd89ffa4f/output/x86_64-w64-mingw32/bitcoin-9babd89ffa4f-win64-setup-unsigned.exe
c43855f24eb09f93d832dd4da16d6ee8097673341e53075bf0176f4409cc1252  guix-build-9babd89ffa4f/output/x86_64-w64-mingw32/bitcoin-9babd89ffa4f-win64-unsigned.tar.gz
3a51f808624c1e49a99ae109b7f442e673464e6aa2007160f5735a213dc27a1b  guix-build-9babd89ffa4f/output/x86_64-w64-mingw32/bitcoin-9babd89ffa4f-win64.zip

else()
set(c_compiler_command ${CMAKE_C_COMPILER})
endif()
list(JOIN CMAKE_C_COMPILER_LAUNCHER " " c_compiler_command)

Choose a reason for hiding this comment

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

Looks like this has just taken on the depends macos ccache hack behaviour for everything, and I still don't understand why?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It is not only about "ccache hack".

Consider the following example:

$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.22)
set(CMAKE_CXX_COMPILER env -u A_VAR clang++)
project(compiler_demo CXX)
message("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
$ cmake -B build
-- The CXX compiler identification is Clang 18.1.3
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/env - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_CXX_COMPILER: /usr/bin/env
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/hebasto/CMAKE_COMPILER_DEMO/build

The output CMAKE_CXX_COMPILER: /usr/bin/env is quite misleading.

Choose a reason for hiding this comment

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

set(CMAKE_CXX_COMPILER env -u A_VAR clang++)

Where are we doing this?

Choose a reason for hiding this comment

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

I still don't understand why we need to do anything other than set(c_compiler_command ${CMAKE_C_COMPILER}), like we have been doing this entire time. If this was working perfectly fine before, why does it not work now.

Copy link
Owner Author

Choose a reason for hiding this comment

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

set(CMAKE_CXX_COMPILER env -u A_VAR clang++)

Where are we doing this?

darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
-u LIBRARY_PATH \
$(clangxx_prog) --target=$(host) \
-B$(build_prefix)/bin \
-isysroot$(OSX_SDK) -nostdlibinc \
-iwithsysroot/usr/include/c++/v1 \
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks

Copy link
Owner Author

@hebasto hebasto May 15, 2024

Choose a reason for hiding this comment

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

The config output from CMake itself also isn't relevant for those scripts?

It demonstrates that the value of the CMAKE_CXX_COMPILER variable could be useless to convey it to an external python script that expects a compiler invocation string.

Choose a reason for hiding this comment

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

Can we get some documentation.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Can we get some documentation.

Sure. That's what I can suggest to consider:

  1. The CMAKE_<LANG>_COMPILER variable docs:

The full path to the compiler for LANG.

If a non-full path value is supplied then CMake will resolve the full path of the compiler.

  1. From the source code:
    # if CMAKE_${lang}_COMPILER is a list, use the first item as
    # CMAKE_${lang}_COMPILER and the rest as CMAKE_${lang}_COMPILER_ARG1
  1. The <LANG>_COMPILER_LAUNCHER property docs:

Specify a semicolon-separated list containing a command line for a compiler launching tool. ...
Some example tools are distcc and ccache.

The env command is a similar wrapper tool.

Choose a reason for hiding this comment

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

I mean a comment in our code.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sure. A comment has been added.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@hebasto hebasto force-pushed the 240321-cmake-CP branch 2 times, most recently from ad6d890 to 9babd89 Compare April 26, 2024 11:41
@hebasto hebasto force-pushed the 240321-cmake-CP branch 2 times, most recently from ebb89af to a818bf5 Compare April 30, 2024 18:11
@hebasto hebasto mentioned this pull request May 2, 2024
hebasto added a commit that referenced this pull request May 2, 2024
729632c fixup! ci: Test CMake edge cases (Hennadii Stepanov)
107bdf8 fixup! ci: Test CMake edge cases (Hennadii Stepanov)

Pull request description:

  1. The first commit forces the build step in the native Windows jobs to fail if build fails. Otherwise, the build step might
  falsely succeed because the last command exit code determines the return status of the step.

  I've noticed such wrong behaviour while working on #182.

  2. The second commit pulled from #125.

ACKs for top commit:
  m3dwards:
    utACK 729632c

Tree-SHA512: 3530f8c2d60896665adff52caaf88460e18bf1087f9350337a4f191558023ee3484b0639673f90c48d6c24074338b640d5cfde067bb90344dfebaa2d6173f1cc
@hebasto
Copy link
Owner Author

hebasto commented May 2, 2024

Rebased.

@hebasto
Copy link
Owner Author

hebasto commented May 4, 2024

Rebased on top of the #188.

@hebasto hebasto force-pushed the 240321-cmake-CP branch 2 times, most recently from aefa673 to eb51d1b Compare May 8, 2024 17:56
@hebasto
Copy link
Owner Author

hebasto commented May 8, 2024

Rebased. It's one commit only now :)

Copy link

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

reACK eb51d1b

Validated the changes from my first tACK and I've been following discussions with @fanquake.

Re-tested eb51d1b, the issue is still fixed with this version.

@hebasto
Copy link
Owner Author

hebasto commented May 8, 2024

#125 (comment):

In any case, according to the docs, if we are setting CMAKE_SYSTEM_NAME, we should also be setting CMAKE_SYSTEM_VERSION, or is that not needed?

CMAKE_SYSTEM_NAME may be set explicitly when first configuring a new build tree in order to enable cross compiling. In this case the CMAKE_SYSTEM_VERSION variable must also be set explicitly.

This point is still valid and needs to be addressed.

@hebasto
Copy link
Owner Author

hebasto commented May 15, 2024

#125 (comment):

In any case, according to the docs, if we are setting CMAKE_SYSTEM_NAME, we should also be setting CMAKE_SYSTEM_VERSION, or is that not needed?

CMAKE_SYSTEM_NAME may be set explicitly when first configuring a new build tree in order to enable cross compiling. In this case the CMAKE_SYSTEM_VERSION variable must also be set explicitly.

This point is still valid and needs to be addressed.

Considering #125 (comment) and the fact that we are defining cross-compiling toolchain options explicitly, I see no point in adding CMAKE_SYSTEM_VERSION for now.

@fanquake
Copy link

Considering #125 (comment) and the fact that we are defining cross-compiling toolchain options explicitly, I see no point in adding CMAKE_SYSTEM_VERSION for now.

Why not? That comment just says we aren't doing it in master (but should we be?) and that it's needed for Darwin. So I don't really follow in why there's no point in doing it now?

@hebasto
Copy link
Owner Author

hebasto commented May 15, 2024

Considering #125 (comment) and the fact that we are defining cross-compiling toolchain options explicitly, I see no point in adding CMAKE_SYSTEM_VERSION for now.

Why not? That comment just says we aren't doing it in master (but should we be?) and that it's needed for Darwin. So I don't really follow in why there's no point in doing it now?

The CMAKE_SYSTEM_VERSION has been added to the toolchain file.

@hebasto
Copy link
Owner Author

hebasto commented May 15, 2024

My Guix build:

x86_64
5be32f6c7c641c4742b38cb7b1f4a3b54a5b46df52f702f311d496de40e7bb36  guix-build-9edae900601c/output/aarch64-linux-gnu/SHA256SUMS.part
4b245ad03374465fb76b1df60e6d7bccaf2c3501d70dafad0a77c72006e8e5ac  guix-build-9edae900601c/output/aarch64-linux-gnu/bitcoin-9edae900601c-aarch64-linux-gnu-debug.tar.gz
a1af88291832ab158f65b3dc9ddf52b132aa529729dfb3206c6137dfe83707ba  guix-build-9edae900601c/output/aarch64-linux-gnu/bitcoin-9edae900601c-aarch64-linux-gnu.tar.gz
db81d9e9a71bf24b3f09a7612a011b3c944f53c1213c8b8671cb225cad83d1d3  guix-build-9edae900601c/output/arm-linux-gnueabihf/SHA256SUMS.part
4008dc080bc72a6f01f6246a023a9bf1227e676714e215d0f1936ec777c5e735  guix-build-9edae900601c/output/arm-linux-gnueabihf/bitcoin-9edae900601c-arm-linux-gnueabihf-debug.tar.gz
05c27e43f8886824d8a6b67e05ae564d923d2a3f70aa41cbcecca2568aa6f10f  guix-build-9edae900601c/output/arm-linux-gnueabihf/bitcoin-9edae900601c-arm-linux-gnueabihf.tar.gz
a6967469a6d18ae8fa251aae85cdd15f0bea0d4581358ed61042adea2ee0a249  guix-build-9edae900601c/output/arm64-apple-darwin/SHA256SUMS.part
5b2b8c8de551008d4607f8b2094dff09bae05415c65b08f9107ba784af734ec3  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin-unsigned.tar.gz
8826a42b0d1495bfe44c4197978447554c8bec639a64221749447a526c893197  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin-unsigned.zip
8d5ef485f253fc811591497ecc4de605572c93d92b6fa2041485760a39541d44  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin.tar.gz
14a8aba57777221bdf495f18427b320cfb9d37e0d9bb61a5e2cd88add9d294ab  guix-build-9edae900601c/output/dist-archive/bitcoin-9edae900601c.tar.gz
897158af0df979f8b539b18966ea1d2825bd00a1cbb752cda7476f6bcc250bb7  guix-build-9edae900601c/output/powerpc64-linux-gnu/SHA256SUMS.part
fe25dfd58e32780bf554a057c0566b3cb8250b8ff8efc6e524dae88ba2cdf073  guix-build-9edae900601c/output/powerpc64-linux-gnu/bitcoin-9edae900601c-powerpc64-linux-gnu-debug.tar.gz
8d25e024dabcfe9314e1305c670c1773d70920b496005976ec726c0d8d15d62a  guix-build-9edae900601c/output/powerpc64-linux-gnu/bitcoin-9edae900601c-powerpc64-linux-gnu.tar.gz
9cd92790126e9866543a67b867b64b6c2d798795944dc3cca6aac8bc4b73a013  guix-build-9edae900601c/output/riscv64-linux-gnu/SHA256SUMS.part
914f1763441f3c45c9065e7be553025a30b4b3f8136ae61d3a147ec85d615e76  guix-build-9edae900601c/output/riscv64-linux-gnu/bitcoin-9edae900601c-riscv64-linux-gnu-debug.tar.gz
b5a1852a7ea259f13b261bdc1f41072f3f93b5c7b9fc4f4eb20d84da2d30b4a9  guix-build-9edae900601c/output/riscv64-linux-gnu/bitcoin-9edae900601c-riscv64-linux-gnu.tar.gz
d9964d44568cd423bb60f6c80263aa4fa88f38d6d29fc979342ab26b56afa3ea  guix-build-9edae900601c/output/x86_64-apple-darwin/SHA256SUMS.part
d0d2717b17decfcfba65c61f648c94b75230ff88fb194711ef87d4f5feb45deb  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin-unsigned.tar.gz
3137347a69152d0a7c492e95c03992ff28906d703e190cad642233bfe9a30dc9  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin-unsigned.zip
c9856716f78ade3081d69648237dca5a361cbb8c7e69e5b8d215a1fadc5dad4e  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin.tar.gz
60a281341116c732673667753075c4c7157d5530ebde39d1d1def09003d765af  guix-build-9edae900601c/output/x86_64-linux-gnu/SHA256SUMS.part
042adaffe6e1328ba39d97de3c3022216c5118c64a5b74894815ee10ee3f0793  guix-build-9edae900601c/output/x86_64-linux-gnu/bitcoin-9edae900601c-x86_64-linux-gnu-debug.tar.gz
d49c545027a6e801e6b4f98bcf47f8a491c7a2b2d00ab855421e3209ab73d21a  guix-build-9edae900601c/output/x86_64-linux-gnu/bitcoin-9edae900601c-x86_64-linux-gnu.tar.gz
92fb0d044ccdd5143a949c0b792e53f9d6267d345a016152ea70dcaa38ad069d  guix-build-9edae900601c/output/x86_64-w64-mingw32/SHA256SUMS.part
3ce91d2ffaac1ac2039e3722828352afab07f266d5b99a7f851594a2119f9c36  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-debug.zip
7d36aa712b06e23c83a5820bc89a9da453d1d9c371409edd5cf8d3f12a3b1f09  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-setup-unsigned.exe
e284cf56540ea41a45adc18682ee1f95a109f54e22fd94fc80a189ed8f32a139  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-unsigned.tar.gz
67001dffcaae5b7e6c3265ad98392895b9224292eb22ecb22df6116340888460  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64.zip

@TheCharlatan
Copy link

TheCharlatan commented May 17, 2024

Guix build (aarch64):

5be32f6c7c641c4742b38cb7b1f4a3b54a5b46df52f702f311d496de40e7bb36  guix-build-9edae900601c/output/aarch64-linux-gnu/SHA256SUMS.part
4b245ad03374465fb76b1df60e6d7bccaf2c3501d70dafad0a77c72006e8e5ac  guix-build-9edae900601c/output/aarch64-linux-gnu/bitcoin-9edae900601c-aarch64-linux-gnu-debug.tar.gz
a1af88291832ab158f65b3dc9ddf52b132aa529729dfb3206c6137dfe83707ba  guix-build-9edae900601c/output/aarch64-linux-gnu/bitcoin-9edae900601c-aarch64-linux-gnu.tar.gz
db81d9e9a71bf24b3f09a7612a011b3c944f53c1213c8b8671cb225cad83d1d3  guix-build-9edae900601c/output/arm-linux-gnueabihf/SHA256SUMS.part
4008dc080bc72a6f01f6246a023a9bf1227e676714e215d0f1936ec777c5e735  guix-build-9edae900601c/output/arm-linux-gnueabihf/bitcoin-9edae900601c-arm-linux-gnueabihf-debug.tar.gz
05c27e43f8886824d8a6b67e05ae564d923d2a3f70aa41cbcecca2568aa6f10f  guix-build-9edae900601c/output/arm-linux-gnueabihf/bitcoin-9edae900601c-arm-linux-gnueabihf.tar.gz
a6967469a6d18ae8fa251aae85cdd15f0bea0d4581358ed61042adea2ee0a249  guix-build-9edae900601c/output/arm64-apple-darwin/SHA256SUMS.part
5b2b8c8de551008d4607f8b2094dff09bae05415c65b08f9107ba784af734ec3  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin-unsigned.tar.gz
8826a42b0d1495bfe44c4197978447554c8bec639a64221749447a526c893197  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin-unsigned.zip
8d5ef485f253fc811591497ecc4de605572c93d92b6fa2041485760a39541d44  guix-build-9edae900601c/output/arm64-apple-darwin/bitcoin-9edae900601c-arm64-apple-darwin.tar.gz
14a8aba57777221bdf495f18427b320cfb9d37e0d9bb61a5e2cd88add9d294ab  guix-build-9edae900601c/output/dist-archive/bitcoin-9edae900601c.tar.gz
897158af0df979f8b539b18966ea1d2825bd00a1cbb752cda7476f6bcc250bb7  guix-build-9edae900601c/output/powerpc64-linux-gnu/SHA256SUMS.part
fe25dfd58e32780bf554a057c0566b3cb8250b8ff8efc6e524dae88ba2cdf073  guix-build-9edae900601c/output/powerpc64-linux-gnu/bitcoin-9edae900601c-powerpc64-linux-gnu-debug.tar.gz
8d25e024dabcfe9314e1305c670c1773d70920b496005976ec726c0d8d15d62a  guix-build-9edae900601c/output/powerpc64-linux-gnu/bitcoin-9edae900601c-powerpc64-linux-gnu.tar.gz
9cd92790126e9866543a67b867b64b6c2d798795944dc3cca6aac8bc4b73a013  guix-build-9edae900601c/output/riscv64-linux-gnu/SHA256SUMS.part
914f1763441f3c45c9065e7be553025a30b4b3f8136ae61d3a147ec85d615e76  guix-build-9edae900601c/output/riscv64-linux-gnu/bitcoin-9edae900601c-riscv64-linux-gnu-debug.tar.gz
b5a1852a7ea259f13b261bdc1f41072f3f93b5c7b9fc4f4eb20d84da2d30b4a9  guix-build-9edae900601c/output/riscv64-linux-gnu/bitcoin-9edae900601c-riscv64-linux-gnu.tar.gz
d9964d44568cd423bb60f6c80263aa4fa88f38d6d29fc979342ab26b56afa3ea  guix-build-9edae900601c/output/x86_64-apple-darwin/SHA256SUMS.part
d0d2717b17decfcfba65c61f648c94b75230ff88fb194711ef87d4f5feb45deb  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin-unsigned.tar.gz
3137347a69152d0a7c492e95c03992ff28906d703e190cad642233bfe9a30dc9  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin-unsigned.zip
c9856716f78ade3081d69648237dca5a361cbb8c7e69e5b8d215a1fadc5dad4e  guix-build-9edae900601c/output/x86_64-apple-darwin/bitcoin-9edae900601c-x86_64-apple-darwin.tar.gz
60a281341116c732673667753075c4c7157d5530ebde39d1d1def09003d765af  guix-build-9edae900601c/output/x86_64-linux-gnu/SHA256SUMS.part
042adaffe6e1328ba39d97de3c3022216c5118c64a5b74894815ee10ee3f0793  guix-build-9edae900601c/output/x86_64-linux-gnu/bitcoin-9edae900601c-x86_64-linux-gnu-debug.tar.gz
d49c545027a6e801e6b4f98bcf47f8a491c7a2b2d00ab855421e3209ab73d21a  guix-build-9edae900601c/output/x86_64-linux-gnu/bitcoin-9edae900601c-x86_64-linux-gnu.tar.gz
92fb0d044ccdd5143a949c0b792e53f9d6267d345a016152ea70dcaa38ad069d  guix-build-9edae900601c/output/x86_64-w64-mingw32/SHA256SUMS.part
3ce91d2ffaac1ac2039e3722828352afab07f266d5b99a7f851594a2119f9c36  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-debug.zip
7d36aa712b06e23c83a5820bc89a9da453d1d9c371409edd5cf8d3f12a3b1f09  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-setup-unsigned.exe
e284cf56540ea41a45adc18682ee1f95a109f54e22fd94fc80a189ed8f32a139  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64-unsigned.tar.gz
67001dffcaae5b7e6c3265ad98392895b9224292eb22ecb22df6116340888460  guix-build-9edae900601c/output/x86_64-w64-mingw32/bitcoin-9edae900601c-win64.zip

endif()

# In CMake, the components of the compiler invocation are separated into three distinct variables:
# - CMAKE_C_COMPILER_LAUNCHER: a semicolon-separated list of launchers or tools to precede the compiler (e.g., env or ccache).
Copy link

Choose a reason for hiding this comment

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

Does this mean that ccache and env can't be used simultaneously? Basically meaning that ccache can't be used for darwin builds?

Copy link
Owner Author

@hebasto hebasto May 17, 2024

Choose a reason for hiding this comment

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

Does this mean that ccache and env can't be used simultaneously?

No, it does not.

The current implementation works flawlessly for ccache + darwin. It appends ccache command to the CMAKE_{C.CXX}_COMPILER_LAUNCHER variables after env.

UPD. The resulted compiler invocation string looks like env ... ccache ... clang ...

@TheCharlatan
Copy link

Tested this on macos natively, with and without ccache, and seems to work correctly.

Copy link

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

lgtm

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.

5 participants