Skip to content

Fix cross-compilaton by using PKG_CONFIG env variable#148

Open
onny wants to merge 1 commit into
libfuse:mainfrom
onny:pkg-config-dynamic
Open

Fix cross-compilaton by using PKG_CONFIG env variable#148
onny wants to merge 1 commit into
libfuse:mainfrom
onny:pkg-config-dynamic

Conversation

@onny

@onny onny commented Jul 9, 2026

Copy link
Copy Markdown

Cross compilation to RiscV on NixOS failed because the binary name differs to the hardcoded pkg-config one set in pyfuse3 build utils. This parses PKG_CONFIG env from the system, used by most build systems and otherwise falls back to pkg-config if not set.

Comment thread util/build_backend.py
def pkg_config(pkg, cflags=True, ldflags=False, min_ver=None):
"""Frontend to pkg-config"""

PKG_CONFIG = os.environ.get('PKG_CONFIG', 'pkg-config').split()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why split by whitespace?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as i read the PKG_CONFIG variable can hold, in addition to the executable name, also extra command line arguments. splitting it so we could feed the resulting list in subprocess as a command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I did not expect that. Could you add a comment explaining this (ideally with a link to the place where this env variable is described)?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is about splitting an arbitrary shell command, just splitting by whitespace is not good enough.

rather use this:

https://docs.python.org/3/library/shlex.html#shlex.split

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants