-
Notifications
You must be signed in to change notification settings - Fork 12
ZoL master and FreeBSD 11.2 support #64
base: master
Are you sure you want to change the base?
Conversation
The LIBCLANG_PATH environment variable was unused, the 'boolean' enum is anonymous and typedef'd to 'boolean_t', the ZoL-specific 'thread_init' and 'thread_fini' have disappeared, gcc is now queried for system include paths, and the include paths of the libzfs pkg-config are now used. Signed-off-by: David Sheets <[email protected]>
ZoL `master` (2e5dc449c1a65e0b0bf730fd69c9b5804bd57ee8) and FreeBSD 11.2 have compatible libzfs APIs but FreeBSD lacks pkg-config and has different ZFS source include directories. Fixes whamcloud#63. Signed-off-by: David Sheets <[email protected]>
Signed-off-by: David Sheets <[email protected]>
It looks like Unfortunately, the latest release of ZoL and the release of ZFS in FreeBSD 11.2 are not compatible. I'm not sure how you'd like to proceed with ZoL version dependency. Due to this and the hard-coded ZoL source path, the CI will always fail on this patchset due to 'missing' headers. |
bindings.clang_arg(flag) | ||
}) | ||
// include directory for zfsonlinux/zfs master branch | ||
.clang_arg("-I/usr/src/zfs-0.7.0/include") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will get a bit farther if it is changed to:
.clang_arg("-I/usr/src/zfs-0.7.9/include")
What incompatibilities are you seeing? |
Yes, we should probably be a bit more generic about how we build now that we want to support multiple OS / releases |
Thanks for doing this @dsheets For reference, I've tested quickly on CentOS 7, using latest ZOL 0.7.9 RPM and got following issues when compiling:
With binding changes, boolean is now generated for me as:
Which seems as though there is no linkage between Previously, the generation was:
FWIW, ZOL boolean def is here: https://github.com/zfsonlinux/zfs/blob/2e5dc449c1a65e0b0bf730fd69c9b5804bd57ee8/tests/zfs-tests/tests/functional/checksum/edonr_test.c#L42
It seems like we will need to account for OS, binding differences. I guess this could be done either by shipping with a library of bindings and selecting the correct one at runtime, or by being more generic and accounting for more build paths when a user downloads the crate. |
If we go the second way pointed out by @jgrund:
Something that could be done here is generating separate bindings for each The obvious disadvantage here would be that the configuration flags exposed by |
I've updated the API to support
libzfs
as of openzfs/zfs@2e5dc44 (currentmaster
) which happens to coincide with thelibzfs
API as shipped in FreeBSD 11.2. I used Debian GNU/Linux 9 with kernel 4.9.88-1+deb9u1 and ZoLmaster
to test on Linux. I generalized the Linux support in the build system to use the include paths in thepkg-config
output and output from a small shell script which queriesgcc
to find the system include directories.I haven't put a regenerated
libzfs-sys/src/bindings.rs
in this PR as my generated bindings don't seem to pretty-print and I haven't investigated why not.A single code location (
libzfs-sys/build.rs:115
) presupposes the path to the ZFS source on Linux and assumes that you are running against themaster
of ZoL. Maybe this should be configurable via an environment variable or cargo parameter or similar.Speaking of environment variables, I could not figure out how
env::set_var("LIBCLANG_PATH", "/opt/llvm-5.0.0/lib64/");
affects anything after reading https://github.com/KyleMayes/clang-sys/blob/67f7d8c25eff694d7ba58ff42da6e5b502413b7d/README.md and related source which only usesLIBCLANG_PATH
atclang-sys
build time.The line
fn list_gcc_include_paths() -> impl Iterator<Item = PathBuf> {
uses a rust 1.26+ feature. I'm not sure what the previously preferred solution is to this usage if compatibility for rust < 1.26 is desired.Probably the most confusing issue I had was with
boolean
/boolean_t
. Use ofboolean
only seems to work if the declaration istypedef enum boolean { ... } boolean_t
but I could only findtypedef enum { ... } boolean_t
forms in the version history. Usingboolean_t
is only slightly longer and appears to work universally afterNEED_SOLARIS_BOOLEAN
is declared for FreeBSD.Closes #63.