andrewshadura / bsd-pidfile-rs Goto Github PK
View Code? Open in Web Editor NEWRust wrapper for pidfile_* functions from libbsd/libutil
License: MIT License
Rust wrapper for pidfile_* functions from libbsd/libutil
License: MIT License
pidfile-rs is working great for me on x64 but now trying to cross-compile it to armhf I get the following error:
= note: /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/d1plo1d/git_repos/teg/target/armv7-unknown-linux-gnueabihf/debug/deps/libpidfile_rs-aa73a5ed2abdce1e.rlib(pidfile_rs-aa73a5ed2abdce1e.pidfile_rs.c101mk4m-cgu.0.rcgu.o): in function `pidfile_rs::Pidfile::new':
/home/d1plo1d/.cargo/registry/src/github.com-1ecc6299db9ec823/pidfile-rs-0.1.0/src/lib.rs:124: undefined reference to `pidfile_open'
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/d1plo1d/git_repos/teg/target/armv7-unknown-linux-gnueabihf/debug/deps/libpidfile_rs-aa73a5ed2abdce1e.rlib(pidfile_rs-aa73a5ed2abdce1e.pidfile_rs.c101mk4m-cgu.0.rcgu.o): in function `pidfile_rs::Pidfile::write':
/home/d1plo1d/.cargo/registry/src/github.com-1ecc6299db9ec823/pidfile-rs-0.1.0/src/lib.rs:156: undefined reference to `pidfile_write'
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/d1plo1d/git_repos/teg/target/armv7-unknown-linux-gnueabihf/debug/deps/libpidfile_rs-aa73a5ed2abdce1e.rlib(pidfile_rs-aa73a5ed2abdce1e.pidfile_rs.c101mk4m-cgu.0.rcgu.o): in function `<pidfile_rs::Pidfile as core::ops::drop::Drop>::drop':
/home/d1plo1d/.cargo/registry/src/github.com-1ecc6299db9ec823/pidfile-rs-0.1.0/src/lib.rs:183: undefined reference to `pidfile_remove'
collect2: error: ld returned 1 exit status
I've installed the armhf version of libbsd-dev via sudo apt-get install libbsd-dev:armhf
. Is there any thing else I should need to do to get pidfile-rs to find pidfile_remove
?
I'm experiencing the following problem when building inputplug, which depends on pidfile-rs:
Running `CARGO=/usr/local/bin/cargo CARGO_CRATE_NAME=pidfile_rs CARGO_MANIFEST_DIR=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/inputplug-0.4.0/cargo-crates/pidfile-rs-0.1.0 CARGO_PKG_AUTHORS='Andrej Shadura <[email protected]>' CARGO_PKG_DESCRIPTION='Rust wrapper for pidfile_* functions from libbsd/libutil' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=pidfile-rs CARGO_PKG_REPOSITORY='https://github.com/andrewshadura/bsd-pidfile-rs' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/release/deps:/usr/local/lib' OUT_DIR=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/build/pidfile-rs-4a0c082080fb3980/out /usr/local/bin/rustc --crate-name pidfile_rs --edition=2018 /usr/home/0mp/f/freebsd-ports/x11/inputplug/work/inputplug-0.4.0/cargo-crates/pidfile-rs-0.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C embed-bitcode=no -C metadata=f8dda4b370c013ce -C extra-filename=-f8dda4b370c013ce --out-dir /usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/deps --target x86_64-unknown-freebsd -C linker=cc -L dependency=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/deps -L dependency=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/release/deps --extern libc=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/deps/liblibc-ffc6aeb0c2ffa66a.rmeta --extern log=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/deps/liblog-7bfef7ff243dec93.rmeta --extern thiserror=/usr/home/0mp/f/freebsd-ports/x11/inputplug/work/target/x86_64-unknown-freebsd/release/deps/libthiserror-9e73a75cc7ea590e.rmeta --cap-lints warn -C link-arg=-fstack-protector-strong`
error[E0308]: mismatched types
--> /usr/home/0mp/f/freebsd-ports/x11/inputplug/work/inputplug-0.4.0/cargo-crates/pidfile-rs-0.1.0/src/lib.rs:124:55
|
124 | bsd_pidfile_open(c_path.as_ptr(), permissions.mode(), &mut old_pid)
| ^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
|
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
|
124 | bsd_pidfile_open(c_path.as_ptr(), permissions.mode().try_into().unwrap(), &mut old_pid)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: could not compile `pidfile-rs`
Could it be that pidfile-rs is using a wrong type here?
Please let me know if I can provide any debugging information.
I'm running this on FreeBSD 14.0-CURRENT on adm64 hardware. Rust version: rustc 1.55.0-nightly (32c9b7b09 2021-07-21).
This project could benefit from some CI testing. For testing on both FreeBSD and Linux, the easiest platform to use is Cirrus. If you agree, then follow the instructions at https://cirrus-ci.org/guide/quick-start/ but stop when you get to "Post-Installation" and I'll submit a config file.
On Ubuntu 20.04 installing sudo apt install libutil-freebsd-dev
after trying to run cargo build
resulted in a long error containing the following:
ld.lld: error: undefined symbol: pidfile_open
My guess is that the cargo build process was not failing early enough so it thought that pidfile-rs
was successfully installed despite the missing header files (libutil was not installed on the first cargo build
).
It would be helpful if this could fail earlier in the build process so that cargo doesn't assume a successful build of pidfile-rs
when libutil
is missing.
If anyone else encounters this issue the solution is to install libutil-freebsd-dev and then run cargo clean -p pidfile-rs
. After that your builds should succeed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.