# Rust example compiler error

**URL:** <https://forum.dfinity.org/t/rust-example-compiler-error/16963>\
**Category:** Developers\
**Tags:** Discussing\
**Created:** [December 1, 2022, 7:31am UTC](https://forum.dfinity.org/t/rust-example-compiler-error/16963 "2022-12-01T07:31:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiadd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xiadd/32/8080_2.png) [@xiadd](https://forum.dfinity.org/u/xiadd)\
**Post date:** [December 1, 2022, 7:31am UTC](https://forum.dfinity.org/t/rust-example-compiler-error/16963/1 "2022-12-01T07:31:41Z")

</div>

Hello,

I’m tring to test dfinity rust example on [examples/rust/counter at master · dfinity/examples · GitHub](https://github.com/dfinity/examples/tree/master/rust/counter), but failed all the time.

dfx version: 0.12.1  
rust version: 1.65.0 (897e37553 2022-11-02)

step:

- `git clone https://github.com/dfinity/examples && cd rust/counter`
- `make install`

base docker image: ubuntu:latest

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/7/7b05256ab72eb2204fee0b6e0cb9bdcfadd336de.png)

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [December 1, 2022, 7:59am UTC](https://forum.dfinity.org/t/rust-example-compiler-error/16963/2 "2022-12-01T07:59:31Z")

</div>

Cannot reproduce. It works on my machine, also with rust 1.65.0. Given that the errors appear come from the `typenum` crate and not the example code itself I would assume that this is a problem with your setup or something that happened when fetching dependencies, which we have no control over. Have you tried deleting your local caches or reinstalling rust?

---

<div class="post-metadata">

**Author:** ![xiadd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xiadd/32/8080_2.png) [@xiadd](https://forum.dfinity.org/u/xiadd)\
**Post date:** [December 1, 2022, 8:23am UTC](https://forum.dfinity.org/t/rust-example-compiler-error/16963/3 "2022-12-01T08:23:26Z")

</div>

Do you try in docker or local machine? Everytime I started a new docker image, so I’m sure no cache problem. What I do are only `git clone` and `make install`.

---

<div class="post-metadata">

**Author:** ![GLdev](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GLdev](https://forum.dfinity.org/u/GLdev)\
**Post date:** [December 1, 2022, 9:36am UTC](https://forum.dfinity.org/t/rust-example-compiler-error/16963/4 "2022-12-01T09:36:21Z")

</div>

Some ideas:

- Make sure to add “wasm32-unknown-unknown” by running

`rustup target add wasm32-unknown-unknown`

- Try running this from a non-root account
