# Stdlib with fpm

**URL:** <https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021>\
**Category:** Help\
**Created:** [October 7, 2021, 10:12pm UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021 "2021-10-07T22:12:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![juannaviap](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@juannaviap](https://fortran-lang.discourse.group/u/juannaviap)\
**Post date:** [October 7, 2021, 10:12pm UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/1 "2021-10-07T22:12:15Z")

</div>

Hello everyone! It is possible to use stdlib as an fpm package directly? I’m using gfortran under Ubuntu WSL2.

I created a new fpm project and add these lines to the end of the fpm.toml

```auto
[dependencies]
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }

```

after use fpm build I’m obtaining this error

```auto
# gfortran (for build/gfortran_debug/stdlib/stdlib_linalg_outer_product.o build/gfortran_debug/stdlib/stdlib_linalg_outer_product.mod)
f951: Fatal Error: Module file ‘stdlib_linalg.smod’ has not been generated, either because the module does not contain a MODULE PROCEDURE or there is an error in the module.
compilation terminated.
fpm: Error when running Shake build system:
  at want, called at src/Build.hs:205:11 in fpm-0.1.0.0-ExRRX9W2aflLvTBBChPpxh:Build
* Depends on: build/gfortran_debug/stdlib/libstdlib.a
  at need, called at src/Build.hs:203:13 in fpm-0.1.0.0-ExRRX9W2aflLvTBBChPpxh:Build
* Depends on: build/gfortran_debug/stdlib/stdlib_linalg_outer_product.o
  at &%>, called at src/Build.hs:183:11 in fpm-0.1.0.0-ExRRX9W2aflLvTBBChPpxh:Build
* Depends on: build/gfortran_debug/stdlib/stdlib_linalg_outer_product.o build/gfortran_debug/stdlib/stdlib_linalg_outer_product.mod
  at cmd, called at src/Build.hs:196:19 in fpm-0.1.0.0-ExRRX9W2aflLvTBBChPpxh:Build
* Raised the exception:
Development.Shake.cmd, system command failed
Command line: gfortran -c -Jbuild/gfortran_debug/stdlib -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fbounds-check -fcheck-array-temporaries -fbacktrace -o build/gfortran_debug/stdlib/stdlib_linalg_outer_product.o build/dependencies/stdlib/src/stdlib_linalg_outer_product.f90
Exit code: 1
Stderr:
f951: Fatal Error: Module file ‘stdlib_linalg.smod’ has not been generated, either because the module does not contain a MODULE PROCEDURE or there is an error in the module.
compilation terminated.

```

All the best!

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [October 8, 2021, 2:05am UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/2 "2021-10-08T02:05:06Z")

</div>

It looks like you’re using the old Haskell version of fpm. I wouldn’t be surprised if there is some aspect of stdlib that it doesn’t like. I recommend upgrading to a newer, Fortran version of fpm.

---

<div class="post-metadata">

**Author:** ![awvwgk](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/awvwgk/32/154_2.png) [@awvwgk](https://fortran-lang.discourse.group/u/awvwgk)\
**Post date:** [October 8, 2021, 8:22am UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/3 "2021-10-08T08:22:26Z")

</div>

There was an issue about this, where we discussed a few of the issues

> <https://github.com/fortran-lang/fpm-haskell/issues/11>
>
> Trying to use stdlib (https://github.com/LKedward/stdlib-fpm at commit \`eadc8ad5…eaf182adee04f1bd31624ad19b9eaf2c\`) for fpm yields the following error in Haskell fpm:
> 
> \`\`\`
> fpm: Error when running Shake build system:
> at want, called at src/Build.hs:167:11 in fpm-0.1.0.0-5jx9ZzGZ9Bb3Rtenr4ru0y:Build
> \* Depends on: build/gfortran\_30e5626f04e0df84\_2a4c534d3ee9fc79/stdlib/libstdlib.a
> at undefined, called at src/BuildModel.hs:108:16 in fpm-0.1.0.0-5jx9ZzGZ9Bb3Rtenr4ru0y:BuildModel
> at error, called at libraries/base/GHC/Err.hs:78:14 in base:GHC.Err
> \* Raised the exception:
> Prelude.undefined
> \`\`\`
> 
> This is a major blocker for using stdlib in Fortran fpm.

The best option of course would be to upgrade to a Fortran fpm version.

---

<div class="post-metadata">

**Author:** ![juannaviap](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@juannaviap](https://fortran-lang.discourse.group/u/juannaviap)\
**Post date:** [October 8, 2021, 9:26am UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/4 "2021-10-08T09:26:02Z")

</div>

@everythingfunctional @awvwgk Thanks for your responses! I made this

```auto
$ git clone https://github.com/fortran-lang/fpm.git
$ cd fpm
$ ./install.sh

```

and now seems to work. Is this the correct approach to update fpm?

All the best!

---

<div class="post-metadata">

**Author:** ![epagone](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/epagone/32/252_2.png) [@epagone](https://fortran-lang.discourse.group/u/epagone)\
**Post date:** [October 8, 2021, 10:58am UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/5 "2021-10-08T10:58:12Z")

</div>

> [@juannaviap](#):
>
> ```bash
> $ ./install.sh
> 
> ```
> 
> […] Is this the correct approach to update fpm?

It’s one option. Please check the [README “Getting started” section](https://github.com/fortran-lang/fpm/#getting-started) for other approaches.

---

<div class="post-metadata">

**Author:** ![juannaviap](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@juannaviap](https://fortran-lang.discourse.group/u/juannaviap)\
**Post date:** [October 8, 2021, 11:04am UTC](https://fortran-lang.discourse.group/t/stdlib-with-fpm/2021/6 "2021-10-08T11:04:35Z")

</div>

Thanks @epagone !
