www.fgks.org   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define-prefix doesn't work for non-standard pkgconfig paths #286

Open
lazka opened this issue Feb 21, 2023 · 1 comment
Open

define-prefix doesn't work for non-standard pkgconfig paths #286

lazka opened this issue Feb 21, 2023 · 1 comment

Comments

@lazka
Copy link
Contributor
lazka commented Feb 21, 2023

Short summary of my use case:

  • in MSYS2 we want/need to update to ffmpeg 5 while keeping 4.4 for some packages
  • for this we install the .pc files into <prefix>/lib/ffmpeg4.4/pkgconfig/ instead of <prefix>/lib/pkgconfig/ (we just set a different --incdir and --libdir to ffmpeg configure) so we can set the alternative pc path via something like export PKG_CONFIG_PATH="${MINGW_PREFIX}/lib/ffmpeg4.4/pkgconfig:$PKG_CONFIG_PATH" when wanting a package to links against 4.4

Problem:

The define-prefix logic in pkgconf doesn't support this since it just strips "/pkgconfig" from paths, so the detected prefix is

  • "<prefix>/lib/ffmpeg4.4/pkgconfig" instead of
  • "<prefix>/lib/ffmpeg4.4/pkgconfig".

So we get the following wrong output (one "/lib" too much):

$ export PKG_CONFIG_PATH="${MINGW_PREFIX}/lib/ffmpeg4.4/pkgconfig:$PKG_CONFIG_PATH"
$ pkgconf.exe --libs --cflags libavcodec
-IC:/msys64/ucrt64/lib/include/ffmpeg4.4 -LC:/msys64/ucrt64/lib/lib/ffmpeg4.4 -lavcodec

Context / Question:

The logic for this is defined here:

I'm not quite sure how to work around/fix that without hacks, so I'm asking here if someone had a similar problem and maybe an idea for a solution or a workaround.

The only thing I can think of is patching the .pc files after the build from libdir=${prefix}/lib/ffmpeg4.4 to libdir=${prefix}/../lib/ffmpeg4.4

If there is no solution feel free to close. At least I can link to this issue from my workarounds :)

@huyubiao
Copy link
Contributor

I have the same problem with Linux.

  • version:pkgconf 1.9.4

prepare:

$ export LINUX_PREFIX=/usr
$ mkdir -p ${LINUX_PREFIX}/lib64/python3.7/pkgconfig
$ mv python-3.7.pc  ${LINUX_PREFIX}/lib64/python3.7/pkgconfig
$ export PKG_CONFIG_PATH="${LINUX_PREFIX}/lib64/python3.7/pkgconfig:$PKG_CONFIG_PATH"
$ pkgconf --define-prefix --libs --cflags python-3.7

python-3.7.pc:

# See: man pkg-config
prefix=/usr
exec_prefix=/usr
libdir=${prefix}/lib64
includedir=${prefix}/include

Name: Python
Description: Python library
Requires:
Version: 3.7
Libs.private: -lcrypt -lpthread -ldl  -lutil
Libs: -L${libdir} -lpython3.7m
Cflags: -I${includedir}/python3.7m

output:

$ -I/usr/lib64/include/python3.7m -L/usr/lib64/lib64 -lpython3.7m

I created an additional /python3.7/pkgconfig in /usr/lib64 to store python-3.7.pc,It comes with extra /lib64.
I review the code and only parsed the last two levels of directories. I don't know if this is a bug?

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

No branches or pull requests

2 participants