[libffi] Build error on x64-windows during manifest driven python3 build in VS2022
- Dominant language
- CMake
- Stars
- 27.5k
- Forks
- 7.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 321
Description
Building libffi as a dependency for python3 fails when specifying a builtin-baseline commit SHA using manifest mode in Visual Studio 2022. The build fails for any python 3 version greater than or equal to version 3.12.9 port version 8. Versions prior or equal to version 3.12.9 port version 7 build with no issues.
Package: libffi:x64-windows@3.5.2
**Host Environment**
- Host: x64-windows
- Compiler: MSVC 19.44.35213.0
- vcpkg-tool version: 2025-04-01-9c604254140797833b6f76908435c9fcbf09920e
vcpkg-readonly: true
vcpkg-scripts version: 4f8fe05871555c1798dbcb1957d0d595e94f7b57
**To Reproduce**
See vcpkg.json used at the end of this post.
**Failure logs**
```
-- Using cached libffi-3.5.2.tar.gz
-- Cleaning sources at C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/blds/libffi/src/libffi-3-c1e5d7d6da.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/Administrator/AppData/Local/vcpkg/downloads/libffi-3.5.2.tar.gz
-- Applying patch dll-bindir.diff
-- Using source at C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/blds/libffi/src/libffi-3-c1e5d7d6da.clean
-- Found external ninja('1.12.1').
-- Getting CMake variables for x64-windows
-- Loading CMake variables from C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/blds/libffi/cmake-get-vars_ASM_C_CXX-x64-windows.cmake.log
-- Using cached msys2-autoconf-wrapper-20240607-1-any.pkg.tar.zst
-- Using cached msys2-automake-wrapper-20240607-1-any.pkg.tar.zst
-- Using cached msys2-autoconf-archive-2023.02.20-1-any.pkg.tar.zst
-- Using cached msys2-binutils-2.43.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-libtool-2.4.7-4-x86_64.pkg.tar.zst
-- Using cached msys2-make-4.4.1-2-x86_64.pkg.tar.zst
-- Using cached msys2-which-2.21-4-x86_64.pkg.tar.zst
-- Using cached msys2-bash-5.2.037-1-x86_64.pkg.tar.zst
-- Using cached msys2-coreutils-8.32-5-x86_64.pkg.tar.zst
-- Using cached msys2-file-5.45-3-x86_64.pkg.tar.zst
-- Using cached msys2-gawk-5.3.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-grep-1~3.0-6-x86_64.pkg.tar.zst
-- Using cached msys2-gzip-1.13-1-x86_64.pkg.tar.zst
-- Using cached msys2-diffutils-3.10-1-x86_64.pkg.tar.zst
-- Using cached msys2-pkgconf-2.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-sed-4.9-1-x86_64.pkg.tar.zst
-- Using cached msys2-msys2-runtime-3.5.4-2-x86_64.pkg.tar.zst
-- Using cached msys2-autoconf2.72-2.72-1-any.pkg.tar.zst
-- Using cached msys2-automake1.16-1.16.5-1-any.pkg.tar.zst
-- Using cached msys2-automake1.17-1.17-1-any.pkg.tar.zst
-- Using cached msys2-libiconv-1.17-1-x86_64.pkg.tar.zst
-- Using cached msys2-libintl-0.22.4-1-x86_64.pkg.tar.zst
-- Using cached msys2-zlib-1.3.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-tar-1.35-2-x86_64.pkg.tar.zst
-- Using cached msys2-findutils-4.10.0-2-x86_64.pkg.tar.zst
-- Using cached msys2-gmp-6.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-gcc-libs-13.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-libbz2-1.0.8-4-x86_64.pkg.tar.zst
-- Using cached msys2-liblzma-5.6.3-1-x86_64.pkg.tar.zst
-- Using cached msys2-libzstd-1.5.6-1-x86_64.pkg.tar.zst
-- Using cached msys2-libreadline-8.2.013-1-x86_64.pkg.tar.zst
-- Using cached msys2-mpfr-4.2.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-libpcre-8.45-4-x86_64.pkg.tar.zst
-- Using cached msys2-m4-1.4.19-2-x86_64.pkg.tar.zst
-- Using cached msys2-perl-5.38.2-2-x86_64.pkg.tar.zst
-- Using cached msys2-ncurses-6.5.20240831-2-x86_64.pkg.tar.zst
-- Using cached msys2-libxcrypt-4.4.36-1-x86_64.pkg.tar.zst
-- Using msys root at C:/Users/Administrator/AppData/Local/vcpkg/downloads/tools/msys2/d1518c5fb772aeb9
-- Configuring x64-windows-dbg
-- Configuring x64-windows-rel
-- Using cached msys2-autoconf-wrapper-20240607-1-any.pkg.tar.zst
-- Using cached msys2-automake-wrapper-20240607-1-any.pkg.tar.zst
-- Using cached msys2-autoconf-archive-2023.02.20-1-any.pkg.tar.zst
-- Using cached msys2-binutils-2.43.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-libtool-2.4.7-4-x86_64.pkg.tar.zst
-- Using cached msys2-make-4.4.1-2-x86_64.pkg.tar.zst
-- Using cached msys2-which-2.21-4-x86_64.pkg.tar.zst
-- Using cached msys2-bash-5.2.037-1-x86_64.pkg.tar.zst
-- Using cached msys2-coreutils-8.32-5-x86_64.pkg.tar.zst
-- Using cached msys2-file-5.45-3-x86_64.pkg.tar.zst
-- Using cached msys2-gawk-5.3.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-grep-1~3.0-6-x86_64.pkg.tar.zst
-- Using cached msys2-gzip-1.13-1-x86_64.pkg.tar.zst
-- Using cached msys2-diffutils-3.10-1-x86_64.pkg.tar.zst
-- Using cached msys2-pkgconf-2.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-sed-4.9-1-x86_64.pkg.tar.zst
-- Using cached msys2-msys2-runtime-3.5.4-2-x86_64.pkg.tar.zst
-- Using cached msys2-autoconf2.72-2.72-1-any.pkg.tar.zst
-- Using cached msys2-automake1.16-1.16.5-1-any.pkg.tar.zst
-- Using cached msys2-automake1.17-1.17-1-any.pkg.tar.zst
-- Using cached msys2-libiconv-1.17-1-x86_64.pkg.tar.zst
-- Using cached msys2-libintl-0.22.4-1-x86_64.pkg.tar.zst
-- Using cached msys2-zlib-1.3.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-tar-1.35-2-x86_64.pkg.tar.zst
-- Using cached msys2-findutils-4.10.0-2-x86_64.pkg.tar.zst
-- Using cached msys2-gmp-6.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-gcc-libs-13.3.0-1-x86_64.pkg.tar.zst
-- Using cached msys2-libbz2-1.0.8-4-x86_64.pkg.tar.zst
-- Using cached msys2-liblzma-5.6.3-1-x86_64.pkg.tar.zst
-- Using cached msys2-libzstd-1.5.6-1-x86_64.pkg.tar.zst
-- Using cached msys2-libreadline-8.2.013-1-x86_64.pkg.tar.zst
-- Using cached msys2-mpfr-4.2.1-1-x86_64.pkg.tar.zst
-- Using cached msys2-libpcre-8.45-4-x86_64.pkg.tar.zst
-- Using cached msys2-m4-1.4.19-2-x86_64.pkg.tar.zst
-- Using cached msys2-perl-5.38.2-2-x86_64.pkg.tar.zst
-- Using cached msys2-ncurses-6.5.20240831-2-x86_64.pkg.tar.zst
-- Using cached msys2-libxcrypt-4.4.36-1-x86_64.pkg.tar.zst
-- Using msys root at C:/Users/Administrator/AppData/Local/vcpkg/downloads/tools/msys2/d1518c5fb772aeb9
-- Building/Installing x64-windows-dbg
-- Making target 'all' for x64-windows-dbg
-- Making target 'install' for x64-windows-dbg
-- Building/Installing x64-windows-rel
-- Making target 'all' for x64-windows-rel
-- Making target 'install' for x64-windows-rel
-- Fixing pkgconfig file: C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/pkgs/libffi_x64-windows/usr/local/lib/pkgconfig/libffi.pc
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:134 (message):
C:/src/Automation/python3testing/vcpkg_installed/x64-windows/x64-windows/tools/pkgconf/pkgconf.exe
--exists libffi failed with error code: 1
ENV{PKG_CONFIG_PATH}: "C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/pkgs/libffi_x64-windows/lib/pkgconfig;C:/src/Automation/python3testing/vcpkg_installed/x64-windows/vcpkg/pkgs/libffi_x64-windows/share/pkgconfig;C:/src/Automation/python3testing/vcpkg_installed/x64-windows/x64-windows/lib/pkgconfig;C:/src/Automation/python3testing/vcpkg_installed/x64-windows/x64-windows/share/pkgconfig"
output: 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
Call Stack (most recent call first):
scripts/cmake/vcpkg_fixup_pkgconfig.cmake:196 (z_vcpkg_fixup_pkgconfig_check_files)
C:/Users/Administrator/AppData/Local/vcpkg/registries/git-trees/7af0617a77238936f200b50b6f1797e280a43fbf/portfile.cmake:54 (vcpkg_fixup_pkgconfig)
scripts/ports.cmake:203 (include)
```
**Additional context**
vcpkg.json
```
{
"name": "custom-python3testing",
"version": "3.12.9-8",
"dependencies": [
{
"name": "python3"
}
],
"builtin-baseline": "23dc124705fcac41cf35c33dd9541f5094a9c19f"
}
```
Contributor guide
Research direction
Reproduce the manifest-driven python3 build from the provided vcpkg.json and failure log. Start with scripts/cmake/vcpkg_fixup_pkgconfig.cmake and the libffi portfile.cmake at the reported call site, then inspect how libffi.pc is installed and discovered. Done means libffi:x64-windows@3.5.2 builds successfully for the affected Python versions and pkg-config validation passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, python
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100