summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-25 20:00:09 +0000
committerGitHub <noreply@github.com>2021-04-25 20:00:09 +0000
commitc6fa15c94f4de559c6e2303e0bd56b293036fd7c (patch)
tree6f90395a5a3511501fe80cd9dcf696815265fb00
parent3efee816b6dbab03f19f2c25d798db65cba7aa4f (diff)
parentf185d714d36eb9c0618ec0c3818d9e23d5a11d38 (diff)
downloadrust-libzfs-c6fa15c94f4de559c6e2303e0bd56b293036fd7c.zip
Merge #59
59: Conditionally link libspl and zutil on FreeBSD r=jmesmon a=andoriyu FreeBSD's version of `libnvpair` uses functions (for example `libspl_assertf`) from `libspl`. Right now build is broken on FreeBSD due to this. `libzfs_core` depends `libzutil` that holds a shim for `zfs_ioctl_fd` function. Error in question: ``` Compiling nvpair-sys v0.4.0 (/usr/home/andoriyu/rust-libzfs/nvpair-sys) error: linking with `cc` failed: exit code: 1 | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.1fspym4vx839le7u.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.1kpmeduvbomt860u.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.2dc0lftqfmb92asf.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.2j13m67krmezibkk.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.2lxj8z2t6i242zfb.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.4gx1tne5eh8pz0ms.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.4mvchp1wcaaer2tt.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.595xf4hg1eph114a.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.59j3v6hdsmtrjjn3.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.5c2m9lqpx77e4ia8.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.5fiwe119pvarbdjz.rcgu.o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.l6q8u4qlad0ktl.rcgu.o" "-o" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379" "/usr/home/andoriyu/rust-libzfs/target/debug/deps/nvpair_sys-ad5d16b4ad387379.1hdsdnooxdjenarh.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/usr/home/andoriyu/rust-libzfs/target/debug/deps" "-L" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib" "-lnvpair" "-lzfs" "-Wl,-Bstatic" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libtest-e4d8e27bba2fafe9.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libterm-fca7fddc86ed2a6e.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libgetopts-87ba50558c91e972.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libunicode_width-38a5366dda98a80a.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_std-b9e12c95cb61720b.rlib" "-Wl,--start-group" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-3d778e71a3d2144e.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libpanic_unwind-01501494a9a2272f.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libminiz_oxide-f780d681cfa742d5.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libadler-c3fd082d3858d393.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libobject-09482ed94636277a.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libaddr2line-fbfea5310935424c.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libgimli-f5392f9b4b2d37a0.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_demangle-8a4a12e283f6bf35.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libhashbrown-9da1e161ce2fe917.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_alloc-25f1642cbffacef7.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libunwind-78301c711dd787ac.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libcfg_if-e0b4ed13ac3323ca.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/liblibc-b40818509f09fb0f.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/liballoc-dcd1311f0a05c03f.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_core-766670794099a124.rlib" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libcore-5f7d9add231d0df8.rlib" "-Wl,--end-group" "/usr/home/andoriyu/.rustup/toolchains/stable-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/libcompiler_builtins-84b862f5ffd396b9.rlib" "-Wl,-Bdynamic" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-lutil" = note: ld: error: /usr/lib/libnvpair.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined] cc: error: linker command failed with exit code 1 (use -v to see invocation) ``` Co-authored-by: Andrey Cherkashin <148123+andoriyu@users.noreply.github.com>
-rw-r--r--nvpair-sys/build.rs4
-rw-r--r--zfs-core-sys/build.rs3
2 files changed, 7 insertions, 0 deletions
diff --git a/nvpair-sys/build.rs b/nvpair-sys/build.rs
index ecb0ccc..885fe37 100644
--- a/nvpair-sys/build.rs
+++ b/nvpair-sys/build.rs
@@ -3,4 +3,8 @@ fn main() {
// FIXME: a bug exists in some versions of libnvpair causing it to depend on a symbol called
// `aok`, which is in `libzfs`.
println!("cargo:rustc-link-lib=zfs");
+ // nvpair uses functions from libspl on FreeBSD
+ if cfg!(target_os = "freebsd") {
+ println!("cargo:rustc-link-lib=spl");
+ };
}
diff --git a/zfs-core-sys/build.rs b/zfs-core-sys/build.rs
index da353d9..4c08011 100644
--- a/zfs-core-sys/build.rs
+++ b/zfs-core-sys/build.rs
@@ -8,4 +8,7 @@ fn main() {
}
println!("cargo:rustc-link-lib=nvpair");
+ if cfg!(target_os = "freebsd") {
+ println!("cargo:rustc-link-lib=zutil");
+ };
}