Tried registering toolchain with includes to add something like /usr/include/linux so <stddef.h> could be found. Using the includes parameter did include that directory for includes, but removed all the defaults.
The invocation of gcc-toolchain uses dict::pop that has the base values as the default which is only used if the key like "includes" is not in the dict.
I also ran into this problem while trying to use aspect_gcc_toolchain with rules-rust. It looks like the story of using the two together is not fully developed.
What happened?
Tried registering toolchain with
includes
to add something like/usr/include/linux
so<stddef.h>
could be found. Using theincludes
parameter did include that directory for includes, but removed all the defaults.Version
Development (host) and target OS/architectures:
host:
linux/amd64
targets:linux/amd64
,linux/aarch64
Output of
bazel --version
:bazel 6.1.1
Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
Rust
How to reproduce
Any other information?
The documentation says that parameters like
includes
are supposed to be extra values:https://github.com/aspect-build/gcc-toolchain/blob/4bd1f94536ee92b7c49673931773038d923ee86e/docs/defs.md?plain=1#L25-L28
The invocation of
gcc-toolchain
usesdict::pop
that has the base values as thedefault
which is only used if thekey
like "includes
" is not in thedict
.https://github.com/aspect-build/gcc-toolchain/blob/4bd1f94536ee92b7c49673931773038d923ee86e/toolchain/defs.bzl#L286-L298
So it is not possible to add extra include directories without copy and pasting the directories from the following code:
https://github.com/aspect-build/gcc-toolchain/blob/4bd1f94536ee92b7c49673931773038d923ee86e/toolchain/defs.bzl#L418-L430
Original error without specifying
includes
:Error with specifying
includes
, the original base system includes are missing: