Error building csv-fortran with fpm

Hi,

I’ve been heavily using the csv-fortran package (jacobwilliams/csv-fortran: Read and Write CSV Files Using Modern Fortran).

Recently, since upgrading fpm from version 0.11 to 0.12, I’m no longer able to build the package.

I’m working on Windows 10 and using MSYS2 with gfortran 15.1.0 to compile Fortran programs.

When I try to build, I get the following error:

PowerShellPS D:\projects\my-fortran-project\build\dependencies\csv-fortran> fpm build --flag "Wall" csv_kinds.f90 failed. [ 20%] Compiling... gfortran: warning: Wall: linker input file unused because linking not done gfortran: error: Wall: linker input file not found: No such file or directory <ERROR> Compilation failed for object " src_csv_kinds.f90.o " <ERROR> stopping due to failed compilation STOP 1

I’m using the default fpm.toml file that comes with csv-fortran:

TOMLname = “csv-fortran”
version = “2.1.0”
author = “Jacob Williams”
maintainer = “Jacob Williams”
copyright = “Copyright (c) 2017-2023, Jacob Williams”
license = “BSD-3”
description = “Read and Write CSV Files Using Modern Fortran”
homepage = “GitHub - jacobwilliams/csv-fortran: Read and Write CSV Files Using Modern Fortran
categories = [“io”]
keywords = [“csv”]`
[library] source-dir = “src”
[install] library = true
[build] auto-executables = true auto-examples = true auto-tests = true

While I am able to compile the package with a Makefile, I find the fpm building tool incredibly helpful, and reverting to Makefiles feels like going back decades. Any assistance would be greatly appreciated!`

your command does not look correct: you want to use

fpm build --flag " -Wall"

while you’re using

fpm build --flag "Wall"

fpm does not prefix any flags automatically.

1 Like

Thanks!

I have corrected the command to fpm build --flag "-Wall". Nevertheless, fpm still does not build the csv-fortran package.

1 Like

I believe you’re right: just had a chance to test it with an updated MSYS2 environment, and indeed, it crashes.

I found that fpm was built on MSYS with gcc-15 which we do not support yet and apparently it crashes (likely compiler bug, ugh) at this default initializer:

       ! Fill in the compile_command_t
        cmd = compile_command_t(directory = string_t(cwd), &
                                arguments = [(string_t(trim(args(i))), i=1,n)], &
                                file = string_t(source_file))

I’ve opened a patch for this, by manually implementing an initializer, hopefully it will be available soon:

1 Like

Thank you very much for your help!