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

[request] grpc: Add shared option to recipe #6382

Closed
FMeinicke opened this issue Jul 17, 2021 · 9 comments · Fixed by #9044
Closed

[request] grpc: Add shared option to recipe #6382

FMeinicke opened this issue Jul 17, 2021 · 9 comments · Fixed by #9044
Labels
question Further information is requested

Comments

@FMeinicke
Copy link
Contributor

Hi,
I would like to use conan to manage all dependencies of my project. Since it's customary at my work to use shared libraries rather than linking everything statically I'd like to have all dependencies as well as the library that my project generates as shared libraries. The problem is that the grpc recipe does not provide the shared option to do so.

I managed to build grpc and all of its dependencies from source as shared libraries and I've been using these without any problems for over a year now.
I also played around with the CCI recipe for grpc and simply added the shared option and tried to build a conan package from that recipe. Except for abseil every other dependency of grpc supports building with the shared option out of the box. Hence, to allow building grpc with the shared option the abseil recipe has to be changed as well (it also needs the shared option).

I would be happy to provide a PR to add this behaviour to grpc (and abseil for that matter). My question is if this should be one PR that modifies both recipes or would you rather have two PRs, one for each recipe (where the PR for abseil would have to be merged first since grpc depends on that change)?

@FMeinicke FMeinicke added the question Further information is requested label Jul 17, 2021
@SpaceIm
Copy link
Contributor

SpaceIm commented Jul 17, 2021

Why abseil would need to be shared if you want grpc shared?
Abseil build system files don't support shared. I guess it could easily work (except for Visual Studio), but it requires to patch their build system forever.

It's worth noting that all pre built packages of shared libraries in CCI are linked to static versions of their dependencies.

@FMeinicke
Copy link
Contributor Author

Why abseil would need to be shared if you want grpc shared?

Because I've had bad experiences with mixing static and shared libraries.

Abseil build system files don't support shared.

As I said I managed to build grpc (and all of its third-party dependencies) from source as shared libraries. I.e. abseil can be built as shared libraries (and briefly looking at their CMake files confirms that they actually do support building shared):

https://github.com/abseil/abseil-cpp/blob/33541e751039a8c4bd3a395dd1a3a0928885814a/CMake/AbseilHelpers.cmake#L137-L141

@SpaceIm
Copy link
Contributor

SpaceIm commented Jul 17, 2021

Indeed, you're right for abseil shared, I missed that. I don't know why it was not added in initial PR adding abseil in CCI.

@SpaceIm
Copy link
Contributor

SpaceIm commented Jul 17, 2021

I've opened #6383 for abseil.

@FMeinicke
Copy link
Contributor Author

Cool, thanks!

@SpaceIm
Copy link
Contributor

SpaceIm commented Jul 17, 2021

Actually, shared was not supported in the "first version" (unofficial) added in conan-center-index. shared on Windows is slightly more complex. It produces only one dll, without a dedicated import library.

@FMeinicke
Copy link
Contributor Author

@SpaceIm, did you have any luck with the abseil recipe? I noticed that the builds in #6383 failed.

@SpaceIm
Copy link
Contributor

SpaceIm commented Jan 23, 2022

It fails for some versions yes, and didn't have the time to fix it.

for shared grpc, you can try #9044

@FMeinicke
Copy link
Contributor Author

Awesome, I'll give #9044 a try. Thanks for all your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
2 participants