Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile examples out of bazel #46

Closed
andrea-cassioli-maersk opened this issue Jun 8, 2023 · 5 comments
Closed

How to compile examples out of bazel #46

andrea-cassioli-maersk opened this issue Jun 8, 2023 · 5 comments

Comments

@andrea-cassioli-maersk
Copy link

I am working on integrating yggdrasil-decision-forests in a C++ application, which is compiled via CMake.

As a first steps, I am trying to compile the full example pointed in https://ydf.readthedocs.io/en/latest/cpp_serving.html, getting the following error:

➜  yggdrasil-decision-forests git:(main) ✗ g++ examples/beginner.cc --std=c++17 -I./  
In file included from examples/beginner.cc:46:
./yggdrasil_decision_forests/dataset/data_spec.h:32:10: fatal error: 'yggdrasil_decision_forests/dataset/data_spec.pb.h' file not found
#include "yggdrasil_decision_forests/dataset/data_spec.pb.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

how to deal with the pb.h?

@rstz
Copy link
Collaborator

rstz commented Jun 8, 2023

The pb.h files are Protobuf headers. Protobufs are used internally by YDF for message passing and model storage. The pb.h files are compiled from the .proto files with the protoc compiler.

With bazel, compilation of the protobufs is configured to be automatic. I haven't used CMake with Protobuf but it looks possible to integrate it with cmake (stackoverflow instructions) or to compile manually official tutorial.

Let me know if this helps

@andrea-cassioli-maersk
Copy link
Author

OK, I see. I am a bit familiar with compiling protobuf file, I'll give it a try manually for now

@rstz
Copy link
Collaborator

rstz commented Jun 13, 2023

Hi Andrea, did you have any success or additional issues with the compilation?

@andrea-cassioli-maersk
Copy link
Author

Hi @rstz , I did compile the protobuf but then I got some errors about missing inc files. I have put this on hold as it was a small side project.

Honestly I have been surprised how complicated is to compile the library, I will probably give it a try in the future though.

@rstz
Copy link
Collaborator

rstz commented Jun 16, 2023

Hi Andrea, that is unfortunate! Please feel free to ask additional questions if anything arises. We currently do not have the bandwidth to support CMake from our end, but I'd be very interested in getting it to work.

@rstz rstz closed this as completed Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants