# Build failure on macos (zstd-seekable, \_IO\_FILE)

**URL:** <https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577>\
**Category:** Question\
**Created:** [November 7, 2020, 1:47pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577 "2020-11-07T13:47:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rob/32/298_2.png) [@rob](https://discourse.pijul.org/u/rob)\
**Post date:** [November 7, 2020, 1:47pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/1 "2020-11-07T13:47:54Z")

</div>

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/](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:

```auto
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:

```auto
$ 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).

---

<div class="post-metadata">

**Author:** ![emily](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@emily](https://discourse.pijul.org/u/emily)\
**Post date:** [November 7, 2020, 7:40pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/2 "2020-11-07T19:40:33Z")

</div>

I got it working by downloading the source code from [https://static.crates.io/crates/anu/anu-1.0.0-alpha.crate](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.

---

<div class="post-metadata">

**Author:** ![rob](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rob/32/298_2.png) [@rob](https://discourse.pijul.org/u/rob)\
**Post date:** [November 7, 2020, 10:21pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/3 "2020-11-07T22:21:47Z")

</div>

Thank you! Got a working `anu` binary now.

The diff (besides editing the vendored checksum file):

```auto
--- 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:

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![rob](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rob/32/298_2.png) [@rob](https://discourse.pijul.org/u/rob)\
**Post date:** [November 10, 2020, 6:11pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/4 "2020-11-10T18:11:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fzzr](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/fzzr/32/175_2.png) [@fzzr](https://discourse.pijul.org/u/fzzr)\
**Post date:** [November 12, 2020, 3:13pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/5 "2020-11-12T15:13:13Z")

</div>

I just installed missed xxhash and issue solved for me.

---

<div class="post-metadata">

**Author:** ![rob](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rob/32/298_2.png) [@rob](https://discourse.pijul.org/u/rob)\
**Post date:** [November 12, 2020, 6:58pm UTC](https://discourse.pijul.org/t/build-failure-on-macos-zstd-seekable-io-file/577/6 "2020-11-12T18:58:44Z")

</div>

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