Bindings to the seekable variant of the ZSTD compression format

#2 build failure on macos related to _IO_FILE

Closed on November 13, 2020
robx on November 12, 2020

I’m unsure quite what to make of this, as the issue doesn’t always arise, but today I saw a build error again that I ran into previously, building from a fresh pijul (includes change GKH7R6U6VUQGXZKJLPTF5AZP6TSWJLPENP2DHBUABAFCYVMGSXOAC, I’m still unsure how to identify versions).

Running cargo build in a nix-shell with dependencies, I see:

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

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.
error: could not compile `zstd-seekable`.

Previously, I was able to fix this by applying the following patch:

--- 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));
             }

the tentative explanation being that _IO_FILE is an internal generated struct name due to bindgen, while FILE is the stable type alias.

There’s a thread on discourse.

pmeunier on November 13, 2020

Thanks! This was fixed by #ZCSRAIYQ5TQZP37S2CADCTWQ2F74XQ3VHYCLEHFDWVYV6SBTEHQQC

(and already published on crates.io).

pmeunier closed this discussion on November 13, 2020
robx on November 13, 2020

great, thank you!