Struggling to build Python on Windows 10

Hi all,

I’m struggling to build Python 3.11 alpha 0 from source on Windows 10.

Steps I have taken:

  • Successfully installed Microsoft Visual Studio.
  • Successfully Installed git on my machine.
  • Successfully forked the CPython main branch on GitHub.
  • Successfully cloned my forked branch onto my local machine.
  • Navigated to the cpython repo folder on the command line.
  • Ran PCbuild\build.bat -e -d -p x64

The error I receive is:


LINK : fatal error LNK1104: cannot open file 'libffi-7.lib' [C:\Users\Alex\Desktop\Code dump\cpython\PCbuild\_ctypes.vcxproj]
    0 Warning(s)
    1 Error(s)

This appears to be the only error that takes place during the build process; the rest of the build works fine. It appears as though there is no file on my PC named libffi-7.lib. It does appear as though I have several files named libffi-8.lib. These can be found in the following locations:

  • cpython\externals\libffi\amd64
  • cpython\externals\libffi\arm32
  • cpython\externals\libffi\arm64
  • cpython\externals\libffi\win32

I am using the following hardware and software versions:

  • Microsoft Windows 10 Home, Version 10.0.19043 Build 19043
  • A x64-based PC
  • An HP Pavilion Notebook laptop
  • Processor AMD A8-7410 APU
  • git version
  • Microsoft Visual Studio 2017.
  • The build appears to be using an installed copy of Python 3.8 on my machine, which was installed with Conda.
  • The build informs me it is Using "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (found in the Visual Studio installation)

Variations on the build command I have tried, that have had no effect on the problem:

  • I initially tried building Python with Visual Studio 2019, and received the same error message. I then uninstalled Visual Studio 2019, installed Visual Studio 2017, and tried again. This had no effect on the error message that I received.
  • I tried running PCbuild\build.bat -E -d -p x64 instead of PCbuild\build.bat -e -d -p x64. This made no difference; the build failed in the same way, although I did get an additional warning informing me that Not including zlib is not a supported configuration.
  • I tried deleting the local copy of my forked branch and re-cloning it. This made no difference.
  • I tried enabling the .NET Framework 3.5 (includes .NET 2.0 and 3.0) on my machine. This made no difference.
  • I tried restarting my computer. This made no difference.

Does anyone have any ideas as to what might be going wrong and/or how to fix it?

libffi-7 is used in Python 3.10. Python 3.11 uses libffi-8.

Are you sure you forked / cloned the right branch ?

1 Like

Thanks so much! I can confirm I forked and cloned the main branch (and did both yesterday), and that my forked branch was Python 3.11 alpha 0. However, your comment led me to notice that, for some reason, my forked branch said that it was around 500 commits behind cpython/main. After fetching and merging from cpython/main and then recloning my branch, my build was successful.

Great that you resolved the issue.

1 Like