Getting started guide has warning(s) and build errors

76 views
Skip to first unread message

Guillaume Seguin

unread,
Jan 4, 2023, 9:26:20 AM1/4/23
to fidl-dev
I am following the Fuchsia Getting Started guide section about FIDL


Long form:
After careful copy-paste of the code, building the Echo FIDL library outputs a warning:

```
$ bazel build --config=fuchsia_x64 //fuchsia-codelab/echo-fidl:examples.routing.echo.fidl_cc
DEBUG: /usr/local/google/home/seguing/.cache/bazel/_bazel_seguing/6ea1d59e26491a39332280bca04f50c5/external/rules_fuchsia/fuchsia/private/legacy_fuchsia_fidl_cc_library.bzl:215:10:

NOTICE: fuchsia_fidl_llcpp_library is deprecated and will be removed soon.
Use fuchsia_fidl_library with the appropriate cc_bindings attribute instead.
       
INFO: Build options --copt, --cpu, --crosstool_top, and 2 more have changed, discarding analysis cache.
INFO: Analyzed target //fuchsia-codelab/echo-fidl:examples.routing.echo.fidl_cc (0 packages loaded, 2276 targets configured).
INFO: Found 1 target...
Target //fuchsia-codelab/echo-fidl:examples.routing.echo.fidl_cc up-to-date:
  bazel-bin/fuchsia-codelab/echo-fidl/libexamples.routing.echo.fidl_cc.a
INFO: Elapsed time: 0.875s, Critical Path: 0.04s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
```


Moving on to the next step to integrate the components with the Echo protocol, the build gives the same warning (on multiple `BUILD.bazel` files this time), and ends in a build error.

```
$ bazel run //fuchsia-codelab/echo-realm:pkg.publish -- --repo_name fuchsiasamples.com
INFO: Build options --copt, --cpu, --crosstool_top, and 2 more have changed, discarding analysis cache.
DEBUG: /usr/local/google/home/seguing/.cache/bazel/_bazel_seguing/6ea1d59e26491a39332280bca04f50c5/external/rules_fuchsia/fuchsia/private/legacy_fuchsia_fidl_cc_library.bzl:215:10:

NOTICE: fuchsia_fidl_llcpp_library is deprecated and will be removed soon.
Use fuchsia_fidl_library with the appropriate cc_bindings attribute instead.
       
DEBUG: /usr/local/google/home/seguing/.cache/bazel/_bazel_seguing/6ea1d59e26491a39332280bca04f50c5/external/rules_fuchsia/fuchsia/private/legacy_fuchsia_fidl_cc_library.bzl:190:10:

NOTICE: fuchsia_fidl_hlcpp_library is deprecated and will be removed soon.
Use fuchsia_fidl_library with the cc_bindings attribute instead.
       
DEBUG: /usr/local/google/home/seguing/.cache/bazel/_bazel_seguing/6ea1d59e26491a39332280bca04f50c5/external/rules_fuchsia/fuchsia/private/legacy_fuchsia_fidl_cc_library.bzl:215:10:

NOTICE: fuchsia_fidl_llcpp_library is deprecated and will be removed soon.
Use fuchsia_fidl_library with the appropriate cc_bindings attribute instead.
       
INFO: Analyzed target //fuchsia-codelab/echo-realm:pkg.publish (0 packages loaded, 2919 targets configured).
INFO: Found 1 target...
ERROR: /usr/local/google/home/seguing/src/downloaded/fuchsia.dev/fuchsia-getting-started/fuchsia-codelab/echo-server/BUILD.bazel:8:18: Compiling fuchsia-codelab/echo-server/main.cc failed: (Exit 1): clang failed: error executing command external/fuchsia_clang/bin/clang '--target=x86_64-fuchsia' -Wall -Werror -Wextra-semi -Wnewline-eof -fdiagnostics-color '-ffuchsia-api-level=10' '-std=c++17' -xc++ -fPIC -MD -MF ... (remaining 65 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
fuchsia-codelab/echo-server/main.cc:44:32: error: no matching member function for call to 'AddProtocol'
  zx::result result = outgoing.AddProtocol<examples_routing_echo::Echo>(std::move(echo_instance));
                      ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bazel-out/x86_64-fastbuild-ST-1ad63a09c27b/bin/external/fuchsia_sdk/pkg/sys_component_cpp/_virtual_includes/sys_component_cpp/lib/sys/component/cpp/outgoing_directory.h:139:16: note: candidate function template not viable: no known conversion from '__libcpp_remove_reference_t<unique_ptr<EchoImplementation, default_delete<EchoImplementation>> &>' (aka 'std::unique_ptr<EchoImplementation>') to 'fidl::WireServer<examples_routing_echo::Echo> *' for 1st argument
  zx::result<> AddProtocol(fidl::WireServer<Protocol>* impl,
               ^
bazel-out/x86_64-fastbuild-ST-1ad63a09c27b/bin/external/fuchsia_sdk/pkg/sys_component_cpp/_virtual_includes/sys_component_cpp/lib/sys/component/cpp/outgoing_directory.h:149:16: note: candidate function template not viable: no known conversion from '__libcpp_remove_reference_t<unique_ptr<EchoImplementation, default_delete<EchoImplementation>> &>' (aka 'std::unique_ptr<EchoImplementation>') to 'fidl::Server<examples_routing_echo::Echo> *' for 1st argument
  zx::result<> AddProtocol(fidl::Server<Protocol>* impl,
               ^
bazel-out/x86_64-fastbuild-ST-1ad63a09c27b/bin/external/fuchsia_sdk/pkg/sys_component_cpp/_virtual_includes/sys_component_cpp/lib/sys/component/cpp/outgoing_directory.h:189:16: note: candidate function template not viable: no known conversion from '__libcpp_remove_reference_t<unique_ptr<EchoImplementation, default_delete<EchoImplementation>> &>' (aka 'std::unique_ptr<EchoImplementation>') to 'TypedHandler<examples_routing_echo::Echo>' (aka 'function_impl<internal::RoundUpToWord(16UL), false, void (fidl::ServerEnd<examples_routing_echo::Echo>)>') for 1st argument
  zx::result<> AddProtocol(TypedHandler<Protocol> handler,
               ^
1 error generated.
Target //fuchsia-codelab/echo-realm:pkg.publish failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 32.674s, Critical Path: 28.20s
INFO: 71 processes: 7 internal, 64 linux-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
```

