# Troubleshooting Dependency Issues with http-client in FPM Projects: Resolving stdlib\_optval Error

**URL:** <https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196>\
**Category:** fpm\
**Created:** [July 21, 2023, 1:31pm UTC](https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196 "2023-07-21T13:31:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajkumardongre](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rajkumardongre/32/2610_2.png) [@rajkumardongre](https://fortran-lang.discourse.group/u/rajkumardongre)\
**Post date:** [July 21, 2023, 1:31pm UTC](https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196/1 "2023-07-21T13:31:47Z")

</div>

Hello everyone,

I’m currently involved in the [`http-client`](https://github.com/fortran-lang/http-client) project, which allows Fortran programmers to make HTTP requests. The project relies on the `stdlib` library as a dependency.

Recently, I encountered an issue while using `http-client` as a dependency in a [new fpm project](https://github.com/rajkumardongre/github-org-analyzer). When attempting to build the project with `fpm build`, I encountered the following error:

```bash
$ fpm build
<ERROR> *cmd_build* Target error: Unable to find the source for the module dependency: "stdlib_optval," which is used by "build/dependencies/http/src/http/http_client.f90"
STOP 1

```

I added `http` as a dependency in the `fpm.toml` file like this:

```toml
[dependencies]
http.git = "https://github.com/fortran-lang/http-client.git"

```

It seems that the error was related to the `stdlib`. To fix the problem, I added `stdlib="*"` to the `fpm.toml` file of the new project, and now the project builds successfully:

```toml
[dependencies]
http.git = "https://github.com/fortran-lang/http-client.git"
stdlib = "*"

```

This addition of `stdlib="*"` allows the new project to utilize the necessary `stdlib` features and resolve the build issue.

---

<div class="post-metadata">

**Author:** ![interkosmos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/interkosmos/32/296_2.png) [@interkosmos](https://fortran-lang.discourse.group/u/interkosmos)\
**Post date:** [July 21, 2023, 2:50pm UTC](https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196/2 "2023-07-21T14:50:09Z")

</div>

I had to replace:

```toml
stdlib = "*"

```

with

```toml
stdlib = { git = "https://github.com/fortran-lang/stdlib.git", branch="stdlib-fpm" }

```

Otherwise, it won’t work. Maybe, my fpm version is too old.

Edit: Updated from 0.8.1 to 0.9.0, works now.

---

<div class="post-metadata">

**Author:** ![rajkumardongre](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rajkumardongre/32/2610_2.png) [@rajkumardongre](https://fortran-lang.discourse.group/u/rajkumardongre)\
**Post date:** [July 21, 2023, 3:14pm UTC](https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196/3 "2023-07-21T15:14:56Z")

</div>

after replacing it, while building the project I am getting this error :

```bash
<ERROR> *cmd_build* Package error: Could not retrieve version string for metapackage key <stdlib>. Check syntax
STOP 1

```

my fpm version is also 0.9.0

---

<div class="post-metadata">

**Author:** ![FedericoPerini](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/federicoperini/32/1750_2.png) [@FedericoPerini](https://fortran-lang.discourse.group/u/FedericoPerini)\
**Post date:** [July 21, 2023, 8:35pm UTC](https://fortran-lang.discourse.group/t/troubleshooting-dependency-issues-with-http-client-in-fpm-projects-resolving-stdlib-optval-error/6196/4 "2023-07-21T20:35:28Z")

</div>

- For `fpm <= 0.8.2`: use git syntax
- For `fpm == 0.9.0`: use metapackage syntax (dependencies not supported)
- `HEAD` currently supports both those cases, but we have not released a new version yet.

Regarding handling dependencies with metapackages, I hope we can find consensus on the implementation during the upcoming monthly call: what should be done, for example, if one dependency requires a metapackage, but another one has it specified as a standard dependency? Which should have precedence?  
Maybe at some point fpm will have better version constraint resolution, but I don’t see it implemented in the short term
