Hi :)
Following
https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.htmlAnd after some fixes i managed to build the "hello-world.cc" example file,
(the example does not work well on my bazel version which is 0.25.2)
(in `cc_toolchain_config.bzl` i have added these compilation flags to get system libs hdrs:
"-nostdinc",
"-nostdlib",
"-isystem",
"external/emscripten_toolchain/system/include/libcxx",
"-isystem",
"external/emscripten_toolchain/system/lib/libcxxabi/include",
"-isystem",
"external/emscripten_toolchain/system/include/compat",
"-isystem",
"external/emscripten_toolchain/system/include",
"-isystem",
"external/emscripten_toolchain/system/include/libc",
"-isystem",
"external/emscripten_toolchain/system/lib/libc/musl/arch/emscripten",
"-isystem",
"external/emscripten_toolchain/system/local/include",
"-U_FORTIFY_SOURCE",
"-fstack-protector",
"-fPIE",
"-fdiagnostics-color=always",
)
Anyways...
building a different target, with an external (external target imported to the WORKSPACE) dependency or even a target with an internal dependency
gets me:
"undeclared inclusion(s) in rule"
I've found that the easiest solution which i don't like at all is:
in cc_toolchain_config.bzl (CROSSTOOL):
cxx_builtin_include_directories = [ctx.var["workspace"], ctx.var["output_base"]]
And run build command:
bazel build --sandbox_debug --verbose_failures --define=workspace=$(bazel info workspace) --define=output_base=$(bazel info output_base) --crosstool_top=//toolchain:emscripten --cpu='emscripten' --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //:hello-world.js
However, this is not a good solution because why would i need to specify the WORKSPACE dir as a configuration argument if it's value is constant?
Is there a way to get `output_base` and `workspace` paths from `ctx`? is there a way maybe to get these values in a BUILD file and set it as one of the attributes in `cc_toolchain_config`?
Or do you have a totally different solution?
Any help will be appreciated