Building First FPM case

Hi,

I am trying to compile my first FPM project.

The main file is in ‘app’ directory and source for ‘library’ is in src directory. I have modified the ‘fpm.toml’ directory based on documentation found in internet. I am expecting library to be created from SRC dir and get and executable, but am not able to get it. Following is the toml file I am using.

Regards

name = "firstLib"
version = "0.1.0"
license = "license"
author = "Jane Doe"
maintainer = "jane.doe@example.com"
copyright = "Copyright 2022, Jane Doe"
[library]
source-dir = "src"
[build]
auto-executables = true
auto-tests = false
auto-examples = false
[install]
library = true
1 Like

Hi @apoorv01 welcome to our Discourse. Could you provide some more info, specifically:

  • What errors are you getting
  • your fpm version
  • A repository with the source code for us to have a quick look

We have a couple of tutorials on the various features available with fpm at Tutorials — Fortran Package Manager, which might provide a good starting point. If you find anything missing there or insufficiently explained, please let us know.

Hi @awvwgk @gnikit,
I am able to make the library using the tutorial provided. it creats a libxyz.a file. Let me check whether I can use it in python
Regards
Apurva

Hi @gnikit and @awvwgk

The library FPM creates is static library. I couldn’t figure out how could I create a shared “.so” file from FPM. Any pointer should be helpful.

Bets Regards

Apurva

I think for the time being fpm builds only static libs.

I don’t think we have an issue for this yet, however there was already question at How to build a shared library with fpm · Discussion #655 · fortran-lang/fpm · GitHub a while ago. I’d be happy to discuss specifics on this at the fpm repository and we can come up with an implementation.

1 Like

@awvwgk @gnikit, Was able to successfully compile a Co-array test case using FPM and run it successfully. Thanks for your guidance.

2 Likes