Hi Anoop,
Enclaves have always had to be built in the Asylo toolchain, so I think what you’re facing is some incompatibility with the new transitions-based build rules.
When I changed how we structured build rules with Bazel configuration transitions, I had to mimic native.cc_binary in the build language Starlark. You can see in asylo.bzl that the transitions.cc_binary use in enclave_loader uses __ensure_static_manual to add the static linking requirement. I tried to not require static linking in order for this build rule to work, but unfortunately Starlark-based C build rules are still not 100% compatible with native C build rules and I couldn’t make this work.
A way you can work around this is to write your own targets that separate out the untrusted component and the trusted component and make them backend-specific. When you look at the definition of enclave_loader for example, you’ll see some all_backends invocation that you can just replace with a single backend. You can load some of the internally-used rules like enclave_runner_script from asylo_transitions.bzl. Your host loader target can be defined with the builtin cc_binary to avoid static linking, but you’ll need to build with a top-level backend configuration flag, like –@com_google_asylo//asylo/distrib/backend:backend=@linux_sgx//:asylo_sgx_hw
The “old way” for adding new backends was not extensible—it depended on some closed world assumptions that would not allow projects outside the Asylo namespace to define backends. If you want to define your own backend, that is a topic for a longer thread or article.
Regards,
-Dionna (Asylo Team)