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

Build shared library #193

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bioinfornatics
Copy link

Dear,
current meson build have to be updated in order to generate .so file

@rikkimax
Copy link

rikkimax commented Nov 6, 2022

Is it beneficial to building a template heavy library like this as a shared library?

Pretty much every symbol that is going to be used is going in the dependent binary rather than the shared library.

@bioinfornatics
Copy link
Author

bioinfornatics commented Nov 6, 2022

I am trying to package all dependencies required for DCD for fedora.
And the guideline (here) tell

Packaging Static Libraries

    In general, packagers SHOULD NOT ship static libraries.

I can make both a static one and a shared one, that would help the package review

@rikkimax
Copy link

rikkimax commented Nov 6, 2022

I'm only seeing one function in the library that would be distributed in a static library:

https://github.com/dlang-community/containers/blob/master/src/containers/internal/hash.d#L45

It could be templated and then this should be fully a source library, no need to distribute it as a shared library.

@bioinfornatics
Copy link
Author

ok thanks I will try to provides the package with only a static library.

@rikkimax
Copy link

rikkimax commented Nov 6, 2022

You misunderstand me, you don't need to distribute a built version (assuming everything gets templated that isn't already) at all.

@bioinfornatics
Copy link
Author

bioinfornatics commented Nov 6, 2022

Maybe I misunderstand, so I will try to develop the consequence as I understand:
if we do not provide a built version:

  • in this case, any software that need it have to include it in their build.
  • this do not follow the linux philosophy
  • the chance to get the package rejected is very hight
    if we apply this on DCD we would add the containers source code into the DCD source code. And at the end they are one executable binary, instead of one executable and one static library.

thanks for your insight

@rikkimax
Copy link

rikkimax commented Nov 6, 2022

Almost all of the code in this library is templated.

When you build this library as a static library, there will be almost nothing in that binary, because no templates were initialized to go into it.

When you use it, you initialize templates and therefore they go into your binary.

Templates get compiled and initialized every time you use them. There is simply nothing to distribute if every declaration is templated.

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

Successfully merging this pull request may close these issues.

2 participants