# Forc/Rust project fails to compile on release mode, but debug mode works

**URL:** <https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161>\
**Category:** Tooling and IDE\
**Tags:** fuelup, feedback\
**Created:** [April 23, 2024, 1:38pm UTC](https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161 "2024-04-23T13:38:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArchieEinax](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ArchieEinax](https://forum.fuel.network/u/ArchieEinax)\
**Post date:** [April 23, 2024, 1:38pm UTC](https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161/1 "2024-04-23T13:38:26Z")

</div>

Hey everyone. I’ve encountered an issue recently where the dev (debug) build of a Rust + Forc project works, but the release build (forc build --release && cargo build --release) fails to compile. To provide a bit more details, the issue is in the abigen! macro mostly. In debug, it generates ABI properly, but in the release build I get this:

```auto
error: proc macro panicked
  --> src/orderbook_utils.rs:17:1
   |
17 | / abigen!(Contract(
18 | | name = "OrderbookContract",
19 | | abi = "contract/out/debug/orderbook-abi.json"
20 | | ));
   | |__^
   |
   = help: message: failed to parse JSON ABI from string: "failed to read artifact JSON file with path /home/raven/gitproj/complabs/spark-matcher-rs/contract/out/debug/orderbook-abi.json No such file or directory (os error 2)"

error[E0432]: unresolved import `self::abigen_bindings`
  --> src/orderbook_utils.rs:15:11
   |
15 | use self::abigen_bindings::orderbook_contract_mod;
   | ^^^^^^^^^^^^^^^ could not find `abigen_bindings` in `self`

error[E0412]: cannot find type `OrderbookContract` in this scope
  --> src/orderbook_utils.rs:23:19

```

Let me know what else I can provide in terms of info to help you investigate this.

---

<div class="post-metadata">

**Author:** ![hal3e](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@hal3e](https://forum.fuel.network/u/hal3e)\
**Post date:** [April 23, 2024, 3:59pm UTC](https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161/2 "2024-04-23T15:59:43Z")

</div>

When you compile the project with `forc build --release`, you should change the path of the `abi` file.

In your case, the new path would be `abi = "contract/out/release/orderbook-abi.json"`

---

<div class="post-metadata">

**Author:** ![ArchieEinax](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ArchieEinax](https://forum.fuel.network/u/ArchieEinax)\
**Post date:** [April 23, 2024, 4:22pm UTC](https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161/3 "2024-04-23T16:22:16Z")

</div>

Oh. That was… Uhm, thanks for the help! Yeah, of course it works with the release path.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [May 14, 2024, 12:22pm UTC](https://forum.fuel.network/t/forc-rust-project-fails-to-compile-on-release-mode-but-debug-mode-works/5161/4 "2024-05-14T12:22:49Z")

</div>

Closed on May 14, 2024, 12:22pm UTC

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