I tried fixing the warning (in the hope of fixing the build error) but searching for `cc_bindings` did not return any results, even in a public Google search.

What would be the best route/documentation to help me fix this n00b problem? 


+FYI
```
$ git rev-parse HEAD
f10f282771187d592dc7da5d0bc689f1b35e680c
$ git submodule foreach git rev-parse HEAD
Entering 'third_party/fuchsia-infra-bazel-rules'
b5fa5a0d4453d7c0b76c4d2c26cb03a8c3c54081
Entering 'third_party/googletest'
0b56cbec076adbb75d22e3d9f75e99ad063d1ac3
Entering 'third_party/sdk-integration'
a43e2e0504a5c57446c5d86d7668ffb0682f1edf
```

Dave Smith

unread,
Jan 4, 2023, 12:13:09 PM1/4/23
to Guillaume Seguin, fidl-dev, Wayne Piekarski
Thanks for trying all of this out, and for reporting this!

Deprecation warnings: This is being worked on as part of https://fxbug.dev/116894. These can be safely ignored for now and should disappear when we update the samples for the next SDK release.

Build failure: I have filed https://fxbug.dev/118702 to look into this. This is likely due to a recent API change where the outgoing directory library was moved from lib/sys to lib/component/outgoing.
Dave Smith | Developer Relations | smit...@google.com | @devunwired


--
All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
---
You received this message because you are subscribed to the Google Groups "fidl-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fidl-dev+u...@fuchsia.dev.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/fidl-dev/feed64e7-3913-4daa-a717-856d3c1c2e84n%40fuchsia.dev.

Guillaume Seguin

unread,
Jan 9, 2023, 1:59:41 PM1/9/23
to fidl-dev, fidl-dev
Thanks, change fxr/785831 did fix the problem!
Reply all
Reply to author
Forward
0 new messages