Hi :)

Following 
https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
And 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



-- 
*IOTA Foundation*
c/o Nextland
Strassburgerstraße 55
10405 Berlin, Germany



Board of Directors: Sergey Ivancheglo, Serguei Popov, Ralf Rottmann, 
Dominik Schiener, David Sønstebø


ID/Company No.: 3416/1234/2

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/99eeeb0f-785e-426c-b372-cfa4caad8be9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to