Skip to content

depends: $(package)_*_env settings only apply to the first command #22719

@dongcarl

Description

@dongcarl

For example, $(package)_config_env is prepended to $(package)_config_cmds, which means that if $(package)_config_cmds contains multiple commands chained by &&, only the first command would have its environment modified according to $(package)_config_env.

$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))

Since $(package)_*_env settings contain crucial env vars such as PATH or PKG_CONFIG_PATH, its omission in subsequent commands is likely a bug:

bitcoin/depends/funcs.mk

Lines 137 to 142 in b935abb

$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
$(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake
$(1)_config_env+=PATH=$(build_prefix)/bin:$(PATH)
$(1)_build_env+=PATH=$(build_prefix)/bin:$(PATH)
$(1)_stage_env+=PATH=$(build_prefix)/bin:$(PATH)

This has lead to problems such as: #16883 (comment)

A test-able demo of this problem: dongcarl@e233c6d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions