问题
I am using pkg-config 0.26 on OS X Lion.
When I echo $PKG_CONFIG_PATH
, it seems that the variable is blank.
When I assign into it, e.g. PKG_CONFIG_PATH=/path/to/my/folder/containing/pc/files
, and then run pkg-config --list-all
, the .pc
files in the directory that I ostensibly just added are not found.
I have been side-stepping this issue by soft linking to individual .pc
files from /opt/local/share/pkgconfig
, but I would prefer to figure out what the right way is.
回答1:
Aha! This works:
export PKG_CONFIG_PATH=/path/to/my/folder/containing/pc/files
This makes total sense, it's just that I wrote the question before I knew the meaning of the command export
.
Quoting from Defining a variable with or without export :
export
makes the variable available to subprocesses
And pkgconfig is a subprocess of the shell when it is run.
来源:https://stackoverflow.com/questions/8692462/pkg-config-0-26-on-os-x-lion-seems-to-be-ignoring-pkg-config-path