Stdlib with fpm

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

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

after use fpm build I’m obtaining this error

# 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!

1 Like

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.

1 Like

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

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

1 Like

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

$ 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!

It’s one option. Please check the README “Getting started” section for other approaches.

1 Like

Thanks @epagone !