Skip to content
New issue

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

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

Already on GitHub? # to your account

PKG_CONFIG_PATH is being double-quoted in the environment #5923

Closed
jonahbeckford opened this issue Apr 17, 2024 · 4 comments · Fixed by #6002
Closed

PKG_CONFIG_PATH is being double-quoted in the environment #5923

jonahbeckford opened this issue Apr 17, 2024 · 4 comments · Fixed by #6002
Assignees
Milestone

Comments

@jonahbeckford
Copy link
Contributor

This is opam 2.2~beta2. The problem did not manifest itself in opam 2.2~alpha0.

The dump from opam option is:

setenv                 [[PKG_CONFIG_SYSTEM_LIBRARY_PATH = ""] [PKG_CONFIG_SYSTEM_INCLUDE_PATH = ""] [PKG_CONFIG_PATH =
                       "Y:\\source\\dkml\\build\\pkg\\bump\\msys64\\clang64\\lib\\pkgconfig"]]

Yet the environment variable available inside opam install (and in the opam .env log file) is:

PKG_CONFIG_PATH="Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig"
@rjbou rjbou added this to the 2.2.0~beta3 milestone Apr 17, 2024
@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Apr 17, 2024

Test Cases without double quotes

# Cygwin and pkg-config

$ env 'PKG_CONFIG_PATH=Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig' pkg-config --cflags libffi
-IY:/source/dkml/build/pkg/bump/msys64/clang64/include

# MSYS2 and pkgconf

$ env 'PKG_CONFIG_PATH=Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig' pkgconf --cflags libffi
-IY:/source/dkml/build/pkg/bump/msys64/clang64/include

Conclusion: double-quotes are not needed

@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Apr 17, 2024

Test Cases with double quotes

# Cygwin and pkg-config
$ env 'PKG_CONFIG_PATH="Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig"' pkg-config --cflags libffi
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'virtual:world', not found

# MSYS2 and pkgconf

$ env 'PKG_CONFIG_PATH="Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig"' pkgconf --cflags libffi
-IZ:/msys64/clang64/bin/../include

Conclusion: adding double-quotes breaks both pkg-config and pkgconf

@jonahbeckford
Copy link
Contributor Author

Correction for Cygwin examples

# Cygwin using Cygwin native /usr/bin/pkg-config

$ cygpath -aw .
Z:\cygwin64\home\beckf

$ /usr/bin/pkg-config --version
2.2.0

$ env 'PKG_CONFIG_PATH=Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig' /usr/bin/pkg-config --cflags libffi
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi' not found

$ (cd /cygdrive/y && env 'PKG_CONFIG_PATH=Y:\source\dkml\build\pkg\bump\msys64\clang64\lib\pkgconfig' /usr/bin/pkg-config --cflags libffi)
-I/clang64/include

@dra27 dra27 self-assigned this Apr 24, 2024
RyanGibb added a commit to RyanGibb/opam that referenced this issue May 23, 2024
@dra27
Copy link
Member

dra27 commented May 24, 2024

The regression should be addressed in #5972, but the proper fix needs some more investigation. Certainly for pkgconf, under Cygwin we'll need to translate the Windows paths - the separator there is definitely a colon. I haven't yet checked MSYS2, but as pkgconf I think it is a native tool, I expect it may be using semicolons.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants