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

Use DP library in make project #121

Closed
ReichertL opened this issue Jun 26, 2022 · 4 comments
Closed

Use DP library in make project #121

ReichertL opened this issue Jun 26, 2022 · 4 comments

Comments

@ReichertL
Copy link

ReichertL commented Jun 26, 2022

Hello,
I am sorry for bothering you with this question but I have been struggling for the past days and have not found a solution yet.

I want to use this differential privacy C library in a larger project which relies on make.

The first idea was to create a .so or .a file which are mostly self containing. But apparently this is not possible as all the important code is contained inside .h files. Those do not produce .o files, so from my understanding no .so or .a files can be produced.
Simply copying all files from the library to the new make projects and including them does not work due to the dependencies, e.g. abseil and protobuf.

Does anyone have a suggestion on how this could (or should) be done? I do not want to switch my whole project to Bazel just because a single dependency relies on it.

Edit: Turns out it can be included with sources just like any other C++ third party library. I really got myself confused with trying to create an .so file, which is not possible.

@ReichertL ReichertL reopened this Jun 27, 2022
@ReichertL
Copy link
Author

ReichertL commented Jun 27, 2022

I managed to figure out how normal third party libraries should work when using them with make. But it seems like the differential privacy library uses protobuf auto generated header files ( .pb.h files ). I can't find them in the bazel folders.
Also I started wondering if there isn't an easier way.

@dibakch
Copy link
Collaborator

dibakch commented Jun 28, 2022

I believe you can use the linked files and the header files to use them in a Makefile. You might also be able to automate this step and only require Bazel (or Bazelisk) for building the DP Lib.

You can find the *.pb.h files in the cc/bazel-bin/external/com_google_differential_privacy/proto folder. (They are external to the ./cc/ workspace as they are defined in the root workspace so that they are accessible also for other implementations in other languages). You need to run cd cc; bazliesk build ... to generate the files.

Hope this helps :)

@ReichertL
Copy link
Author

Thanks for the help.
I found the *.pb.h files. But it seems like my approach will be very unstable and only work for a single specific combination of library versions. I therefore decided to instead use bazel in parts of my main project, while still relying on the original make file when possible.

As far as I understand it now the differential privacy library is more targeted for Googles internal use. Therefore it is basically assumed that bazel is used during all steps. However, this makes it very difficult for others to integrate the library into existing projects which are not bazel based.

@dibakch
Copy link
Collaborator

dibakch commented Jul 1, 2022

I guess #62 would help here. I'll close this issue. Feel free to re-open or comment in #62.

@dibakch dibakch closed this as completed Jul 1, 2022
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