Bug 266274 - building -HEAD on an install with no compiler in /usr/bin, but using CROSS_TOOLCHAIN fails
Summary: building -HEAD on an install with no compiler in /usr/bin, but using CROSS_TO...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-07 16:02 UTC by Adrian Chadd
Modified: 2022-11-08 08:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Chadd freebsd_committer freebsd_triage 2022-09-07 16:02:06 UTC
In theory? we should be able to build -HEAD with CROSS_TOOLCHAIN even if we don't have a host compiler.

However in practice, building the host tools fails very early because we're checking the compiler/type version early in the .mk files, before CC is defined correctly.

Also, there's a fun question around whether this is acceptable or not, as we still need /host/ tools and a cross compile GCC is't that. (ie, we don't TECHICALLY have a HOST_TOOLCHAIN option.)

To reproduce:

* build a system with WITHOUT_TOOLCHAIN="YES"
* make, make install
* pkg install llvm13 (for example)
* make delete-old ; this will remove the old compiler pieces and make things very broken
* try rebuilding
Comment 1 Oleh Vinichenko 2022-11-08 08:27:13 UTC
I also stepped into this issue by running make delete-old, which then removes "cc". What i expected, that /usr/share/toolchains/llvm14.mk ( which is created after pkg install llvm14 ) is, then, correctly exported and used during CROSS_TOOLCHAIN but it doesn't. The only way to use external toolchain is to explicitly set CC, CXX, LD, AR, AS, OBJDUMP ( and all other ) with corresponding PATH, installed by llvm pkg, in /etc/make.conf. I am not sure whether it is expected, works as intended, but it looks that more information WITHOUT_TOOLCHAIN and potential danger steps user can make.