Control: tags -1 + moreinfo

Hi Fabian,

On Thu, 09 Oct 2025 17:58:55 +0200 Fabian Greffrath <[email protected]> wrote:
the /usr/share/cmake/debtoolchainfilegen tool comes handy to create a toolchain file for cross-building. However, when cross-building is involved, it is often a good idea to reset the build flags for the compilers and linkers - or at least reduce them to a subset that is known to work on the build architecture.

That's what the *_FOR_BUILD flags are for.

I'd suggest to include these flags in the toolchain file generated by debtoolchainfilegen, in the same form that they are emitted by dpkg-buildflags. Either always, or only if a parameter (say '-f') is additionally given to debtoolchainfilegen.

Example:
set(CMAKE_C_FLAGS "$ENV{CFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD}")
set(CMAKE_EXE_LINKER_FLAGS "$ENV{LDFLAGS_FOR_BUILD}")

Thanks for considering!

[Cc'ing Helmut because he wrote the debtoolchainfilegen tool and can probably fill in the blanks in my understanding]

AFAICT, the generated config is supposed to be used for the host compiler, so I'm not entirely sure I understand how the *_FOR_BUILD flags fit into the picture here. I am open to improvements for the cross-build use-case, though.


Cheers
Timo

--
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯

Attachment: signature.asc
Description: PGP signature

Reply via email to