-
Notifications
You must be signed in to change notification settings - Fork 664
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
static build: libnvme-mi depends on a shared libsystemd #1734
Comments
A couple of options:
Either way works for me. Is there a particular use-case for the static builds that might guide this choice? |
We could always use the
|
I also thought that the dependency to libsystemd is optional but my attempt to build nvme-cli statically went horrible wrong. That means something is still not working as expected. I'd say we don't need to switch a to different D-Bus binding if it's optional. If someone really wants this feature I accept contributions. (I know libdbus very well and it's not so bad as it sounds, it's just a lot of boiler plate code we have to add to make it work) |
ok, sounds like I need to do some testing here then, and ensure that we're disabling the correct parts without libsystemd. Will keep you posted. |
This might be related how I was passing the |
FWIW, here is my current draft version of my attempt: https://github.com/igaw/nvme-cli/tree/build-add-more-CI |
So it looks like having a dynamic
(this isn't specific to systemd; the same applies for libc symbols, for example). This isn't necessarily an invalid configuration, as those symbols may be later resolvable - either as a later link stage, or at runtime. For an eventual static binary though, we probably want all of those to be resolved, and cannot do at a later link stage, because there is no static libsystemd. So, we probably want some way to explicitly disable the libsystemd dependency, and require that for a static nvme-cli. Manually disabling a dependency seems to be discouraged (see mesonbuild/meson#8224), so instead we may need a feature option. Perhaps a new option for libnvme:
- which we would apply to static builds of nvme-cli? |
... which is still a little ugly, as it somewhat complicates the user-interface to the libnvme build system. Also So maybe the best approach would be to switch to libdbus after all? |
(are you linking libc statically too?) |
What about making the discovery feature which depends on systemd optional? This would be way cleaner in my opinion. |
yep, it already is - but we would need an explicit option to disable it even if libsystemd is found (because the libsystemd that does get found is unsuitable to link against). I've already done a patch to convert to |
My idea was to use the option to make the dependency explicit. So if the user wants to use it we look for libsystemd and fail if we can't link. The static build for nvme-cli would just disable it and we would be fine. But if you got libdbus working, than this is also cool :) |
Not sure what you mean there - the dependency is already explicit in the |
Have just uploaded the WIP |
W00t! This looks great and pretty straightforward. I'v just checked if libdbus is simple to build as a static build. And it turns out the project is using Meson and it was dead simple to get a static library build. This means we should be able to add this to Meson's Wrap DB and can pull it via subprojects. Yay! |
libsystemd is not generally available as a static library, and we would like to produce a static nvme-cli. This change switches to libdbus instead. This requires slightly more boilerplate code for the dbus marshalling/unmarshalling as part of the MCTP endpoint scan, but means we have a simpler upstream lib dependency. Fixes: linux-nvme/nvme-cli#1734 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Let's keep this issue open until we have figured out how to pull in libdbus via subprojects. |
On the second thought. No let's create a new issue for this :) |
libsystemd seems to be only available as shared library. At least on Debian.
Building against a current version of libnvme with following configuration:
CFLAGS=-static meson setup .build --wrap-mode forcefallback --default-library=static
results in:
That begs the question if we should stop trying to get a static build setup running or not.
@jk-ozlabs libsystemd is sucked in via the libnvme-mi library. As I understand we just need the D-Bus API. So I wonder how realistically you see it that we replace it with something else? If that even exists?
The text was updated successfully, but these errors were encountered: