# Cargo install/update error

**URL:** <https://users.rust-lang.org/t/cargo-install-update-error/142636>\
**Category:** uncategorized\
**Created:** [September 27, 2026, 1:32pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636 "2026-09-27T13:32:44Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [September 27, 2026, 1:32pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/1 "2026-09-27T13:32:44Z")

</div>

When I run the following command on my project:  
I get the following error:

 ![Cargo error](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/f/f/ff0d0ad2f3a5a3c9beacc5f962ff912310878498.png)  
Specifically, it asks for a series of ".h" files, the first of which are found in libz-sys  
How do I resolve this error?

Murray

---

<div class="post-metadata">

**Author:** ![jofas](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/jofas/32/30690_2.png) [@jofas](https://users.rust-lang.org/u/jofas)\
**Post date:** [September 27, 2026, 3:10pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/2 "2026-09-27T15:10:28Z")

</div>

> [@Murray](#):
>
> Specifically, it asks for a series of ".h" files, the first of which are found in libz-sys

I don't think `sys/types.h` is distributed with [zlib](https://github.com/madler/zlib/tree/master). I believe it is part of libc. Are you trying to build in a minimal container environment without libc, like [distroless](https://github.com/GoogleContainerTools/distroless) for example?

---

<div class="post-metadata">

**Author:** ![nerditation](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@nerditation](https://users.rust-lang.org/u/nerditation)\
**Post date:** [September 27, 2026, 11:53pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/3 "2026-09-27T23:53:15Z")

</div>

which toolchain are you using? are you on the tier 2 `-windows-gnullvm`? or do you have the `-windows-msvc` target and also installed `LLVM`?

it's strange to me that the compiler `clang` is selected on a windows system.

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [September 28, 2026, 11:37am UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/4 "2026-09-28T11:37:52Z")

</div>

I have this toolchain installed:

 ![Rust toolchain](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/a/2/a227d5be927170984ee49dac6be73bb8e7d34ebe.png)

Also, llvm is installed

 ![llvm version](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/0/9/09df61ba8cadca9e0e8e8fd19350d3d953698c07.png)

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/bjorn3/32/5255_2.png) [@bjorn3](https://users.rust-lang.org/u/bjorn3)\
**Post date:** [September 28, 2026, 1:38pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/5 "2026-09-28T13:38:32Z")

</div>

What env vars do you have set to configure the cc crate? By default it should be using msvc's cl.exe on windows-msvc AFAIK.

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [September 30, 2026, 3:47pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/6 "2026-09-30T15:47:28Z")

</div>

As far as I know, I don't have ANY environment variables set,  
related to msvc's cl.exe

Could you provide an example??

Thanks

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/bjorn3/32/5255_2.png) [@bjorn3](https://users.rust-lang.org/u/bjorn3)\
**Post date:** [September 30, 2026, 9:25pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/7 "2026-09-30T21:25:48Z")

</div>

Can you post the full build log? It should contain what the cc crate auto-detected.

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 6, 2026, 2:34pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/8 "2026-10-06T14:34:19Z")

</div>

Bjorn3:  
Somehow, I lost the cargo command that i was using, I believe that it was an overall update to cargo.  
If I could find the command again, I will rerun it, capturing all of the output in a log file.

Murray

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 9, 2026, 11:27am UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/9 "2026-10-09T11:27:59Z")

</div>

Bjorn:  
The command was: cargo install cargo-binstall --locked  
I have attached the log file.

Murray

(Attachment Cargo error.txt is missing)

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 9, 2026, 11:55am UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/10 "2026-10-09T11:55:41Z")

</div>

Bjorn:  
I tried to send the log file containing the error but I got this message:

Unfortunately some attachments in your email message to ["[**incoming+163519113b76e4d818f91e7d0b88a666@rust-lang.discoursemail.com**](mailto:incoming+163519113b76e4d818f91e7d0b88a666@rust-lang.discoursemail.com)"] (titled Re: [rust-users] Cargo install/update error) were rejected.

Details:  
Cargo error.txt: Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, heic, heif, webp, avif, svg).

If you believe this is an error, [**contact a staff member**](https://users.rust-lang.org/about).

What a bunch of nonsense, your forum doesn't support txt files??  
Laughable!!

> **(attachments)**
>
> ![Cargo error-98.jpg](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/8/d/8da1a786012245b85c233cee2dcb7ce5dd3b237c.jpeg)  
> ![Cargo error-99.jpg](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/6/9/6923994dfb1168de989db4d2e4a1eb6d899c9f99.jpeg)

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 9, 2026, 12:00pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/11 "2026-10-09T12:00:58Z")

</div>

Bjorn:  
If the error is not in those 2 files, I have many more files like that.  
The tool I used to convert the txt file to jpg's produced a few hundred files.  
I can upload more if you need them.

Murray

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/bjorn3/32/5255_2.png) [@bjorn3](https://users.rust-lang.org/u/bjorn3)\
**Post date:** [October 9, 2026, 12:33pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/12 "2026-10-09T12:33:30Z")

</div>

It looks like you have the CC\_x86\_64\_pc\_windows\_msvc env var set to `clang`. Try unsetting it.

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 11, 2026, 4:04pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/13 "2026-10-11T16:04:55Z")

</div>

Bjorn:  
I did not find that environment variable anywhere, here's a list of the variables I found:

 ![](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/6/4/64e79a869c86680f2a6bca9c83b7a278e0882e35.png)

 ![](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/6/c/6cd25c4b7eeb230a07b10abf85a3b3bd9c752012.png)

Murray

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/bjorn3/32/5255_2.png) [@bjorn3](https://users.rust-lang.org/u/bjorn3)\
**Post date:** [October 11, 2026, 5:51pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/14 "2026-10-11T17:51:34Z")

</div>

You do have `CC=clang` set however. Try unsetting that one.

---

<div class="post-metadata">

**Author:** ![Murray](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Murray](https://users.rust-lang.org/u/Murray)\
**Post date:** [October 16, 2026, 5:52pm UTC](https://users.rust-lang.org/t/cargo-install-update-error/142636/15 "2026-10-16T17:52:14Z")

</div>

Thanks, Bjorn, for the tip, unsetting that variable solved my problem.

Murray
