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

older versions of libsystemd lack all functions use for our bus module #132

Open
codyps opened this issue Sep 9, 2020 · 3 comments
Open

Comments

@codyps
Copy link
Owner

codyps commented Sep 9, 2020

In particular, ubuntu-18.04's libsystemd lacks 2 functions which result in link errors (when the bus feature is not disabled):

/home/runner/work/rust-systemd/rust-systemd/src/bus/mod.rs:1269: undefined reference to `sd_bus_slot_set_destroy_callback'
/home/runner/work/rust-systemd/rust-systemd/src/bus/mod.rs:1270: undefined reference to `sd_bus_slot_set_floating'

We should consider looking into whether these can be avoided an provide a usable API in systemd (high level crate). Possible that bus (the feature) could be subsetted (so some of bus is usable with old libsystemd. Minimally, detecting the presence of these functions at configuration time and avoiding emitting the rust definitions would help us get better error
messages (ie: at compile instead of at link).

openssl has to deal with similar issues and probably has some approach we can adapt.

@siegfriedweber
Copy link
Contributor

We have a similar problem with sd_journal_open_namespace which was added in systemd v245 (see the systemd changelog). I solved it by creating a feature flag systemd_v245 (see https://github.com/siegfriedweber/rust-systemd/commit/29efbfe356e31a24ed67eb8ae1abd28dd0b8904f).

In my opinion, a feature flag is not necessary for systemd versions which are already in the stable branches of the major Linux distributions. On Debian stable it is currently version 241 (https://packages.debian.org/buster/libsystemd-dev). But there should be flags for newer versions.

I am not familiar with the systemd API, so I cannot provide a pull request for all API changes. But I could create a pull request with the systemd_v245 flag if desired. Alternatively you can just cherry-pick the mentioned commit if you like the approach.

@codyps
Copy link
Owner Author

codyps commented May 16, 2021

I think starting with a systemd_v245 feature flag makes sense here. We need some solution for this, and that seems like a minimal one.

I'm fine with the feature not being 100% accurate (missing some API items) initially, it'll be better than the current situation.

@lucab
Copy link
Contributor

lucab commented Jun 2, 2021

Similar situation here, hitting a linking issue due to missing sd_journal_open_namespace on RHEL 8, where systemd is at v239.

bors bot added a commit that referenced this issue Jun 3, 2021
200: Add feature flag for systemd version 245 r=jmesmon a=siegfriedweber

The method `sd_journal_open_namespace` was added in systemd v245 (see the [systemd changelog](https://github.com/systemd/systemd/blob/v245/NEWS#L79-L86)). This version is not yet available in the stable branches of some major Linux distributions, for instance in Debian 10 which contains version 241 (https://packages.debian.org/buster/libsystemd-dev).

This pull request adds the feature flag `systemd_v245`. `sd_journal_open_namespace` is only available if this feature flag is set.

This is the first step to fix issue #132.

Co-authored-by: Siegfried Weber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants