Skip to content

Cannot get pkg-config build flags: environment variable error. #1162

@tomneep

Description

@tomneep

Description

I'm having a strange problem building projects using the HDF5 metapackage on my Mac.

I have fpm and hdf5 installed with homebrew. If I clone the fpm repo, navigate to fpm/example_packages/metapackage_hdf5 and run fpm build I get

fpm build
<ERROR> *cmd_build* Model error: Cannot get pkg-config build flags: environment variable error.
STOP 1

After digging around a bit I found it occurs here:

fpm/src/fpm_pkg_config.f90

Lines 213 to 218 in f266033

! Set system flags
success = set_env('PKG_CONFIG_ALLOW_SYSTEM_CFLAGS',value=merge('1','0',allow_system))
if (.not.success) then
call fatal_error(error,'Cannot get pkg-config build flags: environment variable error.')
return
end if

If I set the environment variable PKG_CONFIG_ALLOW_SYSTEM_CFLAGS (to anything) then the project builds successfully.

PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=0 fpm build
 + mkdir -p build/dependencies
[  0%]                       main.f90
[ 50%]                       main.f90  done.
[ 50%]               metapackage_hdf5
[100%]               metapackage_hdf5  done.
[100%] Project compiled successfully.

Expected Behaviour

I'd expect the project to build without having to define the PKG_CONFIG_ALLOW_SYSTEM_CFLAGS environment variable.

Version of fpm

0.12.0

Platform and Architecture

MacOS/ARM

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions