Pijul

Build failure on macos (zstd-seekable, _IO_FILE)

Hi,

I’ve been trying to give anu a test run, but am running into some issues building it so far. I hope it’s fine to post this here; I was going to start a “discussion” in https://nest.anu.dev/anu/zstd-seekable/, but failed.

I’m building on macos, with dependencies installed via nix. I’ve made it to a point where I get the following error:

error[E0412]: cannot find type `_IO_FILE` in this scope
   --> /Users/rob/.cargo/registry/src/github.com-1ecc6299db9ec823/zstd-seekable-0.1.0/src/lib.rs:383:62
    |
383 |             let result = ZSTD_seekable_initFile(p, f as *mut _IO_FILE);
    |                                                              ^^^^^^^^ not found in this scope

I got here by running:

$ nix-shell -p openssl libsodium llvmPackages.libclang xxHash zlib zstd libgit2 pkgconfig
[nix-shell] $ cargo install anu --version 1.0.0-alpha

Happy to try any workarounds (but I’m currently at a stage where I don’t have the anu source code in front of me to be able to tweak things easily).

I got it working by downloading the source code from https://static.crates.io/crates/anu/anu-1.0.0-alpha.crate, then running cargo vendor, and editing the relevant line in zstd-seekable. I think there was also a checksum that needed to be deleted.

1 Like

Thank you! Got a working anu binary now.

The diff (besides editing the vendored checksum file):

--- zstd-seekable/src/lib.rs.orig	2020-11-07 23:18:45.000000000 +0100
+++ zstd-seekable/src/lib.rs	2020-11-07 23:18:14.000000000 +0100
@@ -380,7 +380,7 @@
             if p.is_null() {
                 return Err(Error::Null);
             }
-            let result = ZSTD_seekable_initFile(p, f as *mut _IO_FILE);
+            let result = ZSTD_seekable_initFile(p, f as *mut FILE);
             if ZSTD_isError(result) != 0 {
                 return Err(Error::ZSTD(result));
             }

My understanding is that _IO_FILE is an internal generated struct name due to bindgen, while FILE is the stable type alias, so the diff might be safe to apply (but unsure).

I had to extend my nix-shell a bit, too, here’s what worked:

$ nix-shell -p openssl libsodium llvmPackages.libclang xxHash zlib zstd libgit2 pkgconfig darwin.apple_sdk.frameworks.CoreServices darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SystemConfiguration

Just to note that after the rename back to pijul, cargo install pijul --version 1.0.0-alpha works without any changes with the nix-shell line above.

2 Likes

I just installed missed xxhash and issue solved for me.

1 Like

I ran into this issue again, filed on the nest now at https://nest.pijul.com/pijul/zstd-seekable/discussions/2.

1 Like