Skip to content

Compile Python 2.7 x64 for Windows 10 x64 with VS2017 #244

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

Closed
overboard75 opened this issue Apr 3, 2019 · 1 comment
Closed

Compile Python 2.7 x64 for Windows 10 x64 with VS2017 #244

overboard75 opened this issue Apr 3, 2019 · 1 comment
Labels

Comments

@overboard75
Copy link

overboard75 commented Apr 3, 2019

Hi guys,

Thanks for this tool, it's a great share. I can compile a static version of python 2.7.13 with static builtin modules.
However, I need to compile the builtin _ctypes module too. It works but I have an issue when I try to import ctypes.

import ctypes # builtin
'module' object has no attribute 'dllhandle'

According to your CMakeLists.txt,

if(WIN32)
    if(MINGW)
      add_python_extension(_ctypes
          SOURCES ${ctypes_COMMON_SOURCES}
                  _ctypes/libffi_mingw/closures.c
                  _ctypes/libffi_mingw/debug.c
                  _ctypes/libffi_mingw/prep_cif.c
                  _ctypes/libffi_mingw/raw_api.c
                  _ctypes/libffi_mingw/${_libffi_system_dir}/ffi.c
                  _ctypes/libffi_mingw/${_libffi_system_dir}/win32.S
          INCLUDEDIRS ${SRC_DIR}/Modules/_ctypes/libffi/src/${_libffi_system_dir}
                      ${SRC_DIR}/Modules/_ctypes/libffi/include
          DEFINITIONS X86_WIN32
        )
    else() # Visual Studio
      if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
          enable_language(ASM_MASM)
          set(_ctype_arch_impl win64.asm)
      else()
          set(_ctype_arch_impl win32.c)
      endif()
      add_python_extension(_ctypes
          SOURCES ${ctypes_COMMON_SOURCES}
                  _ctypes/malloc_closure.c
                  _ctypes/libffi_msvc/prep_cif.c
                  _ctypes/libffi_msvc/ffi.c
                  _ctypes/libffi_msvc/${_ctype_arch_impl}
          REQUIRES BUILD_LIBPYTHON_SHARED
          INCLUDEDIRS ${SRC_DIR}/Modules/_ctypes/libffi_msvc
        )
    endif()

We need to compile a shared lib version of python instead of a static lib (REQUIRES BUILD_LIBPYTHON_SHARED) but I do need to compile a static one.

Do you have an idea?

Thanks a lot,

@jcfr jcfr added backlog Type: Question User question labels Dec 29, 2021
@jcfr
Copy link
Contributor

jcfr commented Jun 2, 2025

Closing. Support for Python 2.7.x was retired:

@jcfr jcfr closed this as completed Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants