chipsenkbeil / service-manager-rs

Provides adapters to communicate with various operating system service managers like launchd and systemd
Apache License 2.0
188 stars 15 forks source link

Compile error in Android Termux. #4

Closed mokeyish closed 1 year ago

mokeyish commented 1 year ago

https://github.com/chipsenkbeil/service-manager-rs/blob/59736e1b0b8c7c2af05441145575e5c459eb4542/src/kind.rs#L26

error[E0599]: no variant or associated item named native found for enum kind::ServiceManagerKind in the current scope
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/service-manager-0.2.0/src/typed.rs:89:45
   |
89 |         Ok(Self::target(ServiceManagerKind::native()?))
   |                                             ^^^^^^ variant or associated item not found in kind::ServiceManagerKind
chipsenkbeil commented 1 year ago

What service manager would Android Termux use? I'm not familiar with that platform, and it isn't supported via this crate at the moment. These operating systems are currently supported:

I can add a default, native implementation for Android, but I wouldn't know what it would use.

mokeyish commented 1 year ago

I'm planning to use service-manager to manager service for my software https://github.com/mokeyish/smartdns-rs. It planned to support Android Termux.

Fix it first to avoid compilation errors?

chipsenkbeil commented 1 year ago

@mokeyish so what service manager does Android Termux use? Systemd?

chipsenkbeil commented 1 year ago

It looks like Android Termux uses runit as the service manager, which isn't currently supported by this library. See #1 for the request to add support for sv, which Android Termux also uses as described here and in this blog post.

mokeyish commented 1 year ago

Yes, it use runit. I used sv a long time ago, but currently, I forgot how to use it .

mokeyish commented 1 year ago

@chipsenkbeil BTW, Can qualifier and organization be optional? I want to use smartdns-rs as service label directly.

https://github.com/chipsenkbeil/service-manager-rs/blob/f738b98e5e44034c897f0a277a0cabff8ff8b6f8/src/lib.rs#L95-L103

chipsenkbeil commented 1 year ago

@chipsenkbeil BTW, Can qualifier and organization be optional? I want to use smartdns-rs as service label directly.

https://github.com/chipsenkbeil/service-manager-rs/blob/f738b98e5e44034c897f0a277a0cabff8ff8b6f8/src/lib.rs#L95-L103

Depending on the service manager, they may or may not be optional. Which service manager are you using? You can always put in an empty string or placeholder for them, but they may behave a little strangely.

chipsenkbeil commented 1 year ago

No longer fails to compile thanks to #9.